Update neovim dotfiles

This commit is contained in:
hok7z 2023-01-04 14:28:57 +02:00
parent b6f66dea3c
commit d5899d0921
7 changed files with 66 additions and 33 deletions

View File

@ -8,12 +8,9 @@ vim.api.nvim_set_keymap('', '<right>', '<nop>',{noremap = true})
keymap("n","<space>,",":nohlsearch<CR>")
-- Telescope --
keymap("n","<leader>ff","<cmd> Telescope find_files <cr>")
keymap("n","<leader>fg","<cmd> Telescope live_grep <cr>")
keymap("n","<leader>fb","<cmd> Telescope buffers <cr>")
keymap("n","s",'"_d"')
-- NvimTree --
keymap("n","<C-n>",":NvimTreeToggle<CR>")
keymap("n","<leader>n",":NvimTreeFindFile<CR>")
keymap("n","<C-]>","gh defx#do_action('cd',getcwd())<CR>")
keymap('n', 'gwh', '<C-w>h')
keymap('n', 'gwj', '<C-w>j')
keymap('n', 'gwk', '<C-w>k')
keymap('n', 'gwl', '<C-w>l')

View File

@ -25,14 +25,19 @@ opt.swapfile = false
opt.number = true
opt.relativenumber = true
vim.g.mapleader = " "
opt.list = true
opt.listchars = {tab = '| '}
vim.g.lsp_path = os.getenv("HOME") .. "/.local/share/nvim/mason/bin/"
opt.splitbelow = true
opt.splitright = true
opt.undofile = true
opt.tabstop = 4
opt.shiftwidth = 4
opt.expandtab = true
opt.mouse = "a"
vim.g.mapleader = " "
vim.g.lsp_path = os.getenv("HOME") .. "/.local/share/nvim/mason/bin/"

View File

@ -99,18 +99,7 @@ packer.startup{
use {
"nvim-telescope/telescope.nvim",
requires = {"nvim-lua/plenary.nvim"},
config = function()
local actions = require('telescope.actions')
require('telescope').setup{
defaults = {
mappings = {
n = {
["q"] = actions.close
},
},
}
}
end
config = function() require("plugins.telescope") end
}
-- Language Server Protocol

View File

@ -52,7 +52,7 @@ vim.g.lsp_on_attach = function(client,bufnr)
buf_set_keymap('n','[d','<cmd>lua vim.diagnostic.goto_prev()<CR>',opts)
buf_set_keymap('n',']d','<cmd>lua vim.diagnostic.goto_next()<CR>',opts)
buf_set_keymap('n','<leader>d','<cmd>lua vim.diagnostic.open_float({border="rounded"})<CR>',opts)
buf_set_keymap('n','<space>f','<cmd>lua vim.lsp.buf.formatting()<CR>',opts)
-- buf_set_keymap('n','<space>f','<cmd>lua vim.lsp.buf.formatting()<CR>',opts)
end
local servers = mason_lsp.get_installed_servers()
@ -68,7 +68,7 @@ for _, server in ipairs(servers) do
end
else
vim.pretty_print({server = server, result = result})
vim.notify("Missing server configuration for " .. server, "error")
-- vim.notify("Missing server configuration for " .. server, "error")
end
end
end

View File

@ -33,7 +33,6 @@ cmp.setup {
fields = { "kind", "abbr", "menu" },
format = function(entry, vim_item)
local kind = require("lspkind").cmp_format({mode = "symbol_text", maxwidth = 50})(entry, vim_item)
local strings = vim.split(kind.kind, "%s",{trimempty = true})
kind.kind = " " .. strings[1] .. " "
kind.menu = " (" .. strings[2] .. ")"

View File

@ -4,6 +4,8 @@ if not ok then
return
end
local keymap = vim.keymap.set
nvim_tree.setup({
sort_by = "case_sensitive",
view = {
@ -13,11 +15,11 @@ nvim_tree.setup({
},
},
renderer = {
group_empty = true,
},
filters = {
dotfiles = true,
},
})
keymap("n","<C-n>",":NvimTreeToggle<CR>")
keymap("n","<leader>n",":NvimTreeFindFile<CR>")
keymap("n","<C-]>","gh defx#do_action('cd',getcwd())<CR>")

View File

@ -0,0 +1,41 @@
local ok, telescope = pcall(require, "telescope")
if not ok then
vim.notify("Failed to load telescope")
return
end
local actions = require'telescope.actions'
local builtin = require'telescope.builtin'
telescope.setup{
defaults = {
mappings = {
i = {
["<c-j>"] = actions.move_selection_next,
["<c-k>"] = actions.move_selection_previous,
},
n = {
["q"] = actions.close,
}
},
}
}
local keymap = vim.keymap.set
keymap("n","<leader>f",builtin.find_files)
keymap("n","<leader>l",builtin.live_grep)
keymap("n","<leader>L",builtin.grep_string)
keymap("n","<leader>;",builtin.current_buffer_fuzzy_find)
keymap("n","<leader>b",builtin.buffers)
keymap("n","<leader>e",function()
builtin.diagnostics{bufnr = 0,severity_limit = "WARN"}
end)
keymap("n","<leader>E",function()
builtin.diagnostics{severity_limit = "WARN"}
end)