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.bufferline"
|
||||||
require "user.statusline"
|
require "user.statusline"
|
||||||
require "user.gitsigns"
|
require "user.gitsigns"
|
||||||
|
require "user.rust-tools"
|
||||||
|
@ -52,10 +52,10 @@ cmp.setup {
|
|||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
mapping = {
|
mapping = {
|
||||||
["<C-k>"] = cmp.mapping.select_prev_item(),
|
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||||
["<C-j>"] = cmp.mapping.select_next_item(),
|
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||||
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }),
|
['<C-S-f>'] = cmp.mapping.scroll_docs(-4),
|
||||||
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }),
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
["<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-y>"] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
|
||||||
["<C-e>"] = cmp.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.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 = ({
|
vim_item.menu = ({
|
||||||
nvim_lsp = "[LSP]",
|
nvim_lsp = "[LSP]",
|
||||||
luasnip = "[Snippet]",
|
luasnip = "[Snip]",
|
||||||
buffer = "[Buffer]",
|
buffer = "[Buff]",
|
||||||
path = "[Path]",
|
path = "[Path]",
|
||||||
|
vsnip = "[VSnip]",
|
||||||
})[entry.source.name]
|
})[entry.source.name]
|
||||||
return vim_item
|
return vim_item
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
sources = {
|
sources = {
|
||||||
{ name = "nvim_lsp" },
|
{ name = 'path' }, -- file paths
|
||||||
{ name = "luasnip" },
|
{ name = 'nvim_lsp', keyword_length = 3 }, -- from language server
|
||||||
{ name = "buffer" },
|
{ name = 'nvim_lsp_signature_help'}, -- display function signatures with current parameter emphasized
|
||||||
{ name = "path" },
|
{ 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 = {
|
confirm_opts = {
|
||||||
behavior = cmp.ConfirmBehavior.Replace,
|
behavior = cmp.ConfirmBehavior.Replace,
|
||||||
|
@ -6,3 +6,39 @@ end
|
|||||||
require "user.lsp.mason"
|
require "user.lsp.mason"
|
||||||
require("user.lsp.handlers").setup()
|
require("user.lsp.handlers").setup()
|
||||||
require "user.lsp.null-ls"
|
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
|
-- Colorschemes
|
||||||
use "shaunsingh/nord.nvim"
|
use "shaunsingh/nord.nvim"
|
||||||
|
|
||||||
-- cmp plugins
|
-- cmp plugins
|
||||||
use "hrsh7th/nvim-cmp" -- The completion plugin
|
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-path" -- path completions
|
||||||
|
use "hrsh7th/cmp-buffer" -- buffer completions
|
||||||
|
use "hrsh7th/vim-vsnip"
|
||||||
use "hrsh7th/cmp-cmdline" -- cmdline completions
|
use "hrsh7th/cmp-cmdline" -- cmdline completions
|
||||||
use "saadparwaiz1/cmp_luasnip" -- snippet completions
|
use "saadparwaiz1/cmp_luasnip" -- snippet completions
|
||||||
use "hrsh7th/cmp-nvim-lsp"
|
|
||||||
|
|
||||||
-- snippets
|
-- snippets
|
||||||
use "L3MON4D3/LuaSnip" --snippet engine
|
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 "williamboman/mason-lspconfig.nvim" -- simple to use language server installer
|
||||||
use 'jose-elias-alvarez/null-ls.nvim' -- LSP diagnostics and code actions
|
use 'jose-elias-alvarez/null-ls.nvim' -- LSP diagnostics and code actions
|
||||||
|
|
||||||
|
use 'simrat39/rust-tools.nvim'
|
||||||
|
|
||||||
-- Telescope
|
-- Telescope
|
||||||
use "nvim-telescope/telescope.nvim"
|
use "nvim-telescope/telescope.nvim"
|
||||||
use 'nvim-telescope/telescope-media-files.nvim'
|
use 'nvim-telescope/telescope-media-files.nvim'
|
||||||
|
Loading…
Reference in New Issue
Block a user