More updates and cleanup to nvim config

This commit is contained in:
Fabian Becker
2025-09-10 11:16:00 +02:00
parent c30a121b99
commit b8c42f92c7
12 changed files with 95 additions and 116 deletions

View File

@@ -105,15 +105,35 @@ nnoremap('<leader>a', ':A<CR>')
-- Reload init.lua -- Reload init.lua
nnoremap('<leader>sv', ':source $MYVIMRC<CR>') nnoremap('<leader>sv', ':source $MYVIMRC<CR>')
nnoremap('<C-p>', ':Lspsaga diagnostic_jump_prev<CR>') local builtin = require("telescope.builtin")
nnoremap('<C-y>', ':Lspsaga diagnostic_jump_next<CR>')
-- Harpoon nnoremap("<leader>gg", function()
nnoremap("<leader>m", function() require("harpoon.mark").add_file() end) -- builtin.live_grep()
nnoremap("<C-e>", function() require("harpoon.ui").toggle_quick_menu() end) require "telescope".extensions.egrepify.egrepify { sorting_strategy = 'ascending' }
end)
nnoremap("<C-p>", function()
builtin.find_files()
end)
nnoremap("<Leader>ff", function()
require('telescope').extensions.smart_open.smart_open({cwd_only = true})
end)
nnoremap("<Leader>fh", function()
builtin.find_files{cwd=vim.fn.expand('%:p:h')}
end)
nnoremap("<leader>gw", function()
builtin.grep_string { search = vim.fn.expand("<cword>") }
end)
nnoremap("<leader>fb", function()
builtin.buffers()
end)
nnoremap("<leader>gc", function()
builtin.git_branches()
end)
nnoremap("<C-h>", function() require("harpoon.ui").nav_file(1) end)
nnoremap("<C-t>", function() require("harpoon.ui").nav_file(2) end)
nnoremap("<C-n>", function() require("harpoon.ui").nav_file(3) end)
nnoremap("<C-s>", function() require("harpoon.ui").nav_file(4) end)

View File

@@ -6,10 +6,16 @@ local Remap = require("halfdan.keymap")
local nnoremap = Remap.nnoremap local nnoremap = Remap.nnoremap
local inoremap = Remap.inoremap local inoremap = Remap.inoremap
vim.fn.sign_define("DiagnosticSignError", {text = "", texthl = "DiagnosticSignError"}) vim.diagnostic.config({
vim.fn.sign_define("DiagnosticSignWarn", {text = "", texthl = "DiagnosticSignWarn"}) signs = {
vim.fn.sign_define("DiagnosticSignInfo", {text = "", texthl = "DiagnosticSignInfo"}) text = {
-- vim.fn.sign_define("DiagnosticSignHint", {text = "", texthl = "DiagnosticSignHint"}) [vim.diagnostic.severity.ERROR] = "",
[vim.diagnostic.severity.WARN] = "",
[vim.diagnostic.severity.INFO] = "",
},
},
})
-- Set Default Prefix. -- Set Default Prefix.
-- Note: You can set a prefix per lsp server in the lv-globals.lua file -- Note: You can set a prefix per lsp server in the lv-globals.lua file
@@ -80,8 +86,13 @@ vim.lsp.protocol.CompletionItemKind = {
-- Diagnostic keymaps -- Diagnostic keymaps
vim.api.nvim_set_keymap('n', '<leader>e', '<cmd>Lspsaga show_line_diagnostics<CR>', { noremap = true, silent = true }) -- Show Lspsaga line diagnostics
vim.api.nvim_set_keymap('n', '<leader>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', { noremap = true, silent = true }) vim.keymap.set('n', '<leader>e', '<cmd>Lspsaga show_line_diagnostics<CR>', { noremap = true, silent = true })
-- Send diagnostics to location list
vim.keymap.set('n', '<leader>q', function()
vim.diagnostic.setloclist()
end, { noremap = true, silent = true })
-- Global mappings. -- Global mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions -- See `:help vim.diagnostic.*` for documentation on any of the below functions
@@ -121,27 +132,6 @@ vim.api.nvim_create_autocmd('LspAttach', {
end, end,
}) })
local on_attach = function(client, bufnr)
nnoremap("gd", "<cmd>Lspsaga peek_definition<CR>")
nnoremap("<leader>gd", function ()
vim.lsp.buf.definition()
end)
nnoremap("gD", function() vim.lsp.buf.declaration() end)
nnoremap("K", "<cmd>Lspsaga hover_doc<CR>")
nnoremap("gW", function() vim.lsp.buf.workspace_symbol() end)
nnoremap("<leader>vd", function() vim.diagnostic.open_float() end)
nnoremap("[d", "<cmd>Lspsaga diagnostic_jump_next<CR>")
nnoremap("]d", "<cmd>Lspsaga diagnostic_jump_prev<CR>")
nnoremap("<leader>ca", "<cmd>Lspsaga code_action<CR>")
nnoremap("gr", function() vim.lsp.buf.references() end)
nnoremap("<leader>rn", "<cmd>Lspsaga rename<CR>")
nnoremap("<leader>cl", function() vim.lsp.codelens.run() end)
nnoremap("<leader>fa", function() vim.lsp.buf.format{async = true} end)
inoremap("<C-h>", function() vim.lsp.buf.signature_help() end)
lsp_status.on_attach(client, bufnr)
end
vim.lsp.config("lua_ls", { vim.lsp.config("lua_ls", {
settings = { settings = {
Lua = { Lua = {
@@ -192,4 +182,3 @@ vim.lsp.config('expert', {
}) })
vim.lsp.enable 'expert' vim.lsp.enable 'expert'
vim.lsp.enable 'gleam'

View File

@@ -4,6 +4,17 @@ end
local nnoremap = require('halfdan.keymap').nnoremap local nnoremap = require('halfdan.keymap').nnoremap
local neotest = require('neotest') local neotest = require('neotest')
local neotest_ns = vim.api.nvim_create_namespace("neotest")
vim.diagnostic.config({
virtual_text = {
format = function(diagnostic)
local message =
diagnostic.message:gsub("\n", " "):gsub("\t", " "):gsub("%s+", " "):gsub("^%s+", "")
return message
end,
},
}, neotest_ns)
neotest.setup({ neotest.setup({
log_level = vim.log.levels.DEBUG, log_level = vim.log.levels.DEBUG,
@@ -14,6 +25,7 @@ neotest.setup({
}), }),
require("neotest-rust"), require("neotest-rust"),
-- require("neotest-vim-test")({ allow_file_types = { "haskell"} }), -- require("neotest-vim-test")({ allow_file_types = { "haskell"} }),
require("neotest-golang")
}, },
}) })

View File

@@ -2,11 +2,11 @@ if vim.g.vscode then
return return
end end
vim.cmd([[ -- Sneak
let g:sneak#label = 1 vim.g["sneak#label"] = 1
let g:sneak#prompt = '🔎' vim.g["sneak#prompt"] = "🔎"
let g:sneak#s_next = 1 vim.g["sneak#s_next"] = 1
let test#strategy = "neovim" -- Vim-Test
let test#neovim#term_position = "vert rightbelow 80" vim.g["test#strategy"] = "neovim"
]]) vim.g["test#neovim#term_position"] = "vert rightbelow 80"

View File

@@ -1 +0,0 @@
vim.g.tagbar_ctags_bin = '/usr/local/bin/ctags'

View File

@@ -1,44 +0,0 @@
if vim.g.vscode then
return
end
local Remap = require("halfdan.keymap")
local nnoremap = Remap.nnoremap
local builtin = require("telescope.builtin")
nnoremap("<leader>gg", function()
-- builtin.live_grep()
require "telescope".extensions.egrepify.egrepify { sorting_strategy = 'ascending' }
end)
nnoremap("<C-p>", function()
builtin.commands()
end)
nnoremap("<Leader>ff", function()
require('telescope').extensions.smart_open.smart_open({cwd_only = true})
-- builtin.find_files({
-- hidden=true,
-- })
end)
nnoremap("<Leader>fh", function()
builtin.find_files{cwd=vim.fn.expand('%:p:h')}
end)
nnoremap("<Leader>fs", function()
builtin.lsp_workspace_symbols()
end)
nnoremap("<leader>gw", function()
builtin.grep_string { search = vim.fn.expand("<cword>") }
end)
nnoremap("<leader>fb", function()
builtin.buffers()
end)
nnoremap("<leader>vh", function()
builtin.help_tags()
end)
nnoremap("<leader>gc", function()
builtin.git_branches()
end)

View File

@@ -11,10 +11,10 @@
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
"editorconfig-vim": { "branch": "master", "commit": "6a58b7c11f79c0e1d0f20533b3f42f2a11490cf8" }, "editorconfig-vim": { "branch": "master", "commit": "6a58b7c11f79c0e1d0f20533b3f42f2a11490cf8" },
"fzf-lua": { "branch": "main", "commit": "f6a570cc42596efb73359fc453061e24abb71d9f" }, "fzf-lua": { "branch": "main", "commit": "c2d9b8693792c6dd810162d9e8c90782cec19404" },
"git-blame.nvim": { "branch": "master", "commit": "8503b199edf9a666fe7b1a989cf14e3c26b2eb03" }, "git-blame.nvim": { "branch": "master", "commit": "9874ec1ec8bc53beb33b7cd82c092b85271a578b" },
"gruvbox-baby": { "branch": "main", "commit": "bd52e62d8134647090108189e69c8b3cd18bdbbf" }, "gruvbox-baby": { "branch": "main", "commit": "bd52e62d8134647090108189e69c8b3cd18bdbbf" },
"harpoon": { "branch": "master", "commit": "1bc17e3e42ea3c46b33c0bbad6a880792692a1b3" }, "hardtime.nvim": { "branch": "main", "commit": "6d7664d5bdfaea44c5f50b29f5239fab7b00c273" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"lsp-status.nvim": { "branch": "master", "commit": "54f48eb5017632d81d0fd40112065f1d062d0629" }, "lsp-status.nvim": { "branch": "master", "commit": "54f48eb5017632d81d0fd40112065f1d062d0629" },
"lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" }, "lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
@@ -22,25 +22,26 @@
"lua-utils.nvim": { "branch": "main", "commit": "e565749421f4bbb5d2e85e37c3cef9d56553d8bd" }, "lua-utils.nvim": { "branch": "main", "commit": "e565749421f4bbb5d2e85e37c3cef9d56553d8bd" },
"lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" }, "lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "f1deac7ecec88c28a250d890ba7bb35843e69cbd" }, "neo-tree.nvim": { "branch": "v3.x", "commit": "f1deac7ecec88c28a250d890ba7bb35843e69cbd" },
"neogit": { "branch": "master", "commit": "4046f747739cf7e7b9aada447f3edc59c947b111" }, "neogit": { "branch": "master", "commit": "6617978288d58eb121754b5dd890e893d9a7e8d6" },
"neorg": { "branch": "main", "commit": "e206c9642f4a115cd836e76c98ef785623d335bc" }, "neorg": { "branch": "main", "commit": "e206c9642f4a115cd836e76c98ef785623d335bc" },
"neorg-telescope": { "branch": "main", "commit": "7fb6ca6a632c3c095601d379a664c0c1f802dc6c" }, "neorg-telescope": { "branch": "main", "commit": "7fb6ca6a632c3c095601d379a664c0c1f802dc6c" },
"neotest": { "branch": "master", "commit": "35a59c1f59dbb954d92b74ab64a966a668cea495" }, "neoscroll.nvim": { "branch": "master", "commit": "f957373912e88579e26fdaea4735450ff2ef5c9c" },
"neotest": { "branch": "master", "commit": "2cf3544fb55cdd428a9a1b7154aea9c9823426e8" },
"neotest-elixir": { "branch": "master", "commit": "a242aebeaa6997c1c149138ff77f6cacbe33b6fc" }, "neotest-elixir": { "branch": "master", "commit": "a242aebeaa6997c1c149138ff77f6cacbe33b6fc" },
"neotest-go": { "branch": "main", "commit": "92950ad7be2ca02a41abca5c6600ff6ffaf5b5d6" }, "neotest-golang": { "branch": "main", "commit": "0ada81e50429a071cc7d349301762e4ee04dcb2a" },
"neotest-rust": { "branch": "main", "commit": "2c9941d4a358839918fac21d20fc8fef0e1ad05f" }, "neotest-rust": { "branch": "main", "commit": "2c9941d4a358839918fac21d20fc8fef0e1ad05f" },
"neotest-vim-test": { "branch": "master", "commit": "75c4228882ae4883b11bfce9b8383e637eb44192" }, "neotest-vim-test": { "branch": "master", "commit": "75c4228882ae4883b11bfce9b8383e637eb44192" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
"nvim-dap": { "branch": "master", "commit": "7891b01beedc37cef4eaf2e92563bd0a5b6e9c58" }, "nvim-dap": { "branch": "master", "commit": "7523676a4be17644587aa47e4d42f6f7646d4727" },
"nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" }, "nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" },
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
"nvim-notify": { "branch": "master", "commit": "397c7c1184745fca649e5104de659e6392ef5a4d" }, "nvim-notify": { "branch": "master", "commit": "8701bece920b38ea289b457f902e2ad184131a5d" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "71385f191ec06ffc60e80e6b0c9a9d5daed4824c" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "71385f191ec06ffc60e80e6b0c9a9d5daed4824c" },
"nvim-web-devicons": { "branch": "master", "commit": "6e51ca170563330e063720449c21f43e27ca0bc1" }, "nvim-web-devicons": { "branch": "master", "commit": "6e51ca170563330e063720449c21f43e27ca0bc1" },
"outline.nvim": { "branch": "main", "commit": "0eb9289ab39c91caf8b3ed0e3a17764809d69558" }, "outline.nvim": { "branch": "main", "commit": "6b62f73a6bf317531d15a7ae1b724e85485d8148" },
"pathlib.nvim": { "branch": "main", "commit": "57e5598af6fe253761c1b48e0b59b7cd6699e2c1" }, "pathlib.nvim": { "branch": "main", "commit": "57e5598af6fe253761c1b48e0b59b7cd6699e2c1" },
"playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" }, "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
@@ -50,7 +51,6 @@
"rustaceanvim": { "branch": "master", "commit": "12504405821c05874d2d1f6b5ec919f9808e2c99" }, "rustaceanvim": { "branch": "master", "commit": "12504405821c05874d2d1f6b5ec919f9808e2c99" },
"smart-open.nvim": { "branch": "0.2.x", "commit": "560d8f16e17977c8303db6f9660db58a4415ca41" }, "smart-open.nvim": { "branch": "0.2.x", "commit": "560d8f16e17977c8303db6f9660db58a4415ca41" },
"sqlite.lua": { "branch": "master", "commit": "50092d60feb242602d7578398c6eb53b4a8ffe7b" }, "sqlite.lua": { "branch": "master", "commit": "50092d60feb242602d7578398c6eb53b4a8ffe7b" },
"tagbar": { "branch": "master", "commit": "2ef4ecba94440fcf8a8c692a0f2b36b332f1f0f2" },
"telescope-dap.nvim": { "branch": "master", "commit": "783366bd6c1e7fa0a5c59c07db37f49c805a28df" }, "telescope-dap.nvim": { "branch": "master", "commit": "783366bd6c1e7fa0a5c59c07db37f49c805a28df" },
"telescope-egrepify.nvim": { "branch": "master", "commit": "8da5e3ba5faf3bdd6bbfaccb3eb3b8e7ebf9b131" }, "telescope-egrepify.nvim": { "branch": "master", "commit": "8da5e3ba5faf3bdd6bbfaccb3eb3b8e7ebf9b131" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
@@ -64,5 +64,5 @@
"vim-projectionist": { "branch": "master", "commit": "5ff7bf79a6ef741036d2038a226bcb5f8b1cd296" }, "vim-projectionist": { "branch": "master", "commit": "5ff7bf79a6ef741036d2038a226bcb5f8b1cd296" },
"vim-sneak": { "branch": "master", "commit": "18b1faf020e6a66c1ce09b3ff5e6b6feb182973b" }, "vim-sneak": { "branch": "master", "commit": "18b1faf020e6a66c1ce09b3ff5e6b6feb182973b" },
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }, "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
"vim-test": { "branch": "master", "commit": "8c76f6c0953edaa13a37c29ac9c6a7bb56ddce89" } "vim-test": { "branch": "master", "commit": "5ee3c0b3734eab612b9f70bbc8a4f69f17f8e8ef" }
} }

View File

@@ -73,7 +73,7 @@ cmp.setup({
}, },
experimental = { experimental = {
ghost_text = false, ghost_text = true,
}, },
}) })

View File

@@ -1,5 +1,2 @@
vim.cmd('let g:nvcode_termcolors=256') vim.g.nvcode_termcolors = 256
vim.cmd.colorscheme("gruvbox-baby")
vim.cmd('colorscheme rose-pine')
-- vim.cmd('highlight Normal guibg=NONE ctermbg=NONE')

View File

@@ -31,6 +31,16 @@ require("lazy").setup({
-- Load .editorconfig files -- Load .editorconfig files
{'editorconfig/editorconfig-vim'}, {'editorconfig/editorconfig-vim'},
{
"m4xshen/hardtime.nvim",
lazy = false,
dependencies = { "MunifTanjim/nui.nvim" },
opts = {},
},
{
"karb94/neoscroll.nvim",
opts = {},
},
{'junegunn/vim-easy-align'}, {'junegunn/vim-easy-align'},
-- Goodies -- Goodies
@@ -56,7 +66,7 @@ require("lazy").setup({
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
"antoinemadec/FixCursorHold.nvim", "antoinemadec/FixCursorHold.nvim",
-- plugins -- plugins
"nvim-neotest/neotest-go", "fredrikaverpil/neotest-golang",
"jfpedroza/neotest-elixir", "jfpedroza/neotest-elixir",
"rouge8/neotest-rust", "rouge8/neotest-rust",
} }
@@ -83,8 +93,6 @@ require("lazy").setup({
}) })
end}, end},
{'preservim/tagbar'},
{'f-person/git-blame.nvim'}, {'f-person/git-blame.nvim'},
-- Status Line and Bufferline -- Status Line and Bufferline
{ {
@@ -155,8 +163,8 @@ require("lazy").setup({
symbol_in_winbar = { symbol_in_winbar = {
enable = false, enable = false,
}, },
code_action = { lightbulb = {
lightbulb = { enable = false } enable = false,
} }
}) })
end, end,
@@ -217,7 +225,6 @@ require("lazy").setup({
}, },
{'numToStr/FTerm.nvim'}, {'numToStr/FTerm.nvim'},
{'theprimeagen/harpoon'},
-- Debugging -- Debugging
"mfussenegger/nvim-dap", "mfussenegger/nvim-dap",

View File

@@ -28,7 +28,7 @@ local function setup()
sections = { sections = {
lualine_a = { cpn.branch }, lualine_a = { cpn.branch },
lualine_b = { cpn.diagnostics }, lualine_b = { cpn.diagnostics },
lualine_c = {}, lualine_c = { "lsp_status" },
lualine_x = { { git_blame.get_current_blame_text, cond = git_blame.is_blame_text_available }, cpn.diff }, lualine_x = { { git_blame.get_current_blame_text, cond = git_blame.is_blame_text_available }, cpn.diff },
lualine_y = { cpn.position, cpn.filetype }, lualine_y = { cpn.position, cpn.filetype },
lualine_z = { cpn.spaces, cpn.mode }, lualine_z = { cpn.spaces, cpn.mode },

View File

@@ -7,8 +7,7 @@ vim.o.titlestring="%<%F%=%l/%L - nvim"
vim.wo.wrap = false -- Display long lines as just one line vim.wo.wrap = false -- Display long lines as just one line
-- vim.cmd('set whichwrap+=<,>,[,],h,l') -- move to next line with theses keys -- vim.cmd('set whichwrap+=<,>,[,],h,l') -- move to next line with theses keys
-- vim.cmd('syntax on') -- syntax highlighting -- vim.cmd('syntax on') -- syntax highlighting
vim.o.foldmethod = "expr" vim.o.foldmethod = "manual"
vim.o.foldexpr = "nvim_treesitter#foldexpr()"
vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]] vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
local fcs = vim.opt.fillchars:get() local fcs = vim.opt.fillchars:get()