Added better rust handling to nvim
This commit is contained in:
parent
0048525dd7
commit
03324d92c8
@ -10,3 +10,4 @@ require "user.nvim-tree"
|
||||
require "user.bufferline"
|
||||
require "user.statusline"
|
||||
require "user.gitsigns"
|
||||
require "user.rust-tools"
|
||||
|
@ -52,10 +52,10 @@ cmp.setup {
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
["<C-k>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-j>"] = cmp.mapping.select_next_item(),
|
||||
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }),
|
||||
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }),
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||
['<C-S-f>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
||||
["<C-y>"] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
|
||||
["<C-e>"] = cmp.mapping {
|
||||
@ -102,18 +102,22 @@ cmp.setup {
|
||||
-- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind
|
||||
vim_item.menu = ({
|
||||
nvim_lsp = "[LSP]",
|
||||
luasnip = "[Snippet]",
|
||||
buffer = "[Buffer]",
|
||||
luasnip = "[Snip]",
|
||||
buffer = "[Buff]",
|
||||
path = "[Path]",
|
||||
vsnip = "[VSnip]",
|
||||
})[entry.source.name]
|
||||
return vim_item
|
||||
end,
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
{ name = 'path' }, -- file paths
|
||||
{ name = 'nvim_lsp', keyword_length = 3 }, -- from language server
|
||||
{ name = 'nvim_lsp_signature_help'}, -- display function signatures with current parameter emphasized
|
||||
{ name = 'nvim_lua', keyword_length = 2}, -- complete neovim's Lua runtime API such vim.lsp.*
|
||||
{ name = 'buffer', keyword_length = 2 }, -- source current buffer
|
||||
{ name = 'vsnip', keyword_length = 2 }, -- nvim-cmp source for vim-vsnip
|
||||
{ name = 'calc'}, -- source for math calculation
|
||||
},
|
||||
confirm_opts = {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
|
@ -6,3 +6,39 @@ end
|
||||
require "user.lsp.mason"
|
||||
require("user.lsp.handlers").setup()
|
||||
require "user.lsp.null-ls"
|
||||
|
||||
|
||||
|
||||
-- LSP Diagnostics Options Setup
|
||||
local sign = function(opts)
|
||||
vim.fn.sign_define(opts.name, {
|
||||
texthl = opts.name,
|
||||
text = opts.text,
|
||||
numhl = ''
|
||||
})
|
||||
end
|
||||
|
||||
sign({name = 'DiagnosticSignError', text = ''})
|
||||
sign({name = 'DiagnosticSignWarn', text = ''})
|
||||
sign({name = 'DiagnosticSignHint', text = ''})
|
||||
sign({name = 'DiagnosticSignInfo', text = ''})
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false,
|
||||
signs = true,
|
||||
update_in_insert = true,
|
||||
underline = true,
|
||||
severity_sort = false,
|
||||
float = {
|
||||
border = 'rounded',
|
||||
source = 'always',
|
||||
header = '',
|
||||
prefix = '',
|
||||
},
|
||||
})
|
||||
|
||||
vim.cmd([[
|
||||
set signcolumn=yes
|
||||
autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false })
|
||||
]])
|
||||
|
||||
|
@ -47,13 +47,20 @@ return packer.startup(function(use)
|
||||
|
||||
-- Colorschemes
|
||||
use "shaunsingh/nord.nvim"
|
||||
|
||||
-- cmp plugins
|
||||
use "hrsh7th/nvim-cmp" -- The completion plugin
|
||||
use "hrsh7th/cmp-buffer" -- buffer completions
|
||||
use "hrsh7th/cmp-nvim-lsp"
|
||||
|
||||
use 'hrsh7th/cmp-nvim-lua'
|
||||
use 'hrsh7th/cmp-nvim-lsp-signature-help'
|
||||
|
||||
use 'hrsh7th/cmp-vsnip'
|
||||
use "hrsh7th/cmp-path" -- path completions
|
||||
use "hrsh7th/cmp-buffer" -- buffer completions
|
||||
use "hrsh7th/vim-vsnip"
|
||||
use "hrsh7th/cmp-cmdline" -- cmdline completions
|
||||
use "saadparwaiz1/cmp_luasnip" -- snippet completions
|
||||
use "hrsh7th/cmp-nvim-lsp"
|
||||
|
||||
-- snippets
|
||||
use "L3MON4D3/LuaSnip" --snippet engine
|
||||
@ -65,6 +72,8 @@ return packer.startup(function(use)
|
||||
use "williamboman/mason-lspconfig.nvim" -- simple to use language server installer
|
||||
use 'jose-elias-alvarez/null-ls.nvim' -- LSP diagnostics and code actions
|
||||
|
||||
use 'simrat39/rust-tools.nvim'
|
||||
|
||||
-- Telescope
|
||||
use "nvim-telescope/telescope.nvim"
|
||||
use 'nvim-telescope/telescope-media-files.nvim'
|
||||
|
Loading…
Reference in New Issue
Block a user