aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--nvim/.config/nvim/lua/tobyvin/autocmds.lua8
-rw-r--r--nvim/.config/nvim/lua/tobyvin/lsp/handlers.lua4
-rw-r--r--nvim/.config/nvim/lua/tobyvin/options.lua5
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins.lua7
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/nvim-bqf.lua82
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/trouble.lua16
6 files changed, 88 insertions, 34 deletions
diff --git a/nvim/.config/nvim/lua/tobyvin/autocmds.lua b/nvim/.config/nvim/lua/tobyvin/autocmds.lua
index 369b62a..b60d912 100644
--- a/nvim/.config/nvim/lua/tobyvin/autocmds.lua
+++ b/nvim/.config/nvim/lua/tobyvin/autocmds.lua
@@ -56,14 +56,10 @@ M.setup = function()
vim.api.nvim_create_autocmd("FileType", {
group = vim.api.nvim_create_augroup("tobyvin_help", { clear = true }),
pattern = "help",
- callback = function(args)
- vim.wo.wrap = true
- vim.bo[args.buf].textwidth = 120
- vim.wo.colorcolumn = nil
+ callback = function()
vim.cmd("wincmd L")
- vim.api.nvim_win_set_width(0, vim.o.textwidth)
end,
- desc = "Setup and resize help window",
+ desc = "Vertical help window",
})
vim.api.nvim_create_autocmd("BufWritePost", {
diff --git a/nvim/.config/nvim/lua/tobyvin/lsp/handlers.lua b/nvim/.config/nvim/lua/tobyvin/lsp/handlers.lua
index 80c336f..9423f62 100644
--- a/nvim/.config/nvim/lua/tobyvin/lsp/handlers.lua
+++ b/nvim/.config/nvim/lua/tobyvin/lsp/handlers.lua
@@ -63,10 +63,6 @@ M.setup = function()
if client.name ~= "rust_analyzer" then
vim.lsp.handlers["textDocument/definition"] = M.wrap_handler("textDocument/definition")
- vim.lsp.handlers["textDocument/declaration"] = M.wrap_handler("textDocument/declaration")
- vim.lsp.handlers["textDocument/type_definition"] = M.wrap_handler("textDocument/type_definition")
- vim.lsp.handlers["textDocument/implementation"] = M.wrap_handler("textDocument/implementation")
- vim.lsp.handlers["textDocument/references"] = M.wrap_handler("textDocument/references")
end
if client.server_capabilities["definitionProvider"] then
diff --git a/nvim/.config/nvim/lua/tobyvin/options.lua b/nvim/.config/nvim/lua/tobyvin/options.lua
index 7887dfd..4461393 100644
--- a/nvim/.config/nvim/lua/tobyvin/options.lua
+++ b/nvim/.config/nvim/lua/tobyvin/options.lua
@@ -2,10 +2,11 @@ local M = {}
M.setup = function()
vim.g.mapleader = " "
+ vim.g.netrw_keepdir = 0
vim.g.netrw_preview = 1
vim.g.netrw_banner = 0
- vim.g.netrw_altv = "nospr"
- vim.g.netrw_winsize = -30
+ vim.g.netrw_altv = "spr"
+ vim.g.netrw_winsize = 30
vim.g.netrw_usetab = 1
vim.g.netrw_altfile = 1
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins.lua b/nvim/.config/nvim/lua/tobyvin/plugins.lua
index 43e1a93..5800e56 100644
--- a/nvim/.config/nvim/lua/tobyvin/plugins.lua
+++ b/nvim/.config/nvim/lua/tobyvin/plugins.lua
@@ -228,13 +228,8 @@ M.plugins = function(use)
"junegunn/fzf",
},
ft = "qf",
- })
-
- use({
- "folke/trouble.nvim",
- cmd = "TroubleToggle",
config = function()
- require("tobyvin.plugins.trouble").setup()
+ require("tobyvin.plugins.nvim-bqf").setup()
end,
})
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/nvim-bqf.lua b/nvim/.config/nvim/lua/tobyvin/plugins/nvim-bqf.lua
new file mode 100644
index 0000000..9ce8ee4
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/nvim-bqf.lua
@@ -0,0 +1,82 @@
+local M = {}
+
+M.qftf = function(info)
+ local items
+ local ret = {}
+ -- The name of item in list is based on the directory of quickfix window.
+ -- Change the directory for quickfix window make the name of item shorter.
+ -- It's a good opportunity to change current directory in quickfixtextfunc :)
+ --
+ -- local alterBufnr = fn.bufname('#') -- alternative buffer is the buffer before enter qf window
+ -- local root = getRootByAlterBufnr(alterBufnr)
+ -- vim.cmd(('noa lcd %s'):format(fn.fnameescape(root)))
+ --
+ if info.quickfix == 1 then
+ items = vim.fn.getqflist({ id = info.id, items = 0 }).items
+ else
+ items = vim.fn.getloclist(info.winid, { id = info.id, items = 0 }).items
+ end
+ local limit = 31
+ local fnameFmt1, fnameFmt2 = "%-" .. limit .. "s", "…%." .. (limit - 1) .. "s"
+ local validFmt = "%s │%5d:%-3d│%s %s"
+ for i = info.start_idx, info.end_idx do
+ local e = items[i]
+ local fname = ""
+ local str
+ if e.valid == 1 then
+ if e.bufnr > 0 then
+ fname = vim.fn.bufname(e.bufnr)
+ if fname == "" then
+ fname = "[No Name]"
+ else
+ fname = fname:gsub("^" .. vim.env.HOME, "~")
+ end
+ -- char in fname may occur more than 1 width, ignore this issue in order to keep performance
+ if #fname <= limit then
+ fname = fnameFmt1:format(fname)
+ else
+ fname = fnameFmt2:format(fname:sub(1 - limit))
+ end
+ end
+ local lnum = e.lnum > 99999 and -1 or e.lnum
+ local col = e.col > 999 and -1 or e.col
+ local qtype = e.type == "" and "" or " " .. e.type:sub(1, 1):upper()
+ str = validFmt:format(fname, lnum, col, qtype, e.text)
+ else
+ str = e.text
+ end
+ table.insert(ret, str)
+ end
+ return ret
+end
+
+M.setup = function()
+ local status_ok, bqf = pcall(require, "bqf")
+ if not status_ok then
+ vim.notify("Failed to load module 'bqf'", vim.log.levels.ERROR)
+ return
+ end
+
+ bqf.setup({
+ auto_resize_height = true,
+ preview = {
+ border_chars = { "┃", "┃", "━", "━", "┏", "┓", "┗", "┛", "█" },
+ },
+ func_map = {
+ drop = "o",
+ openc = "O",
+ split = "<C-s>",
+ tabdrop = "<C-t>",
+ tabc = "",
+ ptogglemode = "z,",
+ },
+ filter = {
+ fzf = {
+ action_for = { ["ctrl-s"] = "split", ["ctrl-t"] = "tab drop" },
+ extra_opts = { "--bind", "ctrl-o:toggle-all", "--prompt", "> " },
+ },
+ },
+ })
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/trouble.lua b/nvim/.config/nvim/lua/tobyvin/plugins/trouble.lua
deleted file mode 100644
index 2568197..0000000
--- a/nvim/.config/nvim/lua/tobyvin/plugins/trouble.lua
+++ /dev/null
@@ -1,16 +0,0 @@
-local utils = require("tobyvin.utils")
-local M = {}
-
-M.setup = function()
- local status_ok, trouble = pcall(require, "trouble")
- if not status_ok then
- vim.notify("Failed to load module 'trouble'", vim.log.levels.ERROR)
- return
- end
-
- trouble.setup({
- use_diagnostic_signs = true,
- })
-end
-
-return M