rust LSP
This commit is contained in:
@ -237,32 +237,29 @@ local on_attach = function(client, bufnr)
|
|||||||
vim.api.nvim_buf_set_option(bufnr, "tagfunc", "v:lua.vim.lsp.tagfunc")
|
vim.api.nvim_buf_set_option(bufnr, "tagfunc", "v:lua.vim.lsp.tagfunc")
|
||||||
end
|
end
|
||||||
|
|
||||||
local opts = { noremap = true, silent = true }
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "L", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "g0", "<cmd>lua vim.lsp.buf.document_symbol()<CR>", opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gW", "<cmd>lua vim.lsp.buf.workspace_symbol()<CR>", opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "<cmd>tab split | lua vim.lsp.buf.definition()<CR>", opts)
|
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "grf", "<cmd>lua vim.lsp.buf.references()<CR>", opts) -- diagnostics controls references
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "<C-g>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "i", "<C-g>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
|
||||||
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gt", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
|
|
||||||
|
|
||||||
vim.api.nvim_command("augroup LSP")
|
|
||||||
vim.api.nvim_command("autocmd!")
|
|
||||||
if client.server_capabilities.document_highlight then
|
if client.server_capabilities.document_highlight then
|
||||||
vim.api.nvim_command("autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()")
|
vim.api.nvim_command("autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()")
|
||||||
vim.api.nvim_command("autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight()")
|
vim.api.nvim_command("autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight()")
|
||||||
vim.api.nvim_command("autocmd CursorMoved <buffer> lua vim.lsp.util.buf_clear_references()")
|
vim.api.nvim_command("autocmd CursorMoved <buffer> lua vim.lsp.util.buf_clear_references()")
|
||||||
end
|
end
|
||||||
vim.api.nvim_command("augroup END")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local opts = { noremap = true, silent = true }
|
||||||
|
vim.api.nvim_set_keymap("n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
||||||
|
vim.api.nvim_set_keymap("n", "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
|
||||||
|
vim.api.nvim_set_keymap("n", "L", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
||||||
|
vim.api.nvim_set_keymap("n", "g0", "<cmd>lua vim.lsp.buf.document_symbol()<CR>", opts)
|
||||||
|
vim.api.nvim_set_keymap("n", "gW", "<cmd>lua vim.lsp.buf.workspace_symbol()<CR>", opts)
|
||||||
|
vim.api.nvim_set_keymap("n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
||||||
|
vim.api.nvim_set_keymap("n", "gD", "<cmd>tab split | lua vim.lsp.buf.definition()<CR>", opts)
|
||||||
|
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
|
||||||
|
vim.api.nvim_set_keymap("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
||||||
|
vim.api.nvim_set_keymap("n", "grf", "<cmd>lua vim.lsp.buf.references()<CR>", opts) -- diagnostics controls references
|
||||||
|
vim.api.nvim_set_keymap("n", "<C-g>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||||
|
vim.api.nvim_set_keymap("i", "<C-g>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||||
|
|
||||||
|
vim.api.nvim_set_keymap("n", "gt", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
|
||||||
|
|
||||||
|
|
||||||
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())
|
||||||
capabilities['codeLens'] = {dynamicRegistration=false}
|
capabilities['codeLens'] = {dynamicRegistration=false}
|
||||||
@ -318,3 +315,19 @@ lspconfig.sumneko_lua.setup({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
require("mason").setup()
|
||||||
|
require("mason-lspconfig").setup({
|
||||||
|
ensure_installed = { "sumneko_lua", "rust_analyzer" }
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
local lsp = require('lsp-zero')
|
||||||
|
lsp.preset('manual-setup')
|
||||||
|
|
||||||
|
local rust_lsp = lsp.build_options('rust_analyzer', {})
|
||||||
|
|
||||||
|
lsp.setup()
|
||||||
|
|
||||||
|
-- Initialize rust_analyzer with rust-tools
|
||||||
|
require('rust-tools').setup({server = rust_lsp})
|
||||||
|
@ -39,13 +39,8 @@ require('packer').startup(function(use)
|
|||||||
use 'renerocksai/calendar-vim'
|
use 'renerocksai/calendar-vim'
|
||||||
|
|
||||||
use 'google/vim-searchindex'
|
use 'google/vim-searchindex'
|
||||||
|
use 'ray-x/go.nvim'
|
||||||
use {
|
use 'ray-x/guihua.lua'
|
||||||
'filipdutescu/renamer.nvim',
|
|
||||||
branch = 'master',
|
|
||||||
requires = { {'nvim-lua/plenary.nvim'} }
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Pretty symbols
|
-- Pretty symbols
|
||||||
use 'kyazdani42/nvim-web-devicons'
|
use 'kyazdani42/nvim-web-devicons'
|
||||||
|
|
||||||
@ -60,7 +55,6 @@ require('packer').startup(function(use)
|
|||||||
'hrsh7th/cmp-nvim-lsp',
|
'hrsh7th/cmp-nvim-lsp',
|
||||||
'hrsh7th/cmp-buffer',
|
'hrsh7th/cmp-buffer',
|
||||||
'lukas-reineke/cmp-under-comparator',
|
'lukas-reineke/cmp-under-comparator',
|
||||||
'williamboman/nvim-lsp-installer',
|
|
||||||
'hrsh7th/cmp-cmdline',
|
'hrsh7th/cmp-cmdline',
|
||||||
'f3fora/cmp-spell',
|
'f3fora/cmp-spell',
|
||||||
'hrsh7th/cmp-nvim-lsp-document-symbol',
|
'hrsh7th/cmp-nvim-lsp-document-symbol',
|
||||||
@ -73,6 +67,12 @@ require('packer').startup(function(use)
|
|||||||
-- config = [[require('lsp')]],
|
-- config = [[require('lsp')]],
|
||||||
-- event = 'InsertEnter',
|
-- event = 'InsertEnter',
|
||||||
}
|
}
|
||||||
|
use {
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
"williamboman/mason-lspconfig.nvim",
|
||||||
|
'VonHeikemen/lsp-zero.nvim',
|
||||||
|
}
|
||||||
|
use 'simrat39/rust-tools.nvim'
|
||||||
use 'folke/trouble.nvim'
|
use 'folke/trouble.nvim'
|
||||||
|
|
||||||
use 'hrsh7th/vim-vsnip'
|
use 'hrsh7th/vim-vsnip'
|
||||||
|
@ -6,9 +6,9 @@ ensure_installed = "all",
|
|||||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||||
sync_install = false,
|
sync_install = false,
|
||||||
|
|
||||||
highlight = {
|
highlight = {
|
||||||
-- `false` will disable the whole extension
|
-- `false` will disable the whole extension
|
||||||
enable = true,
|
enable = true,
|
||||||
indent = {
|
indent = {
|
||||||
enable = true
|
enable = true
|
||||||
},
|
},
|
||||||
@ -21,4 +21,8 @@ highlight = {
|
|||||||
-- additional_vim_regex_highlighting = true,
|
-- additional_vim_regex_highlighting = true,
|
||||||
-- additional_vim_regex_highlighting = {"java"},
|
-- additional_vim_regex_highlighting = {"java"},
|
||||||
},
|
},
|
||||||
|
rainbow = {
|
||||||
|
enable = true,
|
||||||
|
extended_mode = true,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ export PATH=$PATH:$HOME/scripts
|
|||||||
|
|
||||||
export PATH=$PATH:.
|
export PATH=$PATH:.
|
||||||
export GOPATH=$HOME/go
|
export GOPATH=$HOME/go
|
||||||
|
export PATH=$PATH:$GOPATH/bin
|
||||||
export GO111MODULE=auto
|
export GO111MODULE=auto
|
||||||
export CLOUDSDK_PYTHON=python2
|
export CLOUDSDK_PYTHON=python2
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user