Update neovim config

This commit is contained in:
Warren Hood 2024-02-16 17:11:17 +02:00
parent a18cee6715
commit 5d4b1f6dcc
3 changed files with 153 additions and 110 deletions

View file

@ -101,61 +101,64 @@ if vim.g.neovide then
end end
-- barbar -- -- barbar
local barbar_opts = { noremap = true, silent = true } -- local barbar_opts = { noremap = true, silent = true }
--
-- Move to previous/next -- -- Move to previous/next
map('n', '<A-,>', '<Cmd>BufferPrevious<CR>', barbar_opts) -- map('n', '<A-,>', '<Cmd>BufferPrevious<CR>', barbar_opts)
map('n', '<A-.>', '<Cmd>BufferNext<CR>', barbar_opts) -- map('n', '<A-.>', '<Cmd>BufferNext<CR>', barbar_opts)
-- Re-order to previous/next -- -- Re-order to previous/next
map('n', '<A-<>', '<Cmd>BufferMovePrevious<CR>', barbar_opts) -- map('n', '<A-<>', '<Cmd>BufferMovePrevious<CR>', barbar_opts)
map('n', '<A->>', '<Cmd>BufferMoveNext<CR>', barbar_opts) -- map('n', '<A->>', '<Cmd>BufferMoveNext<CR>', barbar_opts)
-- Goto buffer in position... -- -- Goto buffer in position...
map('n', '<A-1>', '<Cmd>BufferGoto 1<CR>', barbar_opts) -- map('n', '<A-1>', '<Cmd>BufferGoto 1<CR>', barbar_opts)
map('n', '<A-2>', '<Cmd>BufferGoto 2<CR>', barbar_opts) -- map('n', '<A-2>', '<Cmd>BufferGoto 2<CR>', barbar_opts)
map('n', '<A-3>', '<Cmd>BufferGoto 3<CR>', barbar_opts) -- map('n', '<A-3>', '<Cmd>BufferGoto 3<CR>', barbar_opts)
map('n', '<A-4>', '<Cmd>BufferGoto 4<CR>', barbar_opts) -- map('n', '<A-4>', '<Cmd>BufferGoto 4<CR>', barbar_opts)
map('n', '<A-5>', '<Cmd>BufferGoto 5<CR>', barbar_opts) -- map('n', '<A-5>', '<Cmd>BufferGoto 5<CR>', barbar_opts)
map('n', '<A-6>', '<Cmd>BufferGoto 6<CR>', barbar_opts) -- map('n', '<A-6>', '<Cmd>BufferGoto 6<CR>', barbar_opts)
map('n', '<A-7>', '<Cmd>BufferGoto 7<CR>', barbar_opts) -- map('n', '<A-7>', '<Cmd>BufferGoto 7<CR>', barbar_opts)
map('n', '<A-8>', '<Cmd>BufferGoto 8<CR>', barbar_opts) -- map('n', '<A-8>', '<Cmd>BufferGoto 8<CR>', barbar_opts)
map('n', '<A-9>', '<Cmd>BufferGoto 9<CR>', barbar_opts) -- map('n', '<A-9>', '<Cmd>BufferGoto 9<CR>', barbar_opts)
map('n', '<A-0>', '<Cmd>BufferLast<CR>', barbar_opts) -- map('n', '<A-0>', '<Cmd>BufferLast<CR>', barbar_opts)
-- Pin/unpin buffer -- -- Pin/unpin buffer
map('n', '<A-p>', '<Cmd>BufferPin<CR>', barbar_opts) -- map('n', '<A-p>', '<Cmd>BufferPin<CR>', barbar_opts)
-- Close buffer -- -- Close buffer
map('n', '<A-c>', '<Cmd>BufferClose<CR>', barbar_opts) -- map('n', '<A-c>', '<Cmd>BufferClose<CR>', barbar_opts)
-- Wipeout buffer -- -- Wipeout buffer
-- :BufferWipeout -- -- :BufferWipeout
--
-- Close commands -- -- Close commands
-- :BufferCloseAllButCurrent -- -- :BufferCloseAllButCurrent
-- :BufferCloseAllButPinned -- -- :BufferCloseAllButPinned
-- :BufferCloseAllButCurrentOrPinned -- -- :BufferCloseAllButCurrentOrPinned
-- :BufferCloseBuffersLeft -- -- :BufferCloseBuffersLeft
-- :BufferCloseBuffersRight -- -- :BufferCloseBuffersRight
-- Magic buffer-picking mode -- -- Magic buffer-picking mode
map('n', '<C-p>', '<Cmd>BufferPick<CR>', barbar_opts) -- map('n', '<C-p>', '<Cmd>BufferPick<CR>', barbar_opts)
-- Sort automatically by... -- -- Sort automatically by...
map('n', '<Space>bb', '<Cmd>BufferOrderByBufferNumber<CR>', barbar_opts) -- map('n', '<Space>bb', '<Cmd>BufferOrderByBufferNumber<CR>', barbar_opts)
map('n', '<Space>bd', '<Cmd>BufferOrderByDirectory<CR>', barbar_opts) -- map('n', '<Space>bd', '<Cmd>BufferOrderByDirectory<CR>', barbar_opts)
map('n', '<Space>bl', '<Cmd>BufferOrderByLanguage<CR>', barbar_opts) -- map('n', '<Space>bl', '<Cmd>BufferOrderByLanguage<CR>', barbar_opts)
map('n', '<Space>bw', '<Cmd>BufferOrderByWindowNumber<CR>', barbar_opts) -- map('n', '<Space>bw', '<Cmd>BufferOrderByWindowNumber<CR>', barbar_opts)
--
-- Other: -- -- Other:
-- :BarbarEnable - enables barbar (enabled by default) -- -- :BarbarEnable - enables barbar (enabled by default)
-- :BarbarDisable - very bad command, should never be used -- -- :BarbarDisable - very bad command, should never be used
-- Disable arrow keys -- Disable arrow keys
local arrows = {'<Up>', '<Down>', '<Left>', '<Right>'} local arrows = { '<Up>', '<Down>', '<Left>', '<Right>' }
for i=1,#arrows do for i = 1, #arrows do
map('n', arrows[i], function () end) map('n', arrows[i], function() end)
map('i', arrows[i], function () end) map('i', arrows[i], function() end)
end end
-- Code actions with ctrl + . -- Code actions with ctrl + .
map('n', '<Leader>.', function() vim.lsp.buf.code_action({ apply = true}) end, { desc = 'Code action/Quick fix' }) map('n', '<Leader>.', function() vim.lsp.buf.code_action({ apply = true }) end, { desc = 'Code action/Quick fix' })
-- Show telescope commands fuzzy finder -- Show telescope commands fuzzy finder
map('n', '<Leader><Leader>', function() require('telescope.builtin').commands() end, { desc = 'Show commands' }) map('n', '<Leader><Leader>', function() require('telescope.builtin').commands() end, { desc = 'Show commands' })
-- Show diagnostics in floating window
map('n', '<Leader>e', function() vim.diagnostic.open_float() end, { desc = 'Show diagnostics' })

View file

@ -2,7 +2,7 @@
require("nvim-tree").setup() require("nvim-tree").setup()
-- tree-sitter config -- tree-sitter config
require'nvim-treesitter.configs'.setup { require 'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all" -- A list of parser names, or "all"
ensure_installed = { "c", "lua", "rust", "bash", "python", "javascript" }, ensure_installed = { "c", "lua", "rust", "bash", "python", "javascript" },
@ -34,7 +34,7 @@ require("luasnip").config.set_config({ -- Setting LuaSnip config
store_selection_keys = "<Tab>", store_selection_keys = "<Tab>",
}) })
require("luasnip.loaders.from_lua").load({paths = "~/.config/nvim/LuaSnip/"}) require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/LuaSnip/" })
-- Which-key config -- Which-key config
@ -90,3 +90,40 @@ require('which-key').register({
-- indent-blankline setup -- indent-blankline setup
require('ibl').setup() require('ibl').setup()
-- Marks setup
require('marks').setup({
-- whether to map keybinds or not. default true
default_mappings = true,
-- which builtin marks to show. default {}
-- builtin_marks = { ".", "<", ">", "^" },
-- whether movements cycle back to the beginning/end of buffer. default true
cyclic = true,
-- whether the shada file is updated after modifying uppercase marks. default false
force_write_shada = false,
-- how often (in ms) to redraw signs/recompute mark positions.
-- higher values will have better performance but may cause visual lag,
-- while lower values may cause performance penalties. default 150.
refresh_interval = 250,
-- sign priorities for each type of mark - builtin marks, uppercase marks, lowercase
-- marks, and bookmarks.
-- can be either a table with all/none of the keys, or a single number, in which case
-- the priority applies to all marks.
-- default 10.
sign_priority = { lower = 10, upper = 15, builtin = 8, bookmark = 20 },
-- disables mark tracking for specific filetypes. default {}
excluded_filetypes = {},
-- disables mark tracking for specific buftypes. default {}
excluded_buftypes = {},
-- marks.nvim allows you to configure up to 10 bookmark groups, each with its own
-- sign/virttext. Bookmarks can be used to group together positions and quickly move
-- across multiple buffers. default sign is '!@#$%^&*()' (from 0 to 9), and
-- default virt_text is "".
-- bookmark_0 = {
-- sign = "⚑",
-- virt_text = "bookmark_0",
-- -- explicitly prompt for a virtual line annotation when setting a bookmark from this group.
-- -- defaults to false.
-- annotate = false,
-- },
mappings = {}
})

View file

@ -144,10 +144,10 @@ require("packer").startup(function()
use { "jay-babu/mason-nvim-dap.nvim" } use { "jay-babu/mason-nvim-dap.nvim" }
-- Tab -- Tab
use { -- use {
'romgrk/barbar.nvim', -- 'romgrk/barbar.nvim',
requires = { 'kyazdani42/nvim-web-devicons' }, -- requires = { 'kyazdani42/nvim-web-devicons' },
} -- }
use { use {
"nvim-neorg/neorg", "nvim-neorg/neorg",
@ -177,6 +177,9 @@ require("packer").startup(function()
end end
}) })
-- Marks
use("chentoast/marks.nvim")
-- Automatically set up configuration after cloning packer.nvim -- Automatically set up configuration after cloning packer.nvim
if packer_bootstrap then if packer_bootstrap then