Update neovim dotfiles

This commit is contained in:
Uttarayan Mondal
2021-10-24 20:03:36 +05:30
parent c490689105
commit 3a3b8a2bb0
12 changed files with 324 additions and 90 deletions

View File

@@ -1,7 +1,3 @@
-- local vim = vim
require('plugins')
require('keymaps')
-- Need to replace this once lua api has vim modes -- Need to replace this once lua api has vim modes
vim.api.nvim_exec([[ vim.api.nvim_exec([[
augroup Packer augroup Packer
@@ -21,10 +17,10 @@ augroup end
au BufNewFile,BufRead,BufReadPost *.html.tera set syntax=HTML au BufNewFile,BufRead,BufReadPost *.html.tera set syntax=HTML
]], false) ]], false)
vim.o.number = true vim.o.number = true
vim.o.relativenumber = true vim.o.relativenumber = true
vim.o.timeoutlen = 700 vim.o.timeoutlen = 700
vim.o.guifont='Hasklug Nerd Font Mono,Hack Nerd Font,NotoEmoji Nerd Font' vim.o.guifont='Hasklug Nerd Font Mono,Hack Nerd Font,NotoEmoji Nerd Font:h11'
vim.o.undodir=vim.fn.stdpath('cache')..'/undodir' vim.o.undodir=vim.fn.stdpath('cache')..'/undodir'
vim.o.undofile = true vim.o.undofile = true
@@ -55,7 +51,7 @@ vim.g.python_highlight_all = 1
vim.g.test = { vim.g.test = {
default = { default = {
default = { default = {
complete_items = { 'lsp', 'snippet' }, complete_items = { 'lsp', 'snippet' },
mode = 'file', mode = 'file',
}, },
@@ -66,53 +62,20 @@ vim.g.test = {
} }
-- Temp
vim.o.completeopt = 'menuone,noselect' vim.o.completeopt = 'menuone,noselect'
-- -- luasnip setup vim.g.coq_settings = {
-- local luasnip = require 'luasnip' auto_start = 'shut-up'
}
require('plugins')
require('keymaps')
require'nvim-treesitter.configs'.setup {
ensure_installed = "maintained", -- one of "all", "maintained" (parsers with maintainers), or a list of languages
highlight = {
enable = true, -- false will disable the whole extension
additional_vim_regex_highlighting = false,
},
}
-- -- 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' },
-- },
-- }

View File

@@ -12,6 +12,7 @@ local normal_mode_maps = {
{ key = '<leader>n', map = [[<cmd>bnext<cr>]] }, { key = '<leader>n', map = [[<cmd>bnext<cr>]] },
{ key = '<leader>p', map = [[<cmd>bprev<cr>]] }, { key = '<leader>p', map = [[<cmd>bprev<cr>]] },
{ key = '<leader>q', map = [[<cmd>bw<cr>]] }, { key = '<leader>q', map = [[<cmd>bw<cr>]] },
{ key = '<leader>v', map = [[<cmd>CHADopen<cr>]] },
-- fzf -- fzf
{ key = '<leader>;', map = [[<cmd>Buffers<cr>]] }, { key = '<leader>;', map = [[<cmd>Buffers<cr>]] },

View File

@@ -0,0 +1,9 @@
local lspconfig = require'lspconfig'
local lspstatus = require'lsp-status'
local coq = require'coq'
lspconfig.denols.setup{
on_attach=function(client) lspstatus.on_attach(client) return end,
capabilities = coq.lsp_ensure_capabilities(lspstatus.capabilities),
}

View File

@@ -3,9 +3,10 @@
require("lsp.rust-analyzer") require("lsp.rust-analyzer")
require("lsp.lua-language-server") require("lsp.lua-language-server")
-- require("lsp.pyls") require("lsp.deno")
-- Set completeopt to have a better completion experience -- Set completeopt to have a better completion experience
-- vim.o.completeopt= "menuone,noinsert,noselect"
vim.o.completeopt= "menuone,noselect" vim.o.completeopt= "menuone,noselect"
-- 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()]]

View File

@@ -1,18 +1,23 @@
local lspconfig = require'lspconfig' local lspconfig = require'lspconfig'
-- local lspstatus = require('lsp-status') local lspstatus = require('lsp-status')
local coq = require'coq'
require'lspconfig'.sumneko_lua.setup{ lspconfig.sumneko_lua.setup{
cmd = { "lua-language-server" }, cmd = { "lua-language-server" },
on_attach=function(client) require'completion'.on_attach(client) require'lsp-status'.on_attach(client) return end, on_attach=function(client) lspstatus.on_attach(client) return end,
-- on_attach=require'completion'.on_attach, capabilities = coq.lsp_ensure_capabilities(lspstatus.capabilities),
filetypes = { "lua" }, filetypes = { "lua" },
log_level = 2, log_level = 2,
root_dir = lspconfig.util.root_pattern(".git"),
settings = { settings = {
Lua = { Lua = {
diagnostics = {
globals = {'vim'},
},
telemetry = { telemetry = {
enable = false enable = false,
} }
} }
} }
} }
-- lspconfig.sumenko_lua.setup(coq.lsp_ensure_capabilities())
-- require'lspconfig'.sumneko_lua.setup{coq.lsp_ensure_capabilities()}

View File

@@ -1,6 +1,8 @@
local lspconfig = require'lspconfig' local lspconfig = require'lspconfig'
lspconfig.pyls.setup{ lspconfig.pyls.setup{
cmd = { "pyls" }, coq.lsp_ensure_capabilities{
filetypes = { "python" }, cmd = { "pyls" },
filetypes = { "python" },
}
} }

View File

@@ -1,15 +1,17 @@
local lspconfig = require'lspconfig' local lspconfig = require'lspconfig'
local lspstatus = require'lsp-status'
local coq = require'coq'
lspconfig.rust_analyzer.setup{ lspconfig.rust_analyzer.setup{
on_attach=function(client) require'lsp-status'.on_attach(client) return end, on_attach=function(client) lspstatus.on_attach(client) return end,
capabilities = require'lsp-status'.capabilities, capabilities = coq.lsp_ensure_capabilities(lspstatus.capabilities),
cmd = { "rust-analyzer" }, cmd = { "rust-analyzer" },
filetypes = { "rust" }, filetypes = { "rust" },
root_dir = lspconfig.util.root_pattern("Cargo.toml"), root_dir = lspconfig.util.root_pattern("Cargo.toml"),
settings = { settings = {
["rust-analyzer"] = { ["rust-analyzer"] = {
assist = { lruCapacity = 64,
assist = {
importGranularity = "module", importGranularity = "module",
importPrefix = "by_self", importPrefix = "by_self",
}, },
@@ -25,9 +27,6 @@ lspconfig.rust_analyzer.setup{
allFeatures = true, allFeatures = true,
} }
} }
} },
} }
lspconfig.rust_analyzer.setup{
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
}

View File

@@ -54,15 +54,11 @@ return require('packer').startup(function()
use { 'folke/lsp-trouble.nvim', config = function() require("trouble").setup() end, } use { 'folke/lsp-trouble.nvim', config = function() require("trouble").setup() end, }
use { 'neovim/nvim-lspconfig', config = function() require("lsp") end, } use { 'neovim/nvim-lspconfig', config = function() require("lsp") end, }
use { 'williamboman/nvim-lsp-installer' }
use { 'nvim-lua/lsp-status.nvim' } use { 'nvim-lua/lsp-status.nvim' }
use { 'ms-jpq/coq_nvim', requires = { 'ms-jpq/coq.artifacts' } }
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 { 'folke/lsp-colors.nvim' }
use { 'nvim-lua/lsp_extensions.nvim' } use { 'nvim-lua/lsp_extensions.nvim' }
-- config = function() vim.cmd([[autocmd BufEnter,BufWinEnter,TabEnter *.rs :lua require'lsp_extensions'.inlay_hints()]]) end, -- config = function() vim.cmd([[autocmd BufEnter,BufWinEnter,TabEnter *.rs :lua require'lsp_extensions'.inlay_hints()]]) end,
@@ -75,13 +71,16 @@ return require('packer').startup(function()
config = function() require'setup.toggleterm' end, config = function() require'setup.toggleterm' end,
} }
use { 'airblade/vim-rooter' } -- use { 'airblade/vim-rooter' }
use { 'glepnir/dashboard-nvim' } use { 'glepnir/dashboard-nvim' }
-- Treesitter {{{ -- Treesitter {{{
-- use { 'nvim-treesitter/nvim-treesitter' } use {
-- use { 'nvim-treesitter/completion-treesitter' } 'nvim-treesitter/nvim-treesitter',
--- }}} run = ':TSUpdate'
}
-- }}}
--: rust {{{ --: rust {{{
use { use {
@@ -91,4 +90,7 @@ return require('packer').startup(function()
} }
-- }}} -- }}}
use { 'vim-python/python-syntax' } use { 'vim-python/python-syntax' }
use { 'ms-jpq/chadtree' }
end) end)

View File

@@ -17,7 +17,6 @@ require("toggleterm").setup{
-- see :h nvim_win_open for details on borders however -- see :h nvim_win_open for details on borders however
-- the 'curved' border is a custom border type -- the 'curved' border is a custom border type
-- not natively supported but implemented in this plugin. -- not natively supported but implemented in this plugin.
-- border = 'single' | 'double' | 'shadow' | 'curved' | ... other options supported by win open -- border = 'single' | 'double' | 'shadow' | 'curved' | ... other options supported by win open
border = 'single', border = 'single',
width = 30, width = 30,

View File

@@ -121,12 +121,12 @@ gls.left[2] = {
} }
} }
gls.left[3] = { -- gls.left[3] = {
ShowLspStatus = { -- ShowLspStatus = {
provider = lsp_status.status, -- provider = lsp_status.status,
highlight = { colors.grey , colors.dark_black, 'bold' } -- highlight = { colors.grey , colors.dark_black, 'bold' }
} -- }
} -- }
-- Right Side -- Right Side

View File

@@ -0,0 +1,253 @@
-- Automatically generated packer.nvim plugin loader code
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
return
end
vim.api.nvim_command('packadd packer.nvim')
local no_errors, error_msg = pcall(function()
local time
local profile_info
local should_profile = false
if should_profile then
local hrtime = vim.loop.hrtime
profile_info = {}
time = function(chunk, start)
if start then
profile_info[chunk] = hrtime()
else
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
end
end
else
time = function(chunk, start) end
end
local function save_profiles(threshold)
local sorted_times = {}
for chunk_name, time_taken in pairs(profile_info) do
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
end
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
local results = {}
for i, elem in ipairs(sorted_times) do
if not threshold or threshold and elem[2] > threshold then
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
end
end
_G._packer = _G._packer or {}
_G._packer.profile_output = results
end
time([[Luarocks path setup]], true)
local package_path_str = "/home/savy/.cache/nvim/packer_hererocks/2.0.5/share/lua/5.1/?.lua;/home/savy/.cache/nvim/packer_hererocks/2.0.5/share/lua/5.1/?/init.lua;/home/savy/.cache/nvim/packer_hererocks/2.0.5/lib/luarocks/rocks-5.1/?.lua;/home/savy/.cache/nvim/packer_hererocks/2.0.5/lib/luarocks/rocks-5.1/?/init.lua"
local install_cpath_pattern = "/home/savy/.cache/nvim/packer_hererocks/2.0.5/lib/lua/5.1/?.so"
if not string.find(package.path, package_path_str, 1, true) then
package.path = package.path .. ';' .. package_path_str
end
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
package.cpath = package.cpath .. ';' .. install_cpath_pattern
end
time([[Luarocks path setup]], false)
time([[try_loadstring definition]], true)
local function try_loadstring(s, component, name)
local success, result = pcall(loadstring(s))
if not success then
vim.schedule(function()
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
end)
end
return result
end
time([[try_loadstring definition]], false)
time([[Defining packer_plugins]], true)
_G.packer_plugins = {
chadtree = {
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/chadtree"
},
["comfortable-motion.vim"] = {
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/comfortable-motion.vim"
},
["coq.artifacts"] = {
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/coq.artifacts"
},
coq_nvim = {
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/coq_nvim"
},
["dashboard-nvim"] = {
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/dashboard-nvim"
},
["diffview.nvim"] = {
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/diffview.nvim"
},
fzf = {
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/fzf"
},
["fzf.vim"] = {
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/fzf.vim"
},
["galaxyline.nvim"] = {
config = { "\27LJ\1\2*\0\0\2\0\2\0\0044\0\0\0%\1\1\0>\0\2\1G\0\1\0\15statusline\frequire\0" },
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/galaxyline.nvim"
},
["lsp-colors.nvim"] = {
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/lsp-colors.nvim"
},
["lsp-status.nvim"] = {
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/lsp-status.nvim"
},
["lsp-trouble.nvim"] = {
config = { "\27LJ\1\0025\0\0\2\0\3\0\0064\0\0\0%\1\1\0>\0\2\0027\0\2\0>\0\1\1G\0\1\0\nsetup\ftrouble\frequire\0" },
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/lsp-trouble.nvim"
},
["lsp_extensions.nvim"] = {
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/lsp_extensions.nvim"
},
["lspkind-nvim"] = {
config = { "\27LJ\1\0024\0\0\2\0\3\0\0064\0\0\0%\1\1\0>\0\2\0027\0\2\0>\0\1\1G\0\1\0\tinit\flspkind\frequire\0" },
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/lspkind-nvim"
},
["nvim-colorizer.lua"] = {
config = { "\27LJ\1\0027\0\0\2\0\3\0\0064\0\0\0%\1\1\0>\0\2\0027\0\2\0>\0\1\1G\0\1\0\nsetup\14colorizer\frequire\0" },
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/nvim-colorizer.lua"
},
["nvim-lsp-installer"] = {
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/nvim-lsp-installer"
},
["nvim-lspconfig"] = {
config = { "\27LJ\1\2#\0\0\2\0\2\0\0044\0\0\0%\1\1\0>\0\2\1G\0\1\0\blsp\frequire\0" },
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/nvim-lspconfig"
},
["nvim-toggleterm.lua"] = {
config = { "\27LJ\1\0020\0\0\2\0\2\0\0044\0\0\0%\1\1\0>\0\2\1G\0\1\0\21setup.toggleterm\frequire\0" },
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/nvim-toggleterm.lua"
},
["nvim-treesitter"] = {
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/nvim-treesitter"
},
["nvim-web-devicons"] = {
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/nvim-web-devicons"
},
["packer.nvim"] = {
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/packer.nvim"
},
["python-syntax"] = {
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/python-syntax"
},
["rust.vim"] = {
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/rust.vim"
},
sonokai = {
config = { "\27LJ\1\2+\0\0\2\0\2\0\0044\0\0\0%\1\1\0>\0\2\1G\0\1\0\16colorscheme\frequire\0" },
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/sonokai"
},
["vim-commentary"] = {
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/vim-commentary"
},
["vim-crates"] = {
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/vim-crates"
},
["vim-fugitive"] = {
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/vim-fugitive"
},
["vim-repeat"] = {
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/vim-repeat"
},
["vim-speeddating"] = {
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/vim-speeddating"
},
["vim-surround"] = {
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/vim-surround"
},
["vim-toml"] = {
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/vim-toml"
},
["vim-vinegar"] = {
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/vim-vinegar"
},
["which-key.nvim"] = {
config = { "\27LJ\1\0027\0\0\2\0\3\0\0064\0\0\0%\1\1\0>\0\2\0027\0\2\0>\0\1\1G\0\1\0\nsetup\14which-key\frequire\0" },
loaded = true,
path = "/home/savy/.local/share/nvim/site/pack/packer/start/which-key.nvim"
}
}
time([[Defining packer_plugins]], false)
-- Config for: lspkind-nvim
time([[Config for lspkind-nvim]], true)
try_loadstring("\27LJ\1\0024\0\0\2\0\3\0\0064\0\0\0%\1\1\0>\0\2\0027\0\2\0>\0\1\1G\0\1\0\tinit\flspkind\frequire\0", "config", "lspkind-nvim")
time([[Config for lspkind-nvim]], false)
-- Config for: nvim-lspconfig
time([[Config for nvim-lspconfig]], true)
try_loadstring("\27LJ\1\2#\0\0\2\0\2\0\0044\0\0\0%\1\1\0>\0\2\1G\0\1\0\blsp\frequire\0", "config", "nvim-lspconfig")
time([[Config for nvim-lspconfig]], false)
-- Config for: nvim-colorizer.lua
time([[Config for nvim-colorizer.lua]], true)
try_loadstring("\27LJ\1\0027\0\0\2\0\3\0\0064\0\0\0%\1\1\0>\0\2\0027\0\2\0>\0\1\1G\0\1\0\nsetup\14colorizer\frequire\0", "config", "nvim-colorizer.lua")
time([[Config for nvim-colorizer.lua]], false)
-- Config for: which-key.nvim
time([[Config for which-key.nvim]], true)
try_loadstring("\27LJ\1\0027\0\0\2\0\3\0\0064\0\0\0%\1\1\0>\0\2\0027\0\2\0>\0\1\1G\0\1\0\nsetup\14which-key\frequire\0", "config", "which-key.nvim")
time([[Config for which-key.nvim]], false)
-- Config for: galaxyline.nvim
time([[Config for galaxyline.nvim]], true)
try_loadstring("\27LJ\1\2*\0\0\2\0\2\0\0044\0\0\0%\1\1\0>\0\2\1G\0\1\0\15statusline\frequire\0", "config", "galaxyline.nvim")
time([[Config for galaxyline.nvim]], false)
-- Config for: nvim-toggleterm.lua
time([[Config for nvim-toggleterm.lua]], true)
try_loadstring("\27LJ\1\0020\0\0\2\0\2\0\0044\0\0\0%\1\1\0>\0\2\1G\0\1\0\21setup.toggleterm\frequire\0", "config", "nvim-toggleterm.lua")
time([[Config for nvim-toggleterm.lua]], false)
-- Config for: lsp-trouble.nvim
time([[Config for lsp-trouble.nvim]], true)
try_loadstring("\27LJ\1\0025\0\0\2\0\3\0\0064\0\0\0%\1\1\0>\0\2\0027\0\2\0>\0\1\1G\0\1\0\nsetup\ftrouble\frequire\0", "config", "lsp-trouble.nvim")
time([[Config for lsp-trouble.nvim]], false)
-- Config for: sonokai
time([[Config for sonokai]], true)
try_loadstring("\27LJ\1\2+\0\0\2\0\2\0\0044\0\0\0%\1\1\0>\0\2\1G\0\1\0\16colorscheme\frequire\0", "config", "sonokai")
time([[Config for sonokai]], false)
if should_profile then save_profiles() end
end)
if not no_errors then
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
end