add rust tools
This commit is contained in:
+32
-14
@@ -18,8 +18,6 @@ vim.o.visualbell = true -- blink cursor on error, instead of beeping
|
||||
vim.cmd('set invlist')
|
||||
|
||||
|
||||
vim.api.nvim_set_keymap("n", "<leader>", "<Plug>(easymotion-bd-jk)", { noremap = true })
|
||||
vim.keymap.set("i", "kj", "<esc>", { silent = true }) -- sets noremap automatically
|
||||
vim.api.nvim_set_var("toggle_syntax_state", true)
|
||||
|
||||
-- Plugins
|
||||
@@ -32,11 +30,13 @@ vim.call('plug#begin', '~/.config/nvim/plugged')
|
||||
Plug 'junegunn/goyo.vim' -- zen mode
|
||||
Plug('junegunn/fzf', {['do'] = vim.fn['fzf#install']})
|
||||
Plug('nvim-treesitter/nvim-treesitter', {['do'] = vim.fn['TSUpdate']}) -- add support for text objects
|
||||
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
|
||||
-- Plug 'ctrlpvim/ctrlp.vim' -- minimal fuzzyfinder
|
||||
Plug 'wadackel/vim-dogrun' -- colorscheme
|
||||
Plug 'tribela/vim-transparent' -- clear background
|
||||
Plug 'nvim-lua/plenary.nvim' -- testing framework, required for telescope
|
||||
Plug 'nvim-telescope/telescope.nvim' -- fancy fuzzyfinder
|
||||
Plug('nvim-telescope/telescope-fzf-native.nvim', { ['do'] = 'make' }) -- faster fzf
|
||||
|
||||
-- LSP
|
||||
Plug "williamboman/nvim-lsp-installer"
|
||||
@@ -57,7 +57,8 @@ vim.call('plug#begin', '~/.config/nvim/plugged')
|
||||
Plug 'sheerun/vim-polyglot'
|
||||
Plug 'evanleck/vim-svelte'
|
||||
Plug 'pantharshit00/vim-prisma'
|
||||
Plug 'pangloss/vim-javascript'
|
||||
Plug 'simrat39/rust-tools.nvim'
|
||||
--Plug 'pangloss/vim-javascript'
|
||||
vim.call('plug#end')
|
||||
|
||||
-- set colorscheme
|
||||
@@ -102,6 +103,7 @@ cmp.setup({
|
||||
})
|
||||
})
|
||||
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', '[d', vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||
@@ -147,12 +149,29 @@ lspconfig.sumneko_lua.setup {}
|
||||
lspconfig.tsserver.setup{
|
||||
on_attach = on_attach,
|
||||
}
|
||||
lspconfig.rust_analyzer.setup{
|
||||
on_attach = on_attach,
|
||||
|
||||
-- Server-specific settings...
|
||||
settings = {
|
||||
["rust-analyzer"] = {}
|
||||
require('rust-tools').setup{
|
||||
tools = { -- rust-tools options
|
||||
autoSetHints = true,
|
||||
hover_with_actions = true,
|
||||
runnables = {
|
||||
use_telescope = true
|
||||
},
|
||||
inlay_hints = {
|
||||
show_parameter_hints = false,
|
||||
parameter_hints_prefix = "",
|
||||
other_hints_prefix = "",
|
||||
}
|
||||
},
|
||||
server = {
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
checkOnSave = {
|
||||
command = "clippy"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
require('lspconfig')['svelte'].setup{
|
||||
@@ -181,11 +200,12 @@ telescope.setup({
|
||||
pickers = {},
|
||||
extensions = {},
|
||||
})
|
||||
telescope.load_extension('fzf')
|
||||
|
||||
-- keymaps
|
||||
local opts = { noremap=true, silent=true }
|
||||
local loudOpts = { noremap=true }
|
||||
vim.keymap.set("n", "<c-s>", ":wa<cr>:echo 'File saved.'<cr>", loudOpts)
|
||||
local loud_opts = { noremap=true }
|
||||
vim.keymap.set("n", "<c-s>", ":wa<cr>:echo 'File saved.'<cr>", loud_opts)
|
||||
vim.keymap.set("n", "<c-t>", ":NERDTreeToggle<cr>", opts)
|
||||
vim.keymap.set("n", "<leader>tt", ":TransparentToggle<cr>", opts)
|
||||
vim.keymap.set("n", "<leader>tz", ":Goyo 150<cr>", opts)
|
||||
@@ -199,11 +219,9 @@ vim.keymap.set('n', '<leader>fk', ':Telescope keymaps<cr>', opts)
|
||||
vim.keymap.set("n", "<c-p>", ":Telescope find_files<cr>", opts)
|
||||
vim.keymap.set("n", "<leader>fg", ":Telescope live_grep<cr>", opts)
|
||||
vim.keymap.set("n", "<leader>fb", ":Telescope buffers<cr>", opts)
|
||||
vim.keymap.set("n", "<leader>fh", ":Telescope help_tags<cr>", opts)
|
||||
vim.keymap.set("n", "<f1>", "", opts)
|
||||
vim.keymap.set("i", "<f1>", "", opts)
|
||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, 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', '<leader>q', vim.diagnostic.setloclist, opts)
|
||||
|
||||
vim.keymap.set("n", "<cr>", ":nohlsearch<cr>", opts)
|
||||
|
||||
Reference in New Issue
Block a user