Many changes to nvim configs
- switch to nvim-cmp - add lsp-status stuff to statusline
This commit is contained in:
@@ -18,8 +18,11 @@ augroup AutoSaveGroup
|
||||
autocmd BufWinLeave,BufLeave,BufWritePost,BufHidden,QuitPre ?* nested silent! mkview!
|
||||
autocmd BufWinEnter ?* silent! loadview
|
||||
augroup end
|
||||
au BufNewFile,BufRead,BufReadPost *.html.tera set syntax=HTML
|
||||
]], false)
|
||||
|
||||
vim.o.number = true
|
||||
vim.o.relativenumber = true
|
||||
vim.o.timeoutlen = 700
|
||||
vim.o.guifont='Hasklug Nerd Font Mono,Hack Nerd Font,NotoEmoji Nerd Font'
|
||||
|
||||
@@ -49,6 +52,7 @@ vim.wo.signcolumn='yes'
|
||||
vim.g.dashboard_default_executive = 'fzf'
|
||||
vim.g.python_highlight_all = 1
|
||||
|
||||
|
||||
vim.g.test = {
|
||||
default = {
|
||||
default = {
|
||||
@@ -60,3 +64,55 @@ vim.g.test = {
|
||||
},
|
||||
rust = { { complete_items = {'ts'} } },
|
||||
}
|
||||
|
||||
|
||||
-- Temp
|
||||
|
||||
vim.o.completeopt = 'menuone,noselect'
|
||||
|
||||
-- -- luasnip setup
|
||||
-- local luasnip = require 'luasnip'
|
||||
|
||||
-- -- nvim-cmp setup
|
||||
-- local cmp = require 'cmp'
|
||||
-- cmp.setup {
|
||||
-- snippet = {
|
||||
-- expand = function(args)
|
||||
-- require('luasnip').lsp_expand(args.body)
|
||||
-- end,
|
||||
-- },
|
||||
-- mapping = {
|
||||
-- ['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||
-- ['<C-n>'] = cmp.mapping.select_next_item(),
|
||||
-- ['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
-- ['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
-- ['<C-Space>'] = cmp.mapping.complete(),
|
||||
-- ['<C-e>'] = cmp.mapping.close(),
|
||||
-- ['<CR>'] = cmp.mapping.confirm {
|
||||
-- behavior = cmp.ConfirmBehavior.Replace,
|
||||
-- select = true,
|
||||
-- },
|
||||
-- ['<Tab>'] = function(fallback)
|
||||
-- if cmp.visible() then
|
||||
-- cmp.select_next_item()
|
||||
-- elseif luasnip.expand_or_jumpable() then
|
||||
-- luasnip.expand_or_jump()
|
||||
-- else
|
||||
-- fallback()
|
||||
-- end
|
||||
-- end,
|
||||
-- ['<S-Tab>'] = function(fallback)
|
||||
-- if cmp.visible() then
|
||||
-- cmp.select_prev_item()
|
||||
-- elseif luasnip.jumpable(-1) then
|
||||
-- luasnip.jump(-1)
|
||||
-- else
|
||||
-- fallback()
|
||||
-- end
|
||||
-- end,
|
||||
-- },
|
||||
-- sources = {
|
||||
-- { name = 'nvim_lsp' },
|
||||
-- { name = 'luasnip' },
|
||||
-- },
|
||||
-- }
|
||||
|
||||
@@ -43,25 +43,7 @@ local normal_mode_maps = {
|
||||
}
|
||||
|
||||
|
||||
vim.api.nvim_command([[imap <tab> <Plug>(completion_smart_tab)]])
|
||||
vim.api.nvim_command([[imap <s-tab> <Plug>(completion_smart_s_tab)]])
|
||||
|
||||
local insert_mode_maps = {
|
||||
-- {
|
||||
-- key = '<Tab>',
|
||||
-- map = [[pumvisible() ? "\<C-n>" : "\<Tab>"]],
|
||||
-- options = { noremap = true, silent = true, expr = true }
|
||||
-- },
|
||||
|
||||
-- {
|
||||
-- key = '<S-Tab>',
|
||||
-- map = [[pumvisible() ? "\<C-p>" : "\<S-Tab>"]],
|
||||
-- options = { noremap = true, silent = true, expr = true }
|
||||
-- },
|
||||
|
||||
-- { key = '<tab>', map = '(completion_smart_tab)', options = { plug = true } },
|
||||
-- { key = '<s-tab>', map = '(completion_smart_s_tab)', options = { plug = true } },
|
||||
|
||||
{ key = '<C-j>', map = '<ESC>' },
|
||||
}
|
||||
|
||||
|
||||
@@ -3,13 +3,14 @@
|
||||
|
||||
require("lsp.rust-analyzer")
|
||||
require("lsp.lua-language-server")
|
||||
require("lsp.pyls")
|
||||
-- require("lsp.pyls")
|
||||
|
||||
-- Set completeopt to have a better completion experience
|
||||
vim.o.completeopt= "menuone,noinsert,noselect"
|
||||
vim.o.completeopt= "menuone,noselect"
|
||||
|
||||
-- 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 CursorMoved <buffer> lua vim.lsp.buf.clear_references()]]
|
||||
--
|
||||
vim.api.nvim_buf_set_option(0, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
-- vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
@@ -1,23 +1,33 @@
|
||||
-- Built in lsp
|
||||
local lspconfig = require'lspconfig'
|
||||
-- local lspstatus = require('lsp-status')
|
||||
-- lspstatus.register_progress()
|
||||
|
||||
|
||||
lspconfig.rust_analyzer.setup{
|
||||
on_attach=function(client) require'completion'.on_attach(client) require'lsp-status'.on_attach(client) return end,
|
||||
on_attach=function(client) require'lsp-status'.on_attach(client) return end,
|
||||
capabilities = require'lsp-status'.capabilities,
|
||||
cmd = { "rust-analyzer" },
|
||||
filetypes = { "rust" },
|
||||
root_dir = lspconfig.util.root_pattern("Cargo.toml"),
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
assist = {
|
||||
importGranularity = "module",
|
||||
importPrefix = "by_self",
|
||||
},
|
||||
procMacro = {
|
||||
enable = true,
|
||||
},
|
||||
checkOnSave = {
|
||||
command = "clippy",
|
||||
allTargets = true,
|
||||
},
|
||||
cargo = {
|
||||
loadOutDirsFromCheck = true,
|
||||
allFeatures = true,
|
||||
-- target = "aarch64-linux-android"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lspconfig.rust_analyzer.setup{
|
||||
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
}
|
||||
|
||||
47
config/nvim/lua/nvim-cmp.lua
Normal file
47
config/nvim/lua/nvim-cmp.lua
Normal file
@@ -0,0 +1,47 @@
|
||||
-- luasnip setup
|
||||
local luasnip = require'luasnip'
|
||||
|
||||
-- nvim-cmp setup
|
||||
local cmp = require'cmp'
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.close(),
|
||||
['<CR>'] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
},
|
||||
['<Tab>'] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
['<S-Tab>'] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
},
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
},
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ return require('packer').startup(function()
|
||||
-- Packer can manage itself
|
||||
use 'wbthomason/packer.nvim'
|
||||
|
||||
|
||||
use {
|
||||
'glepnir/galaxyline.nvim', branch = 'main',
|
||||
config = function() require('statusline') end,
|
||||
@@ -51,34 +52,42 @@ return require('packer').startup(function()
|
||||
-- lsp
|
||||
use { 'onsails/lspkind-nvim', config = function() require'lspkind'.init() end, }
|
||||
use { 'folke/lsp-trouble.nvim', config = function() require("trouble").setup() end, }
|
||||
|
||||
use { 'neovim/nvim-lspconfig', config = function() require("lsp") end, }
|
||||
use { 'nvim-lua/completion-nvim' }
|
||||
use { 'nvim-lua/lsp-status.nvim' }
|
||||
-- use { 'folke/lsp-colors.nvim' }
|
||||
|
||||
|
||||
use {
|
||||
'hrsh7th/nvim-cmp',
|
||||
requires = { 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-buffer', 'saadparwaiz1/cmp_luasnip', 'L3MON4D3/LuaSnip' },
|
||||
config = function() require'nvim-cmp' end,
|
||||
}
|
||||
|
||||
use { 'folke/lsp-colors.nvim' }
|
||||
use { 'nvim-lua/lsp_extensions.nvim' }
|
||||
-- config = function() vim.cmd([[autocmd BufEnter,BufWinEnter,TabEnter *.rs :lua require'lsp_extensions'.inlay_hints()]]) end,
|
||||
--
|
||||
-- Qol
|
||||
use { 'sindrets/diffview.nvim' }
|
||||
use { 'justinmk/vim-sneak' }
|
||||
-- use { 'justinmk/vim-sneak' }
|
||||
use {
|
||||
'akinsho/nvim-toggleterm.lua',
|
||||
config = function() require'setup.toggleterm' end,
|
||||
'akinsho/nvim-toggleterm.lua',
|
||||
config = function() require'setup.toggleterm' end,
|
||||
}
|
||||
|
||||
use { 'airblade/vim-rooter' }
|
||||
use { 'glepnir/dashboard-nvim' }
|
||||
|
||||
-- Treesitter {{{
|
||||
use { 'nvim-treesitter/nvim-treesitter' }
|
||||
use { 'nvim-treesitter/completion-treesitter' }
|
||||
-- use { 'nvim-treesitter/nvim-treesitter' }
|
||||
-- use { 'nvim-treesitter/completion-treesitter' }
|
||||
--- }}}
|
||||
|
||||
--: rust {{{
|
||||
use {
|
||||
'rust-lang/rust.vim',
|
||||
'mhinz/vim-crates',
|
||||
'cespare/vim-toml',
|
||||
'cespare/vim-toml',
|
||||
}
|
||||
-- }}}
|
||||
use { 'vim-python/python-syntax' }
|
||||
|
||||
@@ -3,7 +3,7 @@ local gl = require('galaxyline')
|
||||
|
||||
local condition = require('galaxyline.condition')
|
||||
-- local diagnostic = require('galaxyline.provider_diagnostic')
|
||||
-- local diagnostics = require('lsp-status.diagnostics')
|
||||
local diagnostic = require('lsp-status.diagnostics')
|
||||
local vcs = require('galaxyline.provider_vcs')
|
||||
local fileinfo = require('galaxyline.provider_fileinfo')
|
||||
-- local extension = require('galaxyline.provider_extensions')
|
||||
@@ -11,7 +11,7 @@ local fileinfo = require('galaxyline.provider_fileinfo')
|
||||
-- local buffer = require('galaxyline.provider_buffer')
|
||||
-- local whitespace = require('galaxyline.provider_whitespace')
|
||||
-- local lspclient = require('galaxyline.provider_lsp')
|
||||
local lspstatus = require('lsp-status')
|
||||
local lsp_status = require('lsp-status')
|
||||
|
||||
|
||||
-- local gls = gl.section
|
||||
@@ -21,6 +21,8 @@ gl.short_line_list = { 'defx' }
|
||||
local colors = {
|
||||
dark_black = '#151515',
|
||||
black = '#181819',
|
||||
|
||||
bg = '#151515', -- same as dark_black
|
||||
bg0 = '#2c2e34',
|
||||
bg1 = '#30323a',
|
||||
bg2 = '#363944',
|
||||
@@ -121,34 +123,68 @@ gls.left[2] = {
|
||||
|
||||
gls.left[3] = {
|
||||
ShowLspStatus = {
|
||||
provider = lspstatus.status,
|
||||
provider = lsp_status.status,
|
||||
highlight = { colors.grey , colors.dark_black, 'bold' }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-- Right Side
|
||||
gls.right[1]= {
|
||||
FileFormat = {
|
||||
provider = function() return ' '..fileinfo.get_file_format()..' ' end,
|
||||
highlight = { colors.purple, colors.bg3 },
|
||||
separator = '',
|
||||
separator_highlight = { colors.bg3, colors.dark_black },
|
||||
-- gls.right[1]= {
|
||||
-- FileFormat = {
|
||||
-- provider = function() return ' '..fileinfo.get_file_format()..' ' end,
|
||||
-- highlight = { colors.purple, colors.bg3 },
|
||||
-- separator = '',
|
||||
-- separator_highlight = { colors.bg3, colors.dark_black },
|
||||
-- }
|
||||
-- }
|
||||
|
||||
|
||||
gls.right[1] = {
|
||||
DiagnosticError = {
|
||||
provider = 'DiagnosticError',
|
||||
icon = ' ',
|
||||
highlight = {colors.red,colors.bg}
|
||||
}
|
||||
}
|
||||
gls.right[2] = {
|
||||
DiagnosticWarn = {
|
||||
provider = 'DiagnosticWarn',
|
||||
icon = ' ',
|
||||
highlight = {colors.yellow,colors.bg},
|
||||
}
|
||||
}
|
||||
|
||||
gls.right[3] = {
|
||||
DiagnosticHint = {
|
||||
provider = 'DiagnosticHint',
|
||||
icon = ' ',
|
||||
highlight = {colors.cyan,colors.bg},
|
||||
}
|
||||
}
|
||||
|
||||
gls.right[4] = {
|
||||
DiagnosticInfo = {
|
||||
provider = 'DiagnosticInfo',
|
||||
icon = ' ',
|
||||
highlight = {colors.blue,colors.bg},
|
||||
}
|
||||
}
|
||||
|
||||
gls.right[5] = {
|
||||
LineInfo = {
|
||||
provider = 'LineColumn',
|
||||
highlight = { colors.grey, colors.bg2 },
|
||||
highlight = { colors.grey , colors.bg3 },
|
||||
separator = '',
|
||||
separator_highlight = { colors.bg2, colors.bg3 },
|
||||
separator_highlight = { colors.bg3, colors.dark_black },
|
||||
},
|
||||
}
|
||||
gls.right[3] = {
|
||||
gls.right[6] = {
|
||||
PerCent = {
|
||||
provider = 'LinePercent',
|
||||
highlight = { colors.blue, colors.bg1 },
|
||||
separator = '',
|
||||
separator_highlight = { colors.bg1 , colors.bg2 },
|
||||
separator_highlight = { colors.bg1 , colors.bg3 },
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user