|
@@ -3,20 +3,31 @@ filetype plugin indent on
|
|
|
|
|
|
" Plugins
|
|
|
call plug#begin('~/.vim/plugged')
|
|
|
- Plug 'chriskempson/base16-vim'
|
|
|
- Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} " We recommend updating the parsers on update
|
|
|
+
|
|
|
+ Plug 'neovim/nvim-lspconfig'
|
|
|
+
|
|
|
Plug 'neovim/nvim-lspconfig'
|
|
|
- Plug 'nvim-lua/completion-nvim'
|
|
|
+ Plug 'hrsh7th/cmp-nvim-lsp'
|
|
|
+ Plug 'hrsh7th/cmp-buffer'
|
|
|
+ Plug 'hrsh7th/cmp-path'
|
|
|
+ Plug 'hrsh7th/cmp-cmdline'
|
|
|
+ Plug 'hrsh7th/nvim-cmp'
|
|
|
+
|
|
|
+ " For vsnip users.
|
|
|
+ Plug 'hrsh7th/cmp-vsnip'
|
|
|
+ Plug 'hrsh7th/vim-vsnip'
|
|
|
+
|
|
|
+ Plug 'chriskempson/base16-vim'
|
|
|
+ Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} " We recommend updating the parsers on update
|
|
|
Plug 'kaicataldo/material.vim', { 'branch': 'main' }
|
|
|
Plug 'nvim-lua/popup.nvim'
|
|
|
Plug 'nvim-lua/plenary.nvim'
|
|
|
Plug 'nvim-telescope/telescope.nvim'
|
|
|
- Plug 'neovim/nvim-lspconfig'
|
|
|
- Plug 'simrat39/rust-tools.nvim'
|
|
|
- Plug 'mfussenegger/nvim-dap'
|
|
|
Plug 'itchyny/lightline.vim'
|
|
|
Plug 'joshdick/onedark.vim'
|
|
|
|
|
|
+ Plug 'rust-lang/rust.vim'
|
|
|
+
|
|
|
|
|
|
call plug#end()
|
|
|
|
|
@@ -28,7 +39,7 @@ set updatetime=50
|
|
|
set tabstop=4 softtabstop=4
|
|
|
set expandtab
|
|
|
set smartindent
|
|
|
-set completeopt=menuone,noinsert,noselect
|
|
|
+set completeopt=menu,menuone,noselect
|
|
|
set noswapfile
|
|
|
set nobackup
|
|
|
set scrolloff=8
|
|
@@ -50,27 +61,14 @@ colorscheme material
|
|
|
|
|
|
|
|
|
" Lsp configuration for multiple languages
|
|
|
-lua require'lspconfig'.bashls.setup{}
|
|
|
-lua require'lspconfig'.jsonls.setup{}
|
|
|
-lua require'lspconfig'.gopls.setup{ on_attach=require'completion'.on_attach }
|
|
|
-lua require'lspconfig'.clangd.setup{ on_attach=require'completion'.on_attach }
|
|
|
-lua require('rust-tools').setup({})
|
|
|
|
|
|
|
|
|
-" auto complete matching strategy
|
|
|
-let g:completion_matching_strategy_list = ['exact', 'substring', 'fuzzy']
|
|
|
-
|
|
|
" Use <Tab> and <S-Tab> to navigate through popup menu
|
|
|
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
|
|
|
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
|
|
|
|
|
|
-
|
|
|
-" Avoid showing message extra message when using completion
|
|
|
-set shortmess+=c
|
|
|
-
|
|
|
-
|
|
|
" Tree-sitter config
|
|
|
-lua require'nvim-treesitter.configs'.setup { highlight = { enable = true } }
|
|
|
+lua require'nvim-treesitter.configs'.setup { highlight = { enable = true }, incremental_selection = { enable = true }, textobjects = { enable = true }}
|
|
|
|
|
|
" keyboard shortcut options
|
|
|
let mapleader = " "
|
|
@@ -82,3 +80,75 @@ nnoremap <leader>ff <cmd>Telescope find_files<cr>
|
|
|
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
|
|
|
nnoremap <leader>fb <cmd>Telescope buffers<cr>
|
|
|
nnoremap <leader>fh <cmd>Telescope help_tags<cr>
|
|
|
+
|
|
|
+
|
|
|
+" nvim-cmp configurations
|
|
|
+
|
|
|
+lua <<EOF
|
|
|
+ -- Setup nvim-cmp.
|
|
|
+ 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.
|
|
|
+ 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 }),
|
|
|
+ },
|
|
|
+ sources = cmp.config.sources({
|
|
|
+ { name = 'nvim_lsp' },
|
|
|
+ { name = 'vsnip' }, -- For vsnip users.
|
|
|
+ }, {
|
|
|
+ { name = 'buffer' },
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+ -- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
|
|
+ cmp.setup.cmdline('/', {
|
|
|
+ sources = {
|
|
|
+ { name = 'buffer' }
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
|
|
+ cmp.setup.cmdline(':', {
|
|
|
+ sources = cmp.config.sources({
|
|
|
+ { name = 'path' }
|
|
|
+ }, {
|
|
|
+ { name = 'cmdline' }
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+ -- Setup lspconfig.
|
|
|
+ local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
|
|
+ -- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
|
|
|
+
|
|
|
+ local function config(_config)
|
|
|
+ return vim.tbl_deep_extend("force", {
|
|
|
+ capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()),
|
|
|
+ }, _config or {})
|
|
|
+ end
|
|
|
+
|
|
|
+ require('lspconfig')['gopls'].setup {config()}
|
|
|
+ require('lspconfig')['rust_analyzer'].setup {config()}
|
|
|
+ require('lspconfig')['bashls'].setup{config()}
|
|
|
+ require('lspconfig')['jsonls'].setup{config()}
|
|
|
+ require('lspconfig')['clangd'].setup{config()}
|
|
|
+
|
|
|
+ require('lspconfig')['jedi_language_server'].setup{config()}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+EOF
|
|
|
+
|