Add bufferline options to always show the bufferline, use ordinal numbers, and sort by insert position in the current setup
This commit is contained in:
parent
e7b27047e2
commit
606b0572d2
|
@ -10,3 +10,5 @@ vim.opt.scrolloff = 8
|
|||
vim.opt.colorcolumn = "80"
|
||||
|
||||
vim.opt.swapfile = false
|
||||
|
||||
vim.o.cmdheight = 2
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
set grepprg=rg\ --vimgrep
|
||||
|
||||
function! Grep(...)
|
||||
return system(join([&grepprg] + [expandcmd(join(a:000, ' '))], ' '))
|
||||
endfunction
|
||||
|
||||
command! -nargs=+ -complete=file_in_path -bar Grep cgetexpr Grep(<f-args>)
|
||||
command! -nargs=+ -complete=file_in_path -bar LGrep lgetexpr Grep(<f-args>)
|
||||
|
||||
cnoreabbrev <expr> grep (getcmdtype() ==# ':' && getcmdline() ==# 'grep') ? 'Grep' : 'grep'
|
||||
cnoreabbrev <expr> lgrep (getcmdtype() ==# ':' && getcmdline() ==# 'lgrep') ? 'LGrep' : 'lgrep'
|
||||
|
||||
augroup quickfix
|
||||
autocmd!
|
||||
autocmd QuickFixCmdPost cgetexpr TroubleToggle quickfix
|
||||
autocmd QuickFixCmdPost lgetexpr TroubleToggle loclist
|
||||
augroup END
|
|
@ -1,5 +1,4 @@
|
|||
local function open_nvim_tree(data)
|
||||
|
||||
-- buffer is a real file on the disk
|
||||
local real_file = vim.fn.filereadable(data.file) == 1
|
||||
|
||||
|
|
|
@ -1,39 +1,11 @@
|
|||
local keymap = vim.keymap.set
|
||||
local trouble = require("trouble")
|
||||
|
||||
vim.api.nvim_create_autocmd('DiagnosticChanged', {
|
||||
callback = function()
|
||||
vim.diagnostic.setqflist({ open = false })
|
||||
vim.diagnostic.setloclist({ open = false })
|
||||
end,
|
||||
})
|
||||
|
||||
function QuickFixToggle()
|
||||
if trouble.is_open() then
|
||||
trouble.close()
|
||||
else
|
||||
trouble.open({
|
||||
mode = "quickfix"
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
function LocationListToggle()
|
||||
if trouble.is_open() then
|
||||
trouble.close()
|
||||
else
|
||||
trouble.open({
|
||||
mode = "loclist"
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
-- Quickfix
|
||||
keymap("n", "<leader>qq", ":lua QuickFixToggle()<CR>", { desc = "[Q]uickfix [Q]uick" })
|
||||
keymap("n", "<leader>qq", ":TroubleToggle quickfix<CR>", { desc = "[Q]uickfix [Q]uick" })
|
||||
keymap("n", "<leader>qn", "<cmd>cnext<CR>zz", { desc = "[Q]uick [N]ext" })
|
||||
keymap("n", "<leader>qp", "<cmd>cprev<CR>zz", { desc = "[Q]uick [P]revious" })
|
||||
|
||||
-- Location List
|
||||
keymap("n", "<leader>ll", ":lua LocationListToggle()<CR>", { desc = "[L]ocation [L]ist" })
|
||||
keymap("n", "<leader>ll", ":TroubleToggle loclist<CR>", { desc = "[L]ocation [L]ist" })
|
||||
keymap("n", "<leader>ln", "<cmd>lnext<CR>zz", { desc = "[L]ocation [N]ext" })
|
||||
keymap("n", "<leader>lp", "<cmd>lprev<CR>zz", { desc = "[L]ocation [P]revious" })
|
||||
|
|
2
init.lua
2
init.lua
|
@ -399,7 +399,7 @@ local on_attach = function(_, bufnr)
|
|||
|
||||
-- See `:help K` for why this keymap
|
||||
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
||||
nmap('<C-K>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
||||
-- nmap('<C-K>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
||||
|
||||
-- Lesser used LSP functionality
|
||||
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||
|
|
|
@ -4,12 +4,14 @@ return {
|
|||
config = function()
|
||||
require("bufferline").setup {
|
||||
options = {
|
||||
numbers = "ordinal",
|
||||
indicator = { style = "icon", icon = "▎" },
|
||||
diagnostics = 'nvim_lsp', -- | "nvim_lsp" | "coc",
|
||||
diagnostics_update_in_insert = false,
|
||||
offsets = { { filetype = "NvimTree", text = "File Explorer", padding = 1 } },
|
||||
separator_style = "thin", -- | "thick" | "thin" | { 'any', 'any' },
|
||||
always_show_bufferline = true,
|
||||
sort_by = "insert_after_current"
|
||||
}
|
||||
}
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue