Update
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
local opts = { noremap=true, silent=true }
|
local opts = { noremap = true, silent = true }
|
||||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||||
@@ -9,7 +9,7 @@ local on_attach = function(client, bufnr)
|
|||||||
|
|
||||||
-- Mappings.
|
-- Mappings.
|
||||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||||
local bufopts = { noremap=true, silent=true, buffer=bufnr }
|
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||||||
vim.keymap.set('n', 'gT', vim.lsp.buf.type_definition, bufopts)
|
vim.keymap.set('n', 'gT', vim.lsp.buf.type_definition, bufopts)
|
||||||
@@ -24,59 +24,100 @@ local on_attach = function(client, bufnr)
|
|||||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
||||||
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
||||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||||
|
vim.keymap.set('n', '<space>f',
|
||||||
|
function() vim.lsp.buf.format { async = true, filter = function(c) return c.name ~= "tsserver" end } end, bufopts)
|
||||||
end
|
end
|
||||||
|
|
||||||
local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||||
|
|
||||||
require'lspconfig'.clangd.setup{
|
require 'lspconfig'.clangd.setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
}
|
}
|
||||||
require'lspconfig'.tsserver.setup{
|
require 'lspconfig'.tsserver.setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
}
|
}
|
||||||
require'lspconfig'.pyright.setup{
|
require 'lspconfig'.pyright.setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
}
|
}
|
||||||
require'lspconfig'.rust_analyzer.setup{
|
require 'lspconfig'.eslint.setup {
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
settings = {
|
||||||
|
format = false
|
||||||
|
},
|
||||||
|
}
|
||||||
|
require 'lspconfig'.rust_analyzer.setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
cmd = {
|
cmd = {
|
||||||
"rustup", "run", "stable", "rust-analyzer",
|
"rustup", "run", "stable", "rust-analyzer",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
require'lspconfig'.phpactor.setup{
|
require 'lspconfig'.phpactor.setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
init_options = {
|
init_options = {
|
||||||
["language_server_phpstan.enabled"] = false,
|
["language_server_phpstan.enabled"] = false,
|
||||||
["language_server_psalm.enabled"] = false,
|
["language_server_psalm.enabled"] = false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
require'lspconfig'.asm_lsp.setup{
|
require 'lspconfig'.asm_lsp.setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
cmd = {
|
cmd = {
|
||||||
"/home/dobiadi/.cargo/bin/asm-lsp"
|
"/home/dobiadi/.cargo/bin/asm-lsp"
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
require'lspconfig'.elixirls.setup{
|
require 'lspconfig'.elixirls.setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
cmd = {
|
cmd = {
|
||||||
"elixir-ls"
|
"elixir-ls"
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
require'lspconfig'.terraformls.setup{
|
require'lspconfig'.terraformls.setup{
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
}
|
}
|
||||||
vim.opt.completeopt = {"menu", "menuone", "noselect"}
|
require 'lspconfig'.lua_ls.setup {
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_init = function(client)
|
||||||
|
local path = client.workspace_folders[1].name
|
||||||
|
if vim.loop.fs_stat(path .. '/.luarc.json') or vim.loop.fs_stat(path .. '/.luarc.jsonc') then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
|
||||||
|
runtime = {
|
||||||
|
-- Tell the language server which version of Lua you're using
|
||||||
|
-- (most likely LuaJIT in the case of Neovim)
|
||||||
|
version = 'LuaJIT'
|
||||||
|
},
|
||||||
|
-- Make the server aware of Neovim runtime files
|
||||||
|
workspace = {
|
||||||
|
checkThirdParty = false,
|
||||||
|
library = {
|
||||||
|
vim.env.VIMRUNTIME
|
||||||
|
-- Depending on the usage, you might want to add additional paths here.
|
||||||
|
-- "${3rd}/luv/library"
|
||||||
|
-- "${3rd}/busted/library",
|
||||||
|
}
|
||||||
|
-- or pull in all of 'runtimepath'. NOTE: this is a lot slower
|
||||||
|
-- library = vim.api.nvim_get_runtime_file("", true)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
settings = {
|
||||||
|
Lua = {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vim.opt.completeopt = { "menu", "menuone", "noselect" }
|
||||||
|
|
||||||
-- Set up nvim-cmp.
|
-- Set up nvim-cmp.
|
||||||
local cmp = require'cmp'
|
local cmp = require 'cmp'
|
||||||
|
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
preselect = cmp.PreselectMode.None,
|
preselect = cmp.PreselectMode.None,
|
||||||
@@ -117,31 +158,24 @@ cmp.setup.filetype('gitcommit', {
|
|||||||
})
|
})
|
||||||
|
|
||||||
vim.diagnostic.config({
|
vim.diagnostic.config({
|
||||||
float = {
|
float = {
|
||||||
source = "always",
|
source = "always",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
require("null-ls").setup({
|
require("null-ls").setup({
|
||||||
sources = {
|
sources = {
|
||||||
-- Terraform
|
|
||||||
require("null-ls").builtins.formatting.terraform_fmt,
|
|
||||||
require("null-ls").builtins.diagnostics.terraform_validate,
|
|
||||||
-- Packer
|
-- Packer
|
||||||
require("null-ls").builtins.formatting.hclfmt,
|
require("null-ls").builtins.formatting.hclfmt,
|
||||||
-- JavaScript
|
-- JavaScript
|
||||||
require("null-ls").builtins.formatting.prettier,
|
require("null-ls").builtins.formatting.prettier,
|
||||||
require("null-ls").builtins.diagnostics.eslint_d,
|
|
||||||
require("null-ls").builtins.code_actions.eslint_d,
|
|
||||||
-- Python
|
-- Python
|
||||||
require("null-ls").builtins.formatting.black.with({ extra_args = {"--fast"}}),
|
require("null-ls").builtins.formatting.black.with({ extra_args = { "--fast" } }),
|
||||||
require("null-ls").builtins.formatting.isort,
|
require("null-ls").builtins.formatting.isort,
|
||||||
require("null-ls").builtins.diagnostics.flake8.with({ extra_args = {"--max-line-length", "88", "--ignore", "E203"}}),
|
require("none-ls.diagnostics.flake8").with({ extra_args = { "--max-line-length", "88", "--ignore", "E203" } }),
|
||||||
-- PHP
|
-- PHP
|
||||||
require("null-ls").builtins.formatting.phpcbf.with({ extra_args = {"--standard=PSR12"}}),
|
require("null-ls").builtins.formatting.phpcbf.with({ extra_args = { "--standard=PSR12" } }),
|
||||||
require("null-ls").builtins.diagnostics.phpcs.with({ extra_args = {"--standard=PSR12"}}),
|
require("null-ls").builtins.diagnostics.phpcs.with({ extra_args = { "--standard=PSR12" } }),
|
||||||
-- Rust
|
|
||||||
require("null-ls").builtins.formatting.rustfmt,
|
|
||||||
-- ASM
|
-- ASM
|
||||||
require("null-ls").builtins.formatting.asmfmt,
|
require("null-ls").builtins.formatting.asmfmt,
|
||||||
-- Elixir
|
-- Elixir
|
||||||
|
|||||||
@@ -9,7 +9,10 @@ return require('packer').startup(function(use)
|
|||||||
|
|
||||||
-- LSP
|
-- LSP
|
||||||
use 'neovim/nvim-lspconfig'
|
use 'neovim/nvim-lspconfig'
|
||||||
use 'nvimtools/none-ls.nvim'
|
use {
|
||||||
|
'nvimtools/none-ls.nvim',
|
||||||
|
requires = { {'nvimtools/none-ls-extras.nvim'} }
|
||||||
|
}
|
||||||
|
|
||||||
-- Autocomplete
|
-- Autocomplete
|
||||||
use 'hrsh7th/nvim-cmp'
|
use 'hrsh7th/nvim-cmp'
|
||||||
@@ -22,7 +25,7 @@ return require('packer').startup(function(use)
|
|||||||
|
|
||||||
-- Telescope
|
-- Telescope
|
||||||
use {
|
use {
|
||||||
'nvim-telescope/telescope.nvim', tag = '0.1.5',
|
'nvim-telescope/telescope.nvim', tag = '0.1.6',
|
||||||
requires = { {'nvim-lua/plenary.nvim'} }
|
requires = { {'nvim-lua/plenary.nvim'} }
|
||||||
}
|
}
|
||||||
use 'nvim-treesitter/nvim-treesitter'
|
use 'nvim-treesitter/nvim-treesitter'
|
||||||
|
|||||||
@@ -49,8 +49,8 @@ local function save_profiles(threshold)
|
|||||||
end
|
end
|
||||||
|
|
||||||
time([[Luarocks path setup]], true)
|
time([[Luarocks path setup]], true)
|
||||||
local package_path_str = "/home/dobiadi/.cache/nvim/packer_hererocks/2.1.1702233742/share/lua/5.1/?.lua;/home/dobiadi/.cache/nvim/packer_hererocks/2.1.1702233742/share/lua/5.1/?/init.lua;/home/dobiadi/.cache/nvim/packer_hererocks/2.1.1702233742/lib/luarocks/rocks-5.1/?.lua;/home/dobiadi/.cache/nvim/packer_hererocks/2.1.1702233742/lib/luarocks/rocks-5.1/?/init.lua"
|
local package_path_str = "/home/dobiadi/.cache/nvim/packer_hererocks/2.1.1710088188/share/lua/5.1/?.lua;/home/dobiadi/.cache/nvim/packer_hererocks/2.1.1710088188/share/lua/5.1/?/init.lua;/home/dobiadi/.cache/nvim/packer_hererocks/2.1.1710088188/lib/luarocks/rocks-5.1/?.lua;/home/dobiadi/.cache/nvim/packer_hererocks/2.1.1710088188/lib/luarocks/rocks-5.1/?/init.lua"
|
||||||
local install_cpath_pattern = "/home/dobiadi/.cache/nvim/packer_hererocks/2.1.1702233742/lib/lua/5.1/?.so"
|
local install_cpath_pattern = "/home/dobiadi/.cache/nvim/packer_hererocks/2.1.1710088188/lib/lua/5.1/?.so"
|
||||||
if not string.find(package.path, package_path_str, 1, true) then
|
if not string.find(package.path, package_path_str, 1, true) then
|
||||||
package.path = package.path .. ';' .. package_path_str
|
package.path = package.path .. ';' .. package_path_str
|
||||||
end
|
end
|
||||||
@@ -114,6 +114,11 @@ _G.packer_plugins = {
|
|||||||
path = "/home/dobiadi/.local/share/nvim/site/pack/packer/start/lualine.nvim",
|
path = "/home/dobiadi/.local/share/nvim/site/pack/packer/start/lualine.nvim",
|
||||||
url = "https://github.com/nvim-lualine/lualine.nvim"
|
url = "https://github.com/nvim-lualine/lualine.nvim"
|
||||||
},
|
},
|
||||||
|
["none-ls-extras.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/dobiadi/.local/share/nvim/site/pack/packer/start/none-ls-extras.nvim",
|
||||||
|
url = "https://github.com/nvimtools/none-ls-extras.nvim"
|
||||||
|
},
|
||||||
["none-ls.nvim"] = {
|
["none-ls.nvim"] = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/home/dobiadi/.local/share/nvim/site/pack/packer/start/none-ls.nvim",
|
path = "/home/dobiadi/.local/share/nvim/site/pack/packer/start/none-ls.nvim",
|
||||||
|
|||||||
Reference in New Issue
Block a user