mirror of
https://github.com/halfdan/dotfiles.git
synced 2025-09-10 19:56:24 +00:00
More updates and cleanup to nvim config
This commit is contained in:
@@ -105,15 +105,35 @@ nnoremap('<leader>a', ':A<CR>')
|
||||
-- Reload init.lua
|
||||
nnoremap('<leader>sv', ':source $MYVIMRC<CR>')
|
||||
|
||||
nnoremap('<C-p>', ':Lspsaga diagnostic_jump_prev<CR>')
|
||||
nnoremap('<C-y>', ':Lspsaga diagnostic_jump_next<CR>')
|
||||
local builtin = require("telescope.builtin")
|
||||
|
||||
-- Harpoon
|
||||
nnoremap("<leader>m", function() require("harpoon.mark").add_file() end)
|
||||
nnoremap("<C-e>", function() require("harpoon.ui").toggle_quick_menu() end)
|
||||
nnoremap("<leader>gg", function()
|
||||
-- builtin.live_grep()
|
||||
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)
|
||||
|
||||
|
@@ -6,10 +6,16 @@ local Remap = require("halfdan.keymap")
|
||||
local nnoremap = Remap.nnoremap
|
||||
local inoremap = Remap.inoremap
|
||||
|
||||
vim.fn.sign_define("DiagnosticSignError", {text = "", texthl = "DiagnosticSignError"})
|
||||
vim.fn.sign_define("DiagnosticSignWarn", {text = "", texthl = "DiagnosticSignWarn"})
|
||||
vim.fn.sign_define("DiagnosticSignInfo", {text = "", texthl = "DiagnosticSignInfo"})
|
||||
-- vim.fn.sign_define("DiagnosticSignHint", {text = "", texthl = "DiagnosticSignHint"})
|
||||
vim.diagnostic.config({
|
||||
signs = {
|
||||
text = {
|
||||
[vim.diagnostic.severity.ERROR] = "",
|
||||
[vim.diagnostic.severity.WARN] = "",
|
||||
[vim.diagnostic.severity.INFO] = "",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
-- Set Default Prefix.
|
||||
-- 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
|
||||
vim.api.nvim_set_keymap('n', '<leader>e', '<cmd>Lspsaga show_line_diagnostics<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<leader>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', { noremap = true, silent = true })
|
||||
-- Show Lspsaga line diagnostics
|
||||
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.
|
||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||
@@ -121,27 +132,6 @@ vim.api.nvim_create_autocmd('LspAttach', {
|
||||
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", {
|
||||
settings = {
|
||||
Lua = {
|
||||
@@ -192,4 +182,3 @@ vim.lsp.config('expert', {
|
||||
})
|
||||
|
||||
vim.lsp.enable 'expert'
|
||||
vim.lsp.enable 'gleam'
|
||||
|
@@ -4,6 +4,17 @@ end
|
||||
|
||||
local nnoremap = require('halfdan.keymap').nnoremap
|
||||
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({
|
||||
log_level = vim.log.levels.DEBUG,
|
||||
@@ -14,6 +25,7 @@ neotest.setup({
|
||||
}),
|
||||
require("neotest-rust"),
|
||||
-- require("neotest-vim-test")({ allow_file_types = { "haskell"} }),
|
||||
require("neotest-golang")
|
||||
},
|
||||
})
|
||||
|
||||
|
@@ -2,11 +2,11 @@ if vim.g.vscode then
|
||||
return
|
||||
end
|
||||
|
||||
vim.cmd([[
|
||||
let g:sneak#label = 1
|
||||
let g:sneak#prompt = '🔎'
|
||||
let g:sneak#s_next = 1
|
||||
|
||||
let test#strategy = "neovim"
|
||||
let test#neovim#term_position = "vert rightbelow 80"
|
||||
]])
|
||||
-- Sneak
|
||||
vim.g["sneak#label"] = 1
|
||||
vim.g["sneak#prompt"] = "🔎"
|
||||
vim.g["sneak#s_next"] = 1
|
||||
|
||||
-- Vim-Test
|
||||
vim.g["test#strategy"] = "neovim"
|
||||
vim.g["test#neovim#term_position"] = "vert rightbelow 80"
|
||||
|
@@ -1 +0,0 @@
|
||||
vim.g.tagbar_ctags_bin = '/usr/local/bin/ctags'
|
@@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user