[update] Update nvim plugins

This commit is contained in:
Uttarayan Mondal
2022-07-09 11:32:27 +05:30
parent d63aad527b
commit cc2d585348
9 changed files with 451 additions and 286 deletions

View File

@@ -59,17 +59,17 @@ vim.g.dashboard_default_executive = 'fzf'
vim.g.python_highlight_all = 1
vim.g.test = {
default = {
default = {
complete_items = { 'lsp', 'snippet' },
mode = 'file',
},
comment = {},
string = { complete_items = { 'path' } },
},
rust = { { complete_items = { 'ts' } } },
}
-- vim.g.test = {
-- default = {
-- default = {
-- complete_items = { 'lsp', 'snippet' },
-- mode = 'file',
-- },
-- comment = {},
-- string = { complete_items = { 'path' } },
-- },
-- rust = { { complete_items = { 'ts' } } },
-- }
vim.o.completeopt = 'menuone,noselect'
@@ -81,36 +81,29 @@ vim.g.coq_settings = {
},
clients = {
lsp = {
weight_adjust = 1
weight_adjust = 2
},
buffers = {
weight_adjust = -0.5
},
snippets = {
weight_adjust = -0.1
}
-- buffers = {
-- -- weight_adjust = -0.5
-- },
-- snippets = {
-- -- weight_adjust = -0.1
-- }
}
}
vim.g.rooter_manual_only = 1
-- vim.g.rooter_manual_only = 1
vim.g.copilot_node_command = "~/.local/share/nvm/v16.0.0/bin/node"
require('plugins')
require('keymaps')
require 'nvim-treesitter.configs'.setup {
ensure_installed = "maintained", -- one of "all", "maintained" (parsers with maintainers), or a list of languages
-- ensure_installed = "all",
ensure_installed = { "c", "rust", "toml", "lua", "json", "python", "cmake", "make", "typescript", "bash", "cpp",
"comment", "css", "fish", "http", "html", "vim", "yaml" },
highlight = {
enable = true, -- false will disable the whole extension
additional_vim_regex_highlighting = false,
},
}
-- require "nvim-treesitter.parsers".get_parser_configs().Solidity = {
-- install_info = {
-- url = "https://github.com/JoranHonig/tree-sitter-solidity",
-- files = {"src/parser.c"},
-- requires_generate_from_grammar = true,
-- },
-- filetype = 'solidity'
-- }

View File

@@ -1,4 +1,4 @@
vim.api.nvim_set_keymap('', '<Space>', '<Nop>', { noremap = true, silent=true})
vim.api.nvim_set_keymap('', '<Space>', '<Nop>', { noremap = true, silent = true })
vim.g.mapleader = " "
vim.g.maplocalleader = " "
@@ -14,15 +14,15 @@ local normal_mode_maps = {
{ key = '<leader>q', map = [[<cmd>bw<cr>]] },
{ key = '<leader>v', map = [[<cmd>CHADopen<cr>]] },
-- fzf
{ key = '<leader>;', map = [[<cmd>Buffers<cr>]] },
{ key = '<leader>ff', map = [[<cmd>Files<cr>]] },
{ key = '<leader>fb', map = [[<cmd>Marks<cr>]] },
{ key = '<leader>fh', map = [[<cmd>History<cr>]] },
{ key = '<leader>fa', map = [[<cmd>History<cr>]] },
-- " Find files using Telescope command-line sugar.
{ key = '<leader>ff', map = [[<cmd>lua require('telescope.builtin').find_files()<cr>]] },
{ key = '<leader>gg', map = [[<cmd>lua require('telescope.builtin').live_grep()<cr>]] },
{ key = '<leader>;', map = [[<cmd>lua require('telescope.builtin').buffers()<cr>]] },
{ key = '<leader>fh', map = [[<cmd>lua require('telescope.builtin').help_tags()<cr>]] },
{ key = '<leader>gB', map = [[<cmd>Git blame<cr>]] },
{ key = '<leader>tc', map = [[<cmd>Colors<cr>]] },
{ key = '<leader>g', map = [[<cmd>Rg<cr>]] },
{ key = '<leader>rd', map = [[<cmd>RustDebuggables<cr>]] },
{ key = '<leader>rr', map = [[<cmd>RustRunnables<cr>]] },
-- Session
{ key = '<leader>ss', map = [[<cmd>SessionSave<cr>]] },
@@ -39,6 +39,7 @@ local normal_mode_maps = {
{ key = 'F', map = [[<cmd>lua vim.lsp.buf.formatting()<cr>]] },
{ key = 'T', map = [[<cmd>lua require'lsp_extensions'.inlay_hints()<cr>]] },
-- { key = '<C-W-%>', map = [[<cmd>vsplit<cr>]] },
-- Other
{ key = '<leader>m', map = [[<cmd>silent !mpcfzf<cr>]] },
@@ -48,32 +49,25 @@ local normal_mode_maps = {
local insert_mode_maps = {
{ key = '<C-j>', map = '<ESC>' },
{ key = "<C-l>", map = 'copilot#Accept("<CR>")', options = { silent = true, expr = true } },
{ key = "<C-m>", map = 'copilot#Accept("<CR>")', options = { silent = true, expr = true } },
}
for idx = 1, #normal_mode_maps do
if normal_mode_maps[idx].options then
local options = normal_mode_maps[idx].options
vim.api.nvim_set_keymap('n', normal_mode_maps[idx].key, normal_mode_maps[idx].map ,options)
vim.api.nvim_set_keymap('n', normal_mode_maps[idx].key, normal_mode_maps[idx].map, options)
else
vim.api.nvim_set_keymap('n', normal_mode_maps[idx].key, normal_mode_maps[idx].map ,options)
vim.api.nvim_set_keymap('n', normal_mode_maps[idx].key, normal_mode_maps[idx].map, options)
end
end
for idx = 1, #insert_mode_maps do
if insert_mode_maps[idx].options then
local options = insert_mode_maps[idx].options
vim.api.nvim_set_keymap('i', insert_mode_maps[idx].key, insert_mode_maps[idx].map ,options)
vim.api.nvim_set_keymap('i', insert_mode_maps[idx].key, insert_mode_maps[idx].map, options)
else
vim.api.nvim_set_keymap('i', insert_mode_maps[idx].key, insert_mode_maps[idx].map ,options)
vim.api.nvim_set_keymap('i', insert_mode_maps[idx].key, insert_mode_maps[idx].map, options)
end
end
-- local ff = {
-- { 'this', 'and this' },
-- { 'that', 'and that' },
-- }
-- print(ff[1][2])

View File

@@ -1,7 +1,7 @@
-- local lspstatus = require('lsp-status')
-- lspstatus.register_progress()
require("lsp.rust-analyzer")
-- require("lsp.rust-analyzer")
require("lsp.lua-language-server")
require("lsp.tsserver")
require("lsp.clangd")
@@ -9,7 +9,7 @@ require("lsp.pyright")
-- 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 CursorHoldI <buffer> lua vim.lsp.buf.document_highlight()]]

View File

@@ -13,7 +13,7 @@ lspconfig.rust_analyzer.setup{
lruCapacity = 64,
assist = {
importGranularity = "module",
importPrefix = "by_self",
importPrefix = "by_crate",
},
procMacro = {
enable = true,
@@ -24,8 +24,19 @@ lspconfig.rust_analyzer.setup{
},
cargo = {
loadOutDirsFromCheck = true,
allFeatures = true,
-- allFeatures = true,
},
completion = {
autoimport = {
enable = true,
}
},
diagnostics = {
disabled = {
"unresolved-macro-call"
}
}
}
},
}

View File

@@ -1,6 +1,7 @@
local vim = vim
local execute = vim.api.nvim_command
local fn = vim.fn
local use = require('packer').use
local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
@@ -13,48 +14,75 @@ end
return require('packer').startup(function()
-- Packer can manage itself
use 'wbthomason/packer.nvim'
use 'christianrondeau/vim-base64'
use {
'NTBBloodbath/galaxyline.nvim', branch = 'main',
config = function() require('statusline') end,
requires = { 'kyazdani42/nvim-web-devicons' }
}
use {
'sainnhe/sonokai',
config = function() require('colorscheme') end,
}
use {
'folke/which-key.nvim',
config = function() require("which-key").setup() end,
}
use { 'sainnhe/sonokai', config = function() require('colorscheme') end }
use { 'folke/which-key.nvim', config = function() require("which-key").setup() end }
use 'yuttie/comfortable-motion.vim'
use 'ruanyl/vim-gh-line'
use { 'nvim-telescope/telescope.nvim', requires = { { 'nvim-lua/plenary.nvim' } } }
use {
'junegunn/fzf',
requires = { 'junegunn/fzf.vim' }
'nvim-telescope/telescope-fzf-native.nvim',
run = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build',
config = function()
require('telescope').setup {
defaults = {
initial_mode = 'insert',
},
extensions = {
fzf = {
fuzzy = true, -- false will only do exact matching
override_generic_sorter = true, -- override the generic sorter
override_file_sorter = true, -- override the file sorter
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
}
}
}
require('telescope').load_extension('fzf')
end,
}
use { 'nvim-telescope/telescope-ui-select.nvim',
config = function()
require("telescope").load_extension("ui-select")
end
}
use {
'tpope/vim-surround',
'tpope/vim-vinegar',
'tpope/vim-repeat',
'tpope/vim-speeddating',
'tpope/vim-commentary',
'tpope/vim-fugitive',
'tpope/vim-repeat',
'tpope/vim-speeddating',
'tpope/vim-surround',
'tpope/vim-vinegar',
}
use { 'norcalli/nvim-colorizer.lua', config = function() require 'colorizer'.setup() end, }
-- lsp
-- use { 'onsails/lspkind-nvim', config = function() require'lspkind'.init() end, }
use { 'folke/lsp-trouble.nvim', config = function() require("trouble").setup() end, }
use {
'folke/trouble.nvim',
config = function()
-- local actions = require("telescope.actions")
require("trouble").setup()
local trouble = require("trouble.providers.telescope")
local telescope = require("telescope")
telescope.setup {
defaults = {
mappings = {
i = { ["<c-t>"] = trouble.open_with_trouble },
n = { ["<c-t>"] = trouble.open_with_trouble },
},
},
}
end, }
use { 'neovim/nvim-lspconfig', config = function() require("lsp") end, }
use { 'williamboman/nvim-lsp-installer' }
@@ -62,91 +90,53 @@ return require('packer').startup(function()
-- use { 'ray-x/cmp-treesitter' }
-- use { 'andersevenrud/cmp-tmux' }
-- use { 'hrsh7th/cmp-vsnip' }
-- use { 'hrsh7th/vim-vsnip' }
-- use { 'hrsh7th/cmp-nvim-lsp' }
-- use { 'hrsh7th/cmp-buffer' }
-- use { 'hrsh7th/cmp-path' }
-- use { 'hrsh7th/cmp-cmdline' }
-- use { 'hrsh7th/nvim-cmp',
-- config = function()
-- local cmp = require("cmp")
-- cmp.setup({
-- snippet = {
-- -- REQUIRED - you must specify a snippet engine
-- expand = function(args)
-- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
-- -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
-- -- require('snippy').expand_snippet(args.body) -- For `snippy` users.
-- -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
-- end,
-- },
-- mapping = {
-- ['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
-- ['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { '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-e>'] = cmp.mapping({
-- i = cmp.mapping.abort(),
-- c = cmp.mapping.close(),
-- }),
-- ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
-- },
-- sources = cmp.config.sources({
-- { name = 'nvim_lsp' },
-- { name = 'vsnip' }, -- For vsnip users.
-- }, {
-- { name = 'buffer' },
-- { name = 'tmux' },
-- { name = 'treesitter' },
-- -- { name = 'snippy' }, -- For snippy users.
-- })
-- })
-- end,
-- }
use { 'ms-jpq/coq_nvim', requires = { 'ms-jpq/coq.artifacts' } }
-- use { 'folke/lsp-colors.nvim',
-- config = function() require("lsp-colors").setup({
-- Error = "#db4b4b",
-- Warning = "#e0af68",
-- Information = "#0db9d7",
-- Hint = "#10B981"
-- }) end,
-- }
-- use 'nvim-lua/lsp_extensions.nvim'
-- config = function() vim.cmd([[autocmd BufEnter,BufWinEnter,TabEnter *.rs :lua require'lsp_extensions'.inlay_hints()]]) end,
--
-- Qol
use 'airblade/vim-rooter'
use { 'sindrets/diffview.nvim', requires = 'nvim-lua/plenary.nvim' }
-- use { 'justinmk/vim-sneak' }
use {
'akinsho/nvim-toggleterm.lua',
'akinsho/toggleterm.nvim',
config = function() require 'setup.toggleterm' end,
}
-- use 'airblade/vim-rooter'
use 'glepnir/dashboard-nvim'
use {
'glepnir/dashboard-nvim',
config = function() require 'setup.dashboard' end,
}
use 'github/copilot.vim'
use {
'nvim-treesitter/nvim-treesitter',
run = ':TSUpdate'
}
use 'samoshkin/vim-mergetool'
use {
-- 'rust-lang/rust.vim',
'mhinz/vim-crates',
-- 'cespare/vim-toml',
'saecki/crates.nvim',
tag = 'v0.2.1',
requires = { 'nvim-lua/plenary.nvim' },
config = function()
require('crates').setup {
src = {
coq = {
enabled = true,
name = "crates.nvim",
},
},
}
end,
}
use { 'simrat39/rust-tools.nvim', config = function() require 'setup.rust-tools' end }
use 'ms-jpq/chadtree'
-- use 'tomlion/vim-solidity'
use 'ellisonleao/glow.nvim'
use { "rcarriga/nvim-dap-ui", requires = { "mfussenegger/nvim-dap" } }
end);

View File

@@ -0,0 +1,28 @@
local home = os.getenv('HOME')
local db = require('dashboard')
db.custom_center = {
{ icon = '',
desc = 'Recently laset session ',
shortcut = 'SPC s l',
action = 'SessionLoad' },
{ icon = '',
desc = 'Recently opened files ',
action = 'DashboardFindHistory',
shortcut = 'SPC f h' },
{ icon = '',
desc = 'Find File ',
action = 'Telescope find_files find_command=rg,--hidden,--files',
shortcut = 'SPC f f' },
{ icon = '',
desc = 'File Browser ',
action = 'Telescope file_browser',
shortcut = 'SPC f b' },
{ icon = '',
desc = 'Find word ',
aciton = 'DashboardFindWord',
shortcut = 'SPC f w' },
{ icon = '',
desc = 'Open Personal dotfiles ',
action = 'Telescope dotfiles path=' .. home .. '/.dotfiles',
shortcut = 'SPC f d' },
}

View File

@@ -1,47 +0,0 @@
-- 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' },
},
}

View File

@@ -0,0 +1,196 @@
-- Update this path
-- local extension_path = vim.env.HOME .. '/.vscode/extensions/vadimcn.vscode-lldb-1.7.0'
-- local codelldb_path = extension_path .. 'adapter/codelldb'
-- local liblldb_path = extension_path .. 'lldb/lib/liblldb.dylib'
local codelldb_path = '/Users/fs0c131y/.vscode/extensions/vadimcn.vscode-lldb-1.6.9/adapter/codelldb'
local liblldb_path = '/Users/fs0c131y/.vscode/extensions/vadimcn.vscode-lldb-1.6.9/lldb/lib/liblldb.dylib'
local opts = {
tools = { -- rust-tools options
-- automatically set inlay hints (type hints)
-- There is an issue due to which the hints are not applied on the first
-- opened file. For now, write to the file to trigger a reapplication of
-- the hints or just run :RustSetInlayHints.
-- default: true
autoSetHints = true,
-- whether to show hover actions inside the hover window
-- this overrides the default hover handler so something like lspsaga.nvim's hover would be overriden by this
-- default: true
hover_with_actions = true,
-- how to execute terminal commands
-- options right now: termopen / quickfix
executor = require("rust-tools/executors").termopen,
-- callback to execute once rust-analyzer is done initializing the workspace
-- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error"
on_initialized = nil,
-- These apply to the default RustSetInlayHints command
inlay_hints = {
-- Only show inlay hints for the current line
only_current_line = false,
-- Event which triggers a refersh of the inlay hints.
-- You can make this "CursorMoved" or "CursorMoved,CursorMovedI" but
-- not that this may cause higher CPU usage.
-- This option is only respected when only_current_line and
-- autoSetHints both are true.
only_current_line_autocmd = "CursorHold",
-- whether to show parameter hints with the inlay hints or not
-- default: true
show_parameter_hints = true,
-- whether to show variable name before type hints with the inlay hints or not
-- default: false
show_variable_name = false,
-- prefix for parameter hints
-- default: "<-"
parameter_hints_prefix = "<- ",
-- prefix for all the other hints (type, chaining)
-- default: "=>"
other_hints_prefix = "=> ",
-- whether to align to the lenght of the longest line in the file
max_len_align = false,
-- padding from the left if max_len_align is true
max_len_align_padding = 1,
-- whether to align to the extreme right or not
right_align = false,
-- padding from the right if right_align is true
right_align_padding = 7,
-- The color of the hints
highlight = "Comment",
},
-- options same as lsp hover / vim.lsp.util.open_floating_preview()
hover_actions = {
-- the border that is used for the hover window
-- see vim.api.nvim_open_win()
border = {
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
},
-- whether the hover action window gets automatically focused
-- default: false
auto_focus = false,
},
-- settings for showing the crate graph based on graphviz and the dot
-- command
crate_graph = {
-- Backend used for displaying the graph
-- see: https://graphviz.org/docs/outputs/
-- default: x11
backend = "x11",
-- where to store the output, nil for no output stored (relative
-- path from pwd)
-- default: nil
output = nil,
-- true for all crates.io and external crates, false only the local
-- crates
-- default: true
full = true,
-- List of backends found on: https://graphviz.org/docs/outputs/
-- Is used for input validation and autocompletion
-- Last updated: 2021-08-26
enabled_graphviz_backends = {
"bmp",
"cgimage",
"canon",
"dot",
"gv",
"xdot",
"xdot1.2",
"xdot1.4",
"eps",
"exr",
"fig",
"gd",
"gd2",
"gif",
"gtk",
"ico",
"cmap",
"ismap",
"imap",
"cmapx",
"imap_np",
"cmapx_np",
"jpg",
"jpeg",
"jpe",
"jp2",
"json",
"json0",
"dot_json",
"xdot_json",
"pdf",
"pic",
"pct",
"pict",
"plain",
"plain-ext",
"png",
"pov",
"ps",
"ps2",
"psd",
"sgi",
"svg",
"svgz",
"tga",
"tiff",
"tif",
"tk",
"vml",
"vmlz",
"wbmp",
"webp",
"xlib",
"x11",
},
},
},
-- all the opts to send to nvim-lspconfig
-- these override the defaults set by rust-tools.nvim
-- see https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#rust_analyzer
server = {
-- standalone file support
-- setting it to false may improve startup time
standalone = true,
}, -- rust-analyer options
-- debugging stuff
dap = {
-- adapter = {
-- type = "executable",
-- command = "lldb-vscode",
-- name = "rt_lldb",
-- },
adapter = require('rust-tools.dap').get_codelldb_adapter(
codelldb_path, liblldb_path)
},
}
-- vim.cmd([[autocmd BufEnter,BufWinEnter,TabEnter *.rs :lua require('rust-tools.inlay_hints').set_inlay_hints()]])
require('rust-tools').setup(opts)