repos / dotfiles

my dotfiles

commit
d85407b
parent
cddd366
author
Eric Bower
date
2025-09-21 14:36:02 -0400 EDT
refactor(nvim): replace fzf-lua with custom qf bindings
2 files changed,  +53, -50
M dot_config/foot/foot.ini
+0, -3
1@@ -8,6 +8,3 @@ pad=6x4
2 background=14161b
3 [url]
4 launch=xdg-open ${url}
5-[key-bindings]
6-font-increase=Control+i
7-font-decrease=Control+o
M dot_config/nvim/init.lua
+53, -47
  1@@ -6,7 +6,7 @@
  2     - single file
  3     - use native nvim features (>= v0.12)
  4     - use default keybindings unless painful otherwise
  5-    - use default colorscheme
  6+    - use default colorschemes
  7     - plugins must be integral to workflow
  8 ]]
  9 local o = vim.opt
 10@@ -31,13 +31,33 @@ o.swapfile = false
 11 o.foldmethod = "indent"
 12 o.foldlevel = 99
 13 o.foldnestmax = 1
 14-o.grepprg = "rg --vimgrep --smart-case"
 15+o.grepprg = "rg --vimgrep --smart-case --no-heading"
 16 o.grepformat = "%f:%l:%c:%m"
 17 vim.g.mapleader = ","
 18 vim.g.maplocalleader = ","
 19 vim.diagnostic.config({
 20 	severity_sort = true,
 21 })
 22+require("vim._extui").enable({}) -- https://github.com/neovim/neovim/pull/27855
 23+
 24+local function cqf(cmd)
 25+	if cmd == nil then
 26+		return
 27+	end
 28+
 29+	local files = vim.fn.systemlist(cmd)
 30+	if #files == 1 then
 31+		vim.cmd(string.format("edit %s", files[1]))
 32+		return
 33+	end
 34+
 35+	vim.fn.setqflist({}, "r", {
 36+		title = cmd,
 37+		lines = files,
 38+		efm = "%f",
 39+	})
 40+	vim.cmd("copen")
 41+end
 42 
 43 local opts = { silent = true }
 44 local map = vim.keymap.set
 45@@ -47,23 +67,43 @@ map("n", "<C-k>", "<cmd>wincmd k<cr>", opts) -- navigate splits
 46 map("n", "<C-j>", "<cmd>wincmd j<cr>", opts)
 47 map("n", "<C-h>", "<cmd>wincmd h<cr>", opts)
 48 map("n", "<C-l>", "<cmd>wincmd l<cr>", opts)
 49-map("n", "<C-u>", "<C-u>zz", opts) -- half step + center cursor, less disorienting page movements
 50-map("n", "<C-d>", "<C-d>zz", opts)
 51 map("n", "<leader>t", "<cmd>bd!<cr>", opts)
 52 map("n", "<leader>e", vim.diagnostic.open_float, opts)
 53-map("n", "<leader>q", vim.diagnostic.setloclist, opts)
 54-map({ "n", "v" }, "<leader>gy", "<cmd>GitLink<cr>", opts)
 55+map("n", "<leader>r", vim.diagnostic.setloclist, opts)
 56+map("n", "<leader>b", ":b ")
 57+map({ "n", "v" }, "<leader>u", "<cmd>GitLink<cr>", opts)
 58 map("n", "<leader>y", function() -- copy relative filepath to clipboard
 59 	vim.fn.setreg("+", vim.fn.expand("%"))
 60 end)
 61--- https://github.com/shell-pool/shpool/issues/240#issuecomment-3097566679
 62-map("n", "<leader>l", function()
 63+map("n", "<leader>q", function() -- toggle quickfix
 64+	for _, win in ipairs(vim.fn.getwininfo()) do
 65+		if win.quickfix == 1 then
 66+			vim.cmd("cclose")
 67+			return
 68+		end
 69+	end
 70+	vim.cmd("copen")
 71+end, opts)
 72+map("n", "<leader>g", function() -- grep entire project
 73+	vim.ui.input({ prompt = "grep: " }, function(search)
 74+		vim.cmd(string.format("silent grep! %s **", search))
 75+		vim.cmd("copen")
 76+	end)
 77+end, opts)
 78+map("n", "<leader>s", function() -- fuzzy match files into quickfix
 79+	vim.ui.input({ prompt = "file: " }, function(file)
 80+		cqf(string.format("fd -t f | fzf -f %s", file))
 81+	end)
 82+end)
 83+map("n", "<leader>d", function() -- git diff into quickfix
 84+	cqf("git diff --name-only")
 85+end)
 86+map("n", "<leader>l", function() -- https://github.com/shell-pool/shpool/issues/240#issuecomment-3097566679
 87 	io.stdout:write("\027[?2048h")
 88 end, opts)
 89 
 90 local augroup = vim.api.nvim_create_augroup("erock.cfg", { clear = true })
 91 local autocmd = vim.api.nvim_create_autocmd
 92-autocmd("Filetype", { group = augroup, pattern = { "qf" }, command = "setlocal wrap" })
 93 autocmd("Filetype", { group = augroup, pattern = { "make" }, command = "setlocal noexpandtab tabstop=4 shiftwidth=4" })
 94 
 95 local function setup_lsp()
 96@@ -89,40 +129,6 @@ local function setup_lsp()
 97 	})
 98 end
 99 
100-local function setup_fzf()
101-	local fzf = require("fzf-lua")
102-	local noprev = { winopts = { fullscreen = true, preview = { hidden = "hidden" } } }
103-	local with_prev = { winopts = { fullscreen = true } }
104-
105-	local fzf_files = function()
106-		fzf.files(noprev)
107-	end
108-	local fzf_symbols = function()
109-		fzf.lsp_document_symbols(noprev)
110-	end
111-	local fzf_buffers = function()
112-		fzf.buffers(noprev)
113-	end
114-	local fzf_live_grep = function()
115-		fzf.live_grep(with_prev)
116-	end
117-	local fzf_jumps = function()
118-		fzf.jumps(with_prev)
119-	end
120-	local fzf_git_diff = function()
121-		fzf.git_diff(with_prev)
122-	end
123-	map("n", "<leader>s", fzf_files, { desc = "fzf files", noremap = true, silent = true })
124-	map("n", "<leader>F", fzf_symbols, { desc = "fzf symbols", noremap = true, silent = true })
125-	map("n", "<leader>f", fzf_buffers, { desc = "fzf buffers", noremap = true, silent = true })
126-	map("n", "<leader>S", fzf_live_grep, { desc = "fzf grep", noremap = true, silent = true })
127-	map("n", "<leader>j", fzf_jumps, { desc = "fzf jumplist", noremap = true, silent = true })
128-	map("n", "<leader>d", fzf_git_diff, { desc = "fzf git diff", noremap = true, silent = true })
129-	-- cexpr system('git diff --name-only | awk ''{print $0 ":1:1"}''') | copen
130-	-- cexpr system('fd -t f lua | awk ''{print $0 ":1:1"}''') | copen
131-	fzf.setup({ "max-perf" })
132-end
133-
134 local function setup_ts()
135 	local ts_parsers = {
136 		"bash",
137@@ -181,13 +187,13 @@ vim.pack.add({
138 	{ src = "https://github.com/nvim-treesitter/nvim-treesitter", version = "main" },
139 	"https://github.com/nvim-treesitter/nvim-treesitter-context",
140 	"https://github.com/neovim/nvim-lspconfig",
141-	"https://github.com/ibhagwan/fzf-lua",
142-	"https://github.com/linrongbin16/gitlinker.nvim",
143 	"https://github.com/tpope/vim-fugitive",
144+	"https://github.com/karb94/neoscroll.nvim",
145+	"https://github.com/linrongbin16/gitlinker.nvim",
146 })
147 
148 setup_ts()
149 setup_lsp()
150-setup_fzf()
151-require("gitlinker").setup()
152 require("treesitter-context").setup({ max_lines = 3, separator = ">", mode = "topline" })
153+require("neoscroll").setup({ duration_multiplier = 0.3 })
154+require("gitlinker").setup()