1
0

Moved snippets folder, Added Oil and conform to windows config, improved lsp and telescope config

This commit is contained in:
Nigel Barink 2024-09-26 16:05:29 +02:00
parent 71f08e66aa
commit 0411f4b928
Signed by: Nigel
GPG Key ID: 6893A31C2D84A9D2
8 changed files with 87 additions and 12 deletions

View File

@ -5,6 +5,7 @@
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"conform.nvim": { "branch": "master", "commit": "797de8f79055334104cf77893cd93fe3fc2ac154" },
"edgy.nvim": { "branch": "main", "commit": "0e8bbab4eba9dab6c237e4a2e146dc0466897be6" },
"fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" },
"gitsigns.nvim": { "branch": "main", "commit": "356df59308d8b87486644d2324d7558ac0f3db36" },
@ -25,6 +26,7 @@
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
"nvim-treesitter": { "branch": "master", "commit": "733fa85db27079ec2757183c5c840ba15a303e1f" },
"nvim-web-devicons": { "branch": "master", "commit": "e612de3d3a41a6b7be47f51e956dddabcbf419d9" },
"oil.nvim": { "branch": "master", "commit": "9e5eb2fcd1dfee2ff30c89273ffff179e42034b9" },
"playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
"plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" },

View File

@ -0,0 +1,14 @@
return {
{
"stevearc/oil.nvim",
opt = {
default_file_explorer = false
},
dependencies = {
'nvim-tree/nvim-web-devicons'
},
config = function ()
vim.keymap.set("n", "-", "<CMD>Oil<CR>", { desc= "Open parent directory"})
end
}
}

View File

@ -0,0 +1,21 @@
return {
"stevearc/conform.nvim",
event = { "BufWritePre"},
cmd = { "ConformInfo"},
opts = {
formatters_by_ft = {
php = { "pint"},
lua = { "stylua"},
javascript = { "prettierd", "prettier", stop_after_first = true },
typescript = { "prettierd", "prettier", stop_after_first = true },
},
format_on_save = { timeout_ms = 500 },
default_format_ops = {
lsp_format = "fallback"
},
},
config = function ()
require("conform").setup()
end
}

View File

@ -96,14 +96,14 @@ return
end
end, {silent = true})
require("luasnip.loaders.from_lua").load({paths= "C:\\Users\\nigel\\AppData\\Local\\nvim\\lua\\snippets"})
require("luasnip.loaders.from_lua").load({paths= "C:\\Users\\nigel\\AppData\\Local\\nvim\\lua\\barink\\snippets"})
-- Set up lspconfig.
local capabilities = require("cmp_nvim_lsp").default_capabilities()
local lsp = require("lspconfig")
local language_server = {
local language_server = {
asm_lsp= true,
zls = true,
rust_analyzer = true,
@ -111,28 +111,59 @@ return
pylsp = true,
clangd = {
capabilities = capabilities,
root_dir = require('lspconfig').util.root_pattern("compile_commands.json", "compile_flags.txt", ".git"),
root_dir = require('lspconfig').util.root_pattern("compile_commands.json", "compile_flags.txt", ".git"),
cmd = {"clangd"},
filetypes = { "c", "cpp", "objc", "objcpp"},
settings = {
clangd = {
settings = {
clangd = {
compilationDatabasePath = "compile-commands.json",
},
}
},
tsserver = true,
gopls = true
gopls = true,
lua_ls = {
settings = {
Lua = {
diagnostics = {
globals = { 'vim'}
}
}
}
},
}
for name, config in pairs(language_server) do
if config == true then
config = {}
end
config = vim.tbl_deep_extend("force", {}, {
capabilities = capabilities,
}, config)
lsp[name].setup({})
config = vim.tbl_deep_extend("force", {}, { capabilities = capabilities }, config)
lsp[name].setup({})
end
vim.api.nvim_create_autocmd("LspAttach", {
callback = function (args)
local client = assert(vim.lsp.get_client_by_id(args.data.client_id), "must have valid client")
local settings = language_server[client.name]
if type(settings) ~= "table" then
settings = {}
end
local builtin = require "telescope.builtin"
vim.opt_local.omnifunc = "v:lua.vim.lsp.omnifunc"
vim.keymap.set("n", "gd", builtin.lsp_definitions, {buffer = -1})
vim.keymap.set("n", "gr", builtin.lsp_references, {buffer = -1})
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, {buffer = -1})
vim.keymap.set("n", "gT", vim.lsp.buf.type_definition, {buffer = -1})
vim.keymap.set("n", "K", vim.lsp.buf.hover, {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>wd", builtin.lsp_document_symbols, {buffer = -1})
end
})
end,
}

View File

@ -14,8 +14,15 @@ return {
require('telescope').load_extension('fzf')
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
vim.keymap.set('n', '<leader>fs', builtin.git_files, {})
vim.keymap.set('n', '<leader>fd', builtin.find_files, {})
vim.keymap.set('n', '<leader>ft', builtin.git_files, {})
vim.keymap.set('n', '<leader>fh', builtin.help_tags)
vim.keymap.set('n', '<leader>fb', builtin.buffers)
vim.keymap.set('n', '<leader>/', builtin.current_buffer_fuzzy_find)
vim.keymap.set('n', '<leader>gw', builtin.grep_string)
vim.keymap.set('n', '<leader>fp',function ()
builtin.find_files { cwd = "~/AppData/Local/nvim/lua/barink/"}
end)
end
}
}