1
0

Removing Which-key, adding a bunch of small improvments

Highlight on yank
gitsigns
oil as default explorer
This commit is contained in:
Nigel Barink 2024-10-06 17:04:11 +02:00
parent bd1e208133
commit a6c0657d70
Signed by: Nigel
GPG Key ID: 6893A31C2D84A9D2
9 changed files with 289 additions and 244 deletions

View File

@ -9,6 +9,7 @@
"conform.nvim": { "branch": "master", "commit": "1a99fdc1d3aa9ccdf3021e67982a679a8c5c740c" }, "conform.nvim": { "branch": "master", "commit": "1a99fdc1d3aa9ccdf3021e67982a679a8c5c740c" },
"edgy.nvim": { "branch": "main", "commit": "7e8dedc39abebe40c289b8012cc89b11c69aa7a0" }, "edgy.nvim": { "branch": "main", "commit": "7e8dedc39abebe40c289b8012cc89b11c69aa7a0" },
"fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" }, "fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" },
"friendly-snippets": { "branch": "main", "commit": "00ba9dd3df89509f95437b8d595553707c46d5ea" },
"git-worktree.nvim": { "branch": "master", "commit": "f247308e68dab9f1133759b05d944569ad054546" }, "git-worktree.nvim": { "branch": "master", "commit": "f247308e68dab9f1133759b05d944569ad054546" },
"gitsigns.nvim": { "branch": "main", "commit": "863903631e676b33e8be2acb17512fdc1b80b4fb" }, "gitsigns.nvim": { "branch": "main", "commit": "863903631e676b33e8be2acb17512fdc1b80b4fb" },
"harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" }, "harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" },

View File

@ -12,4 +12,13 @@ if not vim.loop.fs_stat(lazypath) then
end end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
require("barink.keys") require("barink.keys")
require("lazy").setup("barink.plugins") require("lazy").setup("barink.plugins" , {
root = vim.fn.stdpath("data") .. "/lazy", -- directory where plugins will be installed
-- leave nil when passing the spec as the first argument to setup()
change_detection = {
-- automatically check for config file changes and reload the ui
enabled = false,
notify = true, -- get a notification when changes are found
},
})

View File

@ -20,6 +20,11 @@ vim.keymap.set('n', '<A-S-k>', ':m .-2<CR>==', {noremap = true})
vim.keymap.set('i', '<A-j>', ':m .+1<CR>==gi', { noremap = true }) vim.keymap.set('i', '<A-j>', ':m .+1<CR>==gi', { noremap = true })
vim.keymap.set('i', '<A-k>', ':m .-2<CR>==gi', { noremap = true }) vim.keymap.set('i', '<A-k>', ':m .-2<CR>==gi', { noremap = true })
-- Simplified split navigation
vim.keymap.set('n', '<C-h>', '<C-w><C-h>')
vim.keymap.set('n', '<C-j>', '<C-w><C-j>')
vim.keymap.set('n', '<C-k>', '<C-w><C-k>')
vim.keymap.set('n', '<C-l>', '<C-w><C-l>')
-- Diagnostics ! -- Diagnostics !
vim.keymap.set('n', '<C-T>', function() require('trouble').toggle('diagnostics') end) vim.keymap.set('n', '<C-T>', function() require('trouble').toggle('diagnostics') end)
vim.keymap.set('n', '<leader>d', function() vim.diagnostic.open_float() end) vim.keymap.set('n', '<leader>d', function() vim.diagnostic.open_float() end)
@ -28,7 +33,10 @@ vim.keymap.set('n', '<leader>dp', function () vim.diagnostic.goto_prev() end )
vim.keymap.set('n', '<leader>ca', function() vim.lsp.buf.code_action() end) vim.keymap.set('n', '<leader>ca', function() vim.lsp.buf.code_action() end)
-- Debugging -- Debugging
vim.keymap.set('n', '<leader>b', function() require('dap').toggle_breakpoint() end) vim.keymap.set('n', '<leader>b', function() require('dap').toggle_breakpoint() end)
vim.keymap.set('n', '<F5>', function () print("Start debug session" ) require('dap').continue() end ) vim.keymap.set('n', '<F5>', function()
print("Start debug session")
require('dap').continue()
end)
vim.keymap.set('n', '<F6>', function() require('dap').step_over() end) vim.keymap.set('n', '<F6>', function() require('dap').step_over() end)
vim.keymap.set('n', '<F7>', function() require('dap').step_into() end) vim.keymap.set('n', '<F7>', function() require('dap').step_into() end)
@ -45,3 +53,22 @@ vim.keymap.set("n", ",st", function()
vim.wo.winfixheight = true vim.wo.winfixheight = true
vim.cmd.term() vim.cmd.term()
end) end)
-- Open quickfix list
vim.keymap.set("n", "<M-k>", "<cmd>cnext<CR>zz")
vim.keymap.set("n", "<M-j>", "<cmd>cprev<CR>zz")
-- Go to next in location list
vim.keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz")
vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz")
-- Highlight on yank
vim.api.nvim_create_autocmd("TextYankPost", {
desc = "Highlight when yanking text ",
group = vim.api.nvim_create_augroup('barink', { clear = true }),
callback = function()
vim.highlight.on_yank()
end
})

View File

@ -2,7 +2,7 @@ return {
{ {
"stevearc/oil.nvim", "stevearc/oil.nvim",
opt = { opt = {
default_file_explorer = false default_file_explorer = true
}, },
dependencies = { dependencies = {
'nvim-tree/nvim-web-devicons' 'nvim-tree/nvim-web-devicons'

View File

@ -1,8 +1,8 @@
return { return {
{
"j-hui/fidget.nvim", "j-hui/fidget.nvim",
opt = { config = function()
local opts = {
} }
require("fidget").setup(opts)
end
} }
}

View File

@ -1,4 +1,29 @@
return { return {
'lewis6991/gitsigns.nvim', 'lewis6991/gitsigns.nvim',
opt = {} config = function()
local opts = {
signs = {
add = { text = '+' },
change = { text = "~" },
delete = { text = "_" },
topdelete = { text = "-" },
changedelete = { text = "~" }
},
signs_staged = {
add = { text = '+' },
change = { text = "~" },
delete = { text = "_" },
topdelete = { text = "-" },
changedelete = { text = "~" },
untracked = { text = "*" },
},
signs_staged_enable = true,
signcolumn = true,
watch_gitdir = {
follow_files = true
},
auto_attach = true
}
require("gitsigns").setup(opts)
end,
} }

View File

@ -15,7 +15,10 @@ return
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",
{ {
'L3MON4D3/LuaSnip', 'L3MON4D3/LuaSnip',
dependencies = 'hrsh7th/nvim-cmp', dependencies = {
'hrsh7th/nvim-cmp',
'rafamadriz/friendly-snippets',
},
version = "v2.*", version = "v2.*",
}, },
{ 'mfussenegger/nvim-jdtls', dependencies = { 'nvim-dap' } }, { 'mfussenegger/nvim-jdtls', dependencies = { 'nvim-dap' } },
@ -55,12 +58,12 @@ return
['<C-f>'] = cmp.mapping.scroll_docs(4), ['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(), ['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(), ['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. ['<C-y>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}), }),
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = 'nvim_lsp', keyword_length = 1 }, { name = 'nvim_lsp', keyword_length = 1 },
{ name = 'luasnip' },
{ name = 'path' }, { name = 'path' },
}, {
{ name = 'buffer', keyword_length = 2 }, { name = 'buffer', keyword_length = 2 },
}), }),
window = { window = {
@ -108,8 +111,7 @@ return
end, { silent = true }) end, { silent = true })
require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/lua/barink/snippets" }) require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/lua/barink/snippets" })
require("luasnip.loaders.from_vscode").lazy_load()
-- Set up lspconfig. -- Set up lspconfig.
local capabilities = require("cmp_nvim_lsp").default_capabilities() local capabilities = require("cmp_nvim_lsp").default_capabilities()
local lsp = require("lspconfig") local lsp = require("lspconfig")
@ -120,7 +122,7 @@ return
zls = true, zls = true,
emmet_language_server = true, emmet_language_server = true,
rust_analyzer = true, rust_analyzer = true,
gdtoolkit = { flags = { debounce_text_changes = 150 }}, --gdtoolkit = { flags = { debounce_text_changes = 150 }},
jdtls = true, jdtls = true,
pylsp = true, pylsp = true,
phpactor = { phpactor = {
@ -156,9 +158,9 @@ return
vim.env.VIMRUNTIME vim.env.VIMRUNTIME
} }
}, },
-- diagnostics = { diagnostics = {
-- globals = { 'vim'} globals = { 'vim' }
-- } }
} }
} }
} }
@ -193,8 +195,6 @@ return
vim.keymap.set("n", "<LEADER>cr", vim.lsp.buf.rename, { buffer = -1 }) vim.keymap.set("n", "<LEADER>cr", vim.lsp.buf.rename, { buffer = -1 })
vim.keymap.set("n", "<LEADER>ca", vim.lsp.buf.code_action, { buffer = -1 }) vim.keymap.set("n", "<LEADER>ca", vim.lsp.buf.code_action, { buffer = -1 })
vim.keymap.set("n", "<LEADER>wd", builtin.lsp_document_symbols, { buffer = -1 }) vim.keymap.set("n", "<LEADER>wd", builtin.lsp_document_symbols, { buffer = -1 })
end end
}) })
end, end,

View File

@ -1,15 +0,0 @@
return {
"folke/which-key.nvim",
event = "VeryLazy",
opts = {
},
keys = {
{
"<leader>?",
function()
require("which-key").show({global = false})
end,
desc = "Buffer Local Keymaps (which-key)",
}
}
}

View File

@ -21,9 +21,6 @@ vim.opt.termguicolors = true
vim.opt.scrolloff = 8 vim.opt.scrolloff = 8
vim.g.netrw_browse_split = 0
vim.g.netrw_winsize = 25
vim.opt.completeopt = { 'menu', 'menuone', 'noselect' } vim.opt.completeopt = { 'menu', 'menuone', 'noselect' }
vim.opt.inccommand = 'split' vim.opt.inccommand = 'split'
vim.api.nvim_create_autocmd('LspAttach', { vim.api.nvim_create_autocmd('LspAttach', {
@ -35,6 +32,10 @@ vim.api.nvim_create_autocmd('LspAttach', {
end, end,
}) })
vim.g.netrw_browse_split = 0
vim.g.netrw_winsize = 25
--[[ --[[
-- Run zig test on save -- Run zig test on save
-- TODO: fix vim.cmd call -- TODO: fix vim.cmd call
@ -44,6 +45,3 @@ vim.api.nvim_create_autocmd('BufWritePost' , {
vim.cmd{cmd = '!zig' , args= {'test', vim.fn.expand('%')} } vim.cmd{cmd = '!zig' , args= {'test', vim.fn.expand('%')} }
end end
})]] -- })]] --