aboutsummaryrefslogtreecommitdiff
path: root/nvim
diff options
context:
space:
mode:
authorKumar Damani <me@kumardamani.net>2022-07-14 16:49:34 +0000
committerKumar Damani <me@kumardamani.net>2022-07-14 16:49:34 +0000
commit048e43aceeabb7a54bf6115ab0a63cc1ff5b3cab (patch)
tree4742c515412c7abe5d3d7e0992c91a604ae7c30d /nvim
parent81f34273a997b7a319598b2622ac15530d8dc534 (diff)
nvim switch to native lsp conf
Diffstat (limited to 'nvim')
-rw-r--r--nvim/.config/nvim/coc-settings.json16
-rw-r--r--nvim/.config/nvim/coc.vim163
-rw-r--r--nvim/.config/nvim/init.vim327
-rw-r--r--nvim/.config/nvim/lua/kdam0/autopairs.lua3
-rw-r--r--nvim/.config/nvim/lua/kdam0/commenter.lua13
-rw-r--r--nvim/.config/nvim/lua/kdam0/init.lua6
-rw-r--r--nvim/.config/nvim/lua/kdam0/lspconfig.lua104
-rw-r--r--nvim/.config/nvim/lua/kdam0/neogen.lua10
-rw-r--r--nvim/.config/nvim/lua/kdam0/telescope.lua40
-rw-r--r--nvim/.config/nvim/lua/kdam0/treesitter.lua10
10 files changed, 306 insertions, 386 deletions
diff --git a/nvim/.config/nvim/coc-settings.json b/nvim/.config/nvim/coc-settings.json
deleted file mode 100644
index 4361d90..0000000
--- a/nvim/.config/nvim/coc-settings.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "ansible.builtin.ansibleVersion": "2.9.20",
- "ansible.builtin.ansibleLintVersion": "5.1.3",
- "ansible.builtin.isWithYamllint": true,
- "ansible.ansible.useFullyQualifiedCollectionNames": false,
- "ansible.ansibleLint.enabled": true,
- "snippets.snipmate.enable": false,
- "pylsp.plugins.pycodestyle.enabled": false,
- "pylsp.plugins.pyflakes.enabled": false,
- "pylsp.plugins.pylint.enabled": true,
- "pylsp.plugins.pylint.args": ["--rcfile=/home/kdam0/kepler/kepler/python/kepler/.pylintrc"],
- "pylsp.builtin.enableInstallPylspMypy": true,
- "pylsp.builtin.pylspMypyVersion": "0.961",
- "pylsp.plugins.pydocstyle.enabled": true,
- "pydocstring.enable": true
-}
diff --git a/nvim/.config/nvim/coc.vim b/nvim/.config/nvim/coc.vim
deleted file mode 100644
index 35ba921..0000000
--- a/nvim/.config/nvim/coc.vim
+++ /dev/null
@@ -1,163 +0,0 @@
-" Set internal encoding of vim, not needed on neovim, since coc.nvim using some
-" unicode characters in the file autoload/float.vim
-set encoding=utf-8
-
-" TextEdit might fail if hidden is not set.
-set hidden
-
-" Some servers have issues with backup files, see #649.
-set nobackup
-set nowritebackup
-
-" Give more space for displaying messages.
-set cmdheight=2
-
-" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
-" delays and poor user experience.
-set updatetime=300
-
-" Don't pass messages to |ins-completion-menu|.
-set shortmess+=c
-
-" Always show the signcolumn, otherwise it would shift the text each time
-" diagnostics appear/become resolved.
-if has("nvim-0.5.0") || has("patch-8.1.1564")
- " Recently vim can merge signcolumn and number column into one
- set signcolumn=number
-else
- set signcolumn=yes
-endif
-
-" Use tab for trigger completion with characters ahead and navigate.
-" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
-" other plugin before putting this into your config.
-inoremap <silent><expr> <TAB>
- \ pumvisible() ? "\<C-n>" :
- \ <SID>check_back_space() ? "\<TAB>" :
- \ coc#refresh()
-inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
-
-function! s:check_back_space() abort
- let col = col('.') - 1
- return !col || getline('.')[col - 1] =~# '\s'
-endfunction
-
-" Use <c-space> to trigger completion.
-if has('nvim')
- inoremap <silent><expr> <c-space> coc#refresh()
-else
- inoremap <silent><expr> <c-@> coc#refresh()
-endif
-
-" Make <CR> auto-select the first completion item and notify coc.nvim to
-" format on enter, <cr> could be remapped by other vim plugin
-inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
- \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
-
-" Use `[g` and `]g` to navigate diagnostics
-" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
-nmap <silent> [g <Plug>(coc-diagnostic-prev)
-nmap <silent> ]g <Plug>(coc-diagnostic-next)
-
-" GoTo code navigation.
-nmap <silent> gd <Plug>(coc-definition)
-nmap <silent> gy <Plug>(coc-type-definition)
-nmap <silent> gi <Plug>(coc-implementation)
-nmap <silent> gr <Plug>(coc-references)
-
-" Use K to show documentation in preview window.
-nnoremap <silent> K :call <SID>show_documentation()<CR>
-
-function! s:show_documentation()
- if (index(['vim','help'], &filetype) >= 0)
- execute 'h '.expand('<cword>')
- elseif (coc#rpc#ready())
- call CocActionAsync('doHover')
- else
- execute '!' . &keywordprg . " " . expand('<cword>')
- endif
-endfunction
-
-" Highlight the symbol and its references when holding the cursor.
-autocmd CursorHold * silent call CocActionAsync('highlight')
-
-" Symbol renaming.
-nmap <leader>rn <Plug>(coc-rename)
-
-augroup mygroup
- autocmd!
- " Setup formatexpr specified filetype(s).
- autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
- " Update signature help on jump placeholder.
- autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
-augroup end
-
-" Applying codeAction to the selected region.
-" Example: `<leader>aap` for current paragraph
-xmap <leader>a <Plug>(coc-codeaction-selected)
-nmap <leader>a <Plug>(coc-codeaction-selected)
-
-" Remap keys for applying codeAction to the current buffer.
-nmap <leader>ac <Plug>(coc-codeaction)
-" Apply AutoFix to problem on the current line.
-nmap <leader>qf <Plug>(coc-fix-current)
-
-" Map function and class text objects
-" NOTE: Requires 'textDocument.documentSymbol' support from the language server.
-xmap if <Plug>(coc-funcobj-i)
-omap if <Plug>(coc-funcobj-i)
-xmap af <Plug>(coc-funcobj-a)
-omap af <Plug>(coc-funcobj-a)
-xmap ic <Plug>(coc-classobj-i)
-omap ic <Plug>(coc-classobj-i)
-xmap ac <Plug>(coc-classobj-a)
-omap ac <Plug>(coc-classobj-a)
-
-" Remap <C-f> and <C-b> for scroll float windows/popups.
-if has('nvim-0.4.0') || has('patch-8.2.0750')
- nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
- nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
- inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
- inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
- vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
- vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
-endif
-
-" Use CTRL-S for selections ranges.
-" Requires 'textDocument/selectionRange' support of language server.
-nmap <silent> <C-s> <Plug>(coc-range-select)
-xmap <silent> <C-s> <Plug>(coc-range-select)
-
-" Add `:Format` command to format current buffer.
-command! -nargs=0 Format :call CocAction('format')
-
-" Add `:Fold` command to fold current buffer.
-command! -nargs=? Fold :call CocAction('fold', <f-args>)
-
-" Add `:OR` command for organize imports of the current buffer.
-command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
-
-" Add (Neo)Vim's native statusline support.
-" NOTE: Please see `:h coc-status` for integrations with external plugins that
-" provide custom statusline: lightline.vim, vim-airline.
-set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
-
-" Mappings for CoCList
-" Show all diagnostics.
-nnoremap <silent><nowait> <space>a :<C-u>CocList diagnostics<cr>
-" Manage extensions.
-nnoremap <silent><nowait> <space>e :<C-u>CocList extensions<cr>
-" Show commands.
-nnoremap <silent><nowait> <space>c :<C-u>CocList commands<cr>
-" Find symbol of current document.
-nnoremap <silent><nowait> <space>o :<C-u>CocList outline<cr>
-" Search workspace symbols.
-nnoremap <silent><nowait> <space>s :<C-u>CocList -I symbols<cr>
-" Do default action for next item.
-nnoremap <silent><nowait> <space>j :<C-u>CocNext<CR>
-" Do default action for previous item.
-nnoremap <silent><nowait> <space>k :<C-u>CocPrev<CR>
-" Resume latest coc list.
-nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR>
-
-
diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim
index 32adf25..3ef11bf 100644
--- a/nvim/.config/nvim/init.vim
+++ b/nvim/.config/nvim/init.vim
@@ -1,3 +1,37 @@
+" --- General
+
+let mapleader = ","
+
+set termguicolors
+set tabstop=4
+set softtabstop=4
+set shiftwidth=4
+set expandtab
+set smartindent
+set number
+set numberwidth=1
+set relativenumber
+set signcolumn=yes
+set noswapfile
+set nobackup
+set undodir=~/.config/nvim/undodir
+set undofile
+set incsearch
+set nohlsearch
+set ignorecase
+set smartcase
+set nowrap
+set splitbelow
+set splitright
+set hidden
+set scrolloff=999
+set noshowmode
+set updatetime=250
+set encoding=UTF-8
+set pastetoggle=<Leader>v
+set showbreak=↪\
+set listchars=tab:→\ ,eol:↲,nbsp:␣,trail:•,extends:⟩,precedes:⟨
+
" auto-install vim-plug
if empty(glob('~/.config/nvim/autoload/plug.vim'))
silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs
@@ -5,221 +39,100 @@ if empty(glob('~/.config/nvim/autoload/plug.vim'))
autocmd VimEnter * PlugInstall
endif
+" --- Plugins
call plug#begin('~/.config/nvim/autoload/plugged')
- Plug 'morhetz/gruvbox'
- Plug 'SirVer/ultisnips'
- Plug 'honza/vim-snippets'
- Plug 'phenomenes/ansible-snippets'
- Plug 'roxma/nvim-yarp'
- Plug '/usr/bin/fzf'
- Plug 'junegunn/fzf'
- Plug 'junegunn/fzf.vim'
- Plug 'itchyny/lightline.vim'
- Plug 'airblade/vim-gitgutter'
- Plug 'raimondi/delimitmate'
- Plug 'luochen1990/rainbow'
- Plug 'sheerun/vim-polyglot'
- Plug 'tpope/vim-surround'
- Plug 'mcchrish/nnn.vim'
- Plug 'brainfucksec/wal.vim'
- Plug 'pearofducks/ansible-vim'
- Plug 'tpope/vim-repeat'
- Plug 'neoclide/coc.nvim', {'branch': 'release'}
- "Plug 'lukas-reineke/indent-blankline.nvim'
+" General
+Plug 'folke/tokyonight.nvim', { 'branch': 'main' }
+Plug 'mcchrish/nnn.vim'
+Plug 'lukas-reineke/indent-blankline.nvim'
+
+" Lsp
+Plug 'neovim/nvim-lspconfig'
+Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
+" Lsp w/ Autocompletion
+Plug 'hrsh7th/cmp-nvim-lsp'
+Plug 'hrsh7th/cmp-buffer'
+Plug 'hrsh7th/cmp-path'
+Plug 'hrsh7th/nvim-cmp'
+Plug 'L3MON4D3/LuaSnip'
+Plug 'saadparwaiz1/cmp_luasnip'
+" Per-Project LSP settings.
+Plug 'tamago324/nlsp-settings.nvim'
+" Lsp w/ Snippets
+Plug 'rafamadriz/friendly-snippets'
+" Docs
+Plug 'danymat/neogen'
+Plug 'numToStr/Comment.nvim'
+" Lsp w/ auto pairs
+Plug 'windwp/nvim-autopairs'
+
+" Telescope
+Plug 'nvim-lua/plenary.nvim'
+Plug 'nvim-telescope/telescope.nvim'
+Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'make' }
call plug#end()
-" Some basics:
- set background=dark
- filetype plugin on
- syntax on
- " colorscheme koehler
- " colorscheme desert
- " colorscheme peachpuff
- " colorscheme slate
- " colorscheme zellner
- " colorscheme wal
- colorscheme gruvbox
- " highlight Normal ctermbg=NONE guibg=NONE
- " highlight NonText ctermfg=yellow guifg=yellow
- set noswapfile
- set encoding=utf-8
- " set number
- " set relativenumber
- "set cursorline
- let mapleader = ","
- set pastetoggle=<leader>v
- nmap <leader>, :w<cr>
-
-" Tab settings
- set tabstop=4
- set shiftwidth=4
- set expandtab
- autocmd Filetype css setlocal tabstop=2
- autocmd FileType yml setlocal ai ts=2 sw=2 et
- autocmd FileType yml setlocal ai ts=2 sw=2 et
- autocmd FileType yaml setlocal ai ts=2 sw=2 et
- autocmd FileType jinja setlocal ai ts=2 sw=2 et
- autocmd FileType python setlocal ai ts=4 sw=4 et
- autocmd FileType make setlocal noexpandtab
-
-" C-T for new tab buffer
- nnoremap <C-t> :tabnew<cr>
+lua require('kdam0')
-" For normal mode when in terminals (in X I have caps mapped to esc, this replaces it when I don't have X)
- inoremap jk <Esc>
-
-"Shortcutting split navigation, saving a keypress:
- map <C-h> <C-w>h
- map <C-j> <C-w>j
- map <C-k> <C-w>k
- map <C-l> <C-w>l
-
-" Saving view folds
- "au BufWinLeave * mkview
+" nnn
+let g:nnn#layout = { 'window': { 'width': 0.9, 'height': 0.6, 'highlight': 'Debug' } }
+let g:nnn#action = {
+ \ '<c-t>': 'tab split',
+ \ '<c-x>': 'split',
+ \ '<c-v>': 'vsplit' }
+let g:nnn#set_default_mappings = 0
-" Spell-check set to F6:
- map <F6> :setlocal spell! spelllang=en_ca<CR>
+" --- Colors
-" Enable autocompletion:
- set wildmode=longest,list,full
- set wildmenu
+set background=dark
+colorscheme tokyonight
" Automatically deletes all tralling whitespace on save.
- autocmd BufWritePre * %s/\s\+$//e
+autocmd BufWritePre * %s/\s\+$//e
+" Tab settings
+autocmd Filetype css setlocal tabstop=2
+autocmd FileType yml setlocal ai ts=2 sw=2 et
+autocmd FileType yml setlocal ai ts=2 sw=2 et
+autocmd FileType yaml setlocal ai ts=2 sw=2 et
+autocmd FileType jinja setlocal ai ts=2 sw=2 et
+autocmd FileType python setlocal ai ts=4 sw=4 et
+autocmd FileType make setlocal noexpandtab
+
+" --- Remaps
+" Save
+nmap <Leader>, :w<cr>
+" C-T for new tab buffer
+nnoremap <C-t> :tabnew<cr>
+" For normal mode when in terminals (in X I have caps mapped to esc, this replaces it when I don't have X)
+inoremap jk <Esc>
+"Shortcutting split navigation, saving a keypress:
+map <C-h> <C-w>h
+map <C-j> <C-w>j
+map <C-k> <C-w>k
+map <C-l> <C-w>l
+" Spell-check set to F6:
+map <F6> :setlocal spell! spelllang=en_ca<CR>
"Replace all is aliased to S.
- nnoremap S :%s//g<Left><Left>
- vnoremap S noop
- vnoremap S :s//g<Left><Left>
-
- vnoremap K xkP`[V`]
- vnoremap J xp`[V`]
- vnoremap L >gv
- vnoremap H <gv
-
-" more navigation settings
- map gn :bn<cr>
- map gp :bp<cr>
- map gd :bd<cr>
-
+nnoremap S :%s//g<Left><Left>
+vnoremap S noop
+vnoremap S :s//g<Left><Left>
+" indent blocks in visual mode.
+vnoremap K xkP`[V`]
+vnoremap J xp`[V`]
+vnoremap L >gv
+vnoremap H <gv
" toggle line chars view
- "set showbreak=\\
- "set listchars=tab:..,trail:_,extends:>,precedes:<,nbsp:~
- set showbreak=↪\
- set listchars=tab:→\ ,eol:↲,nbsp:␣,trail:•,extends:⟩,precedes:⟨
- noremap <Leader>l :set list!<CR>
- set list
-
-" Latex settings
-" Compile document, be it groff/LaTeX/markdown/etc.
- map <leader>c :w! \| !compiler <c-r>%<CR>
-
-" Open corresponding .pdf/.html or preview
- map <leader>p :!opout <c-r>%<CR><CR>
-
-" Runs a script that cleans out tex build files whenever I close out of a .tex file.
- autocmd VimLeave *.tex !texclear %
-
-" Ensure files are read as what I want:
- let g:vimwiki_ext2syntax = {'.Rmd': 'markdown', '.rmd': 'markdown','.md': 'markdown', '.markdown': 'markdown', '.mdown': 'markdown'}
- autocmd BufRead,BufNewFile *.tex set filetype=tex
-
-" Ansible settings
- au BufRead,BufNewFile */playbooks/*.yaml set filetype=yaml.ansible
- let g:ansible_unindent_after_newline = 1
- let g:ansible_attribute_highlight = "ob"
- let g:ansible_name_highlight = 'b'
- let g:ansible_extra_keywords_highlight = 1
- let g:ansible_normal_keywords_highlight = 'Constant'
- let g:ansible_with_keywords_highlight = 'Constant'
-
-" Tick
- let g:tick_fmt_autosave = 0
-
-
-" Git-gutter
- set updatetime=100
-
-" lightline config
- set noshowmode
- set laststatus=2
-
-" colorscheme nord
- let g:lightline = {
- \ 'active': {
- \ 'left': [['mode', 'paste' ], ['readonly', 'filename', 'modified'], ['cocstatus']],
- \ 'right': [['lineinfo'], ['percent'], ['fileformat', 'fileencoding']]
- \ },
- \ 'colorscheme': 'gruvbox',
- \ 'component_function': {
- \ 'cocstatus': 'coc#status'
- \ },
- \ }
-
- " Use autocmd to force lightline update.
- autocmd User CocStatusChange,CocDiagnosticChange call lightline#update()
-
-
-" fzf hotkey
- function! s:find_git_root()
- return system('git rev-parse --show-toplevel 2> /dev/null')[:-2]
- endfunction
- command! ProjectFiles execute 'Files' s:find_git_root()
-
- map <Leader>g :ProjectFiles<CR>
- map <Leader>f :Files<CR>
- map <Leader>b :Buffers<CR>
-
-
-" Turns off highlighting on the bits of code that are changed, so the line that is changed is highlighted but the actual text that has changed stands out on the line and is readable.
- if &diff
- highlight! link DiffText MatchParen
- endif
-
-" vim rainbow
- let g:rainbow_active = 1
-
-" nnn
- let g:nnn#layout = { 'window': { 'width': 0.9, 'height': 0.6, 'highlight': 'Debug' } }
- let g:nnn#action = {
- \ '<c-t>': 'tab split',
- \ '<c-x>': 'split',
- \ '<c-v>': 'vsplit' }
-
-" Termcolors
- if (empty($TMUX))
- if (has("nvim"))
- let $NVIM_TUI_ENABLE_TRUE_COLOR=1
- endif
- if (has("termguicolors"))
- set termguicolors
- endif
- endif
-
-" CoC
- source ~/.config/nvim/coc.vim
- highlight CocErrorHighlight ctermfg=Red guifg=#ff0000
- highlight CocFloating ctermbg=Black
- nmap <silent> ga <Plug>(coc-codeaction-line)
- xmap <silent> ga <Plug>(coc-codeaction-selected)
- nmap <silent> gA <Plug>(coc-codeaction)
- imap <C-l> <Plug>(coc-snippets-expand)
- " Use <C-j> for jump to next placeholder, it's default of coc.nvim
- let g:coc_snippet_next = '<c-j>'
- " Use <C-k> for jump to previous placeholder, it's default of coc.nvim
- let g:coc_snippet_prev = '<c-k>'
- let g:coc_filetype_map = {
- \ 'yaml.ansible': 'ansible',
- \ }
-
-
-" To format python files for specific project
- function! PyFormat()
- silent !yapf --style ~/kepler/kepler/python/.style.yapf -i %
- let view = winsaveview()
- silent edit
- call winrestview(view)
- redraw!
- endfunction
- autocmd BufWritePost ~/kepler/kepler/python/kepler/*.py call PyFormat()
-
+noremap <Leader>l :set list!<CR>
+" Snippets jumping
+imap <silent><expr> <c-j> luasnip#expand_or_jumpable() ? '<Plug>luasnip-expand-or-jump' : '<c-j>'
+inoremap <silent> <c-k> <cmd>lua require'luasnip'.jump(-1)<Cr>
+snoremap <silent> <c-j> <cmd>lua require('luasnip').jump(1)<Cr>
+snoremap <silent> <c-k> <cmd>lua require('luasnip').jump(-1)<Cr>
+" Generate annotations
+nnoremap <silent> <Leader>d <cmd>lua require('neogen').generate()<Cr>
+nnoremap <silent> <Leader>dc <cmd>lua require('neogen').generate({ type = 'class' })<CR>
+nnoremap <silent> <Leader>df <cmd>lua require('neogen').generate({ type = 'file' })<CR>
+nnoremap <silent> <Leader>dt <cmd>lua require('neogen').generate({ type = 'type' })<CR>
+" Start n³ in the current file's directory
+nnoremap <Leader>n :NnnPicker %:p:h<CR>
diff --git a/nvim/.config/nvim/lua/kdam0/autopairs.lua b/nvim/.config/nvim/lua/kdam0/autopairs.lua
new file mode 100644
index 0000000..261f664
--- /dev/null
+++ b/nvim/.config/nvim/lua/kdam0/autopairs.lua
@@ -0,0 +1,3 @@
+require('nvim-autopairs').setup({
+ disable_filetype = { "TelescopePrompt" , "vim" },
+})
diff --git a/nvim/.config/nvim/lua/kdam0/commenter.lua b/nvim/.config/nvim/lua/kdam0/commenter.lua
new file mode 100644
index 0000000..fead874
--- /dev/null
+++ b/nvim/.config/nvim/lua/kdam0/commenter.lua
@@ -0,0 +1,13 @@
+require('Comment').setup{
+ padding = true,
+ sticky = true,
+ ignore = nil,
+ toggler = {
+ line = '<Leader>c',
+ block = '<Leader>b',
+ },
+ opleader = {
+ line = '<Leader>c',
+ block = '<Leader>b',
+ },
+}
diff --git a/nvim/.config/nvim/lua/kdam0/init.lua b/nvim/.config/nvim/lua/kdam0/init.lua
new file mode 100644
index 0000000..2adce0a
--- /dev/null
+++ b/nvim/.config/nvim/lua/kdam0/init.lua
@@ -0,0 +1,6 @@
+require('kdam0.treesitter')
+require('kdam0.telescope')
+require('kdam0.autopairs')
+require('kdam0.neogen')
+require('kdam0.commenter')
+require('kdam0.lspconfig')
diff --git a/nvim/.config/nvim/lua/kdam0/lspconfig.lua b/nvim/.config/nvim/lua/kdam0/lspconfig.lua
new file mode 100644
index 0000000..819b9ea
--- /dev/null
+++ b/nvim/.config/nvim/lua/kdam0/lspconfig.lua
@@ -0,0 +1,104 @@
+local cmp = require('cmp')
+local cmp_nvim_lsp = require('cmp_nvim_lsp')
+local luasnip = require('luasnip')
+local lspconfig = require('lspconfig')
+local nlspsettings = require("nlspsettings")
+local cmp_autopairs = require('nvim-autopairs.completion.cmp')
+
+local capabilities = vim.lsp.protocol.make_client_capabilities()
+capabilities = cmp_nvim_lsp.update_capabilities(capabilities)
+
+nlspsettings.setup({
+ config_home = vim.fn.stdpath('config') .. '/nlsp-settings',
+ local_settings_dir = ".nlsp-settings",
+ local_settings_root_markers = { '.git' },
+ append_default_schemas = true,
+ loader = 'json'
+})
+
+-- Mappings.
+local opts = { noremap=true, silent=true }
+vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
+vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
+vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
+vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
+
+local on_attach = function(client, bufnr)
+ -- Mappings.
+ local bufopts = { noremap=true, silent=true, buffer=bufnr }
+ vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
+ vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
+ vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
+ vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
+ vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
+ vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
+ vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
+ vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
+ vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
+ vim.keymap.set('n', '<space>f', vim.lsp.buf.formatting, bufopts)
+end
+
+local lsp_flags = {
+ -- This is the default in Nvim 0.7+
+ debounce_text_changes = 150,
+}
+
+cmp.setup({
+ snippet = {
+ expand = function(args)
+ require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
+ end,
+ },
+ window = {
+ completion = cmp.config.window.bordered(),
+ documentation = cmp.config.window.bordered(),
+ },
+ mapping = cmp.mapping.preset.insert({
+ ['<C-b>'] = cmp.mapping.scroll_docs(-4),
+ ['<C-f>'] = cmp.mapping.scroll_docs(4),
+ ['<C-Space>'] = cmp.mapping.complete(),
+ ['<C-e>'] = cmp.mapping.abort(),
+ ['<CR>'] = cmp.mapping.confirm({ select = true }),
+ }),
+ sources = cmp.config.sources({
+ { name = 'nvim_lsp' },
+ { name = 'luasnip' }, -- For luasnip users.
+ }, {
+ { name = 'buffer' },
+ })
+})
+
+cmp.event:on(
+ 'confirm_done',
+ cmp_autopairs.on_confirm_done()
+)
+
+settings = {
+ pylsp = {
+ pylsp = {
+ plugins = {
+ autopep8 = { enabled = false },
+ flake8 = { enabled = false },
+ pycodestyle = { enabled = false },
+ pydocstyle = { enabled = false },
+ pyflakes = { enabled = false },
+ yapf = { enabled = false },
+ pylint = { enabled = true },
+ black = { enabled = true },
+ }
+ }
+ },
+ bashls = {}
+}
+
+local servers = {'pylsp', 'bashls', 'jsonls'}
+for _,lsp in ipairs(servers) do
+ lspconfig[lsp].setup{
+ on_attach = on_attach,
+ flags = lsp_flags,
+ capabilities = capabilities,
+ settings = settings[lsp],
+ }
+end
+
+require("luasnip.loaders.from_vscode").lazy_load()
diff --git a/nvim/.config/nvim/lua/kdam0/neogen.lua b/nvim/.config/nvim/lua/kdam0/neogen.lua
new file mode 100644
index 0000000..d66ef13
--- /dev/null
+++ b/nvim/.config/nvim/lua/kdam0/neogen.lua
@@ -0,0 +1,10 @@
+local neogen = require("neogen")
+
+neogen.setup{
+ enabled = true,
+ snippet_engine = "luasnip",
+ languages = {
+ lua = { template = { annotation_convention = "emmylua" } },
+ python = { template = { annotation_convention = "reST" } },
+ },
+}
diff --git a/nvim/.config/nvim/lua/kdam0/telescope.lua b/nvim/.config/nvim/lua/kdam0/telescope.lua
new file mode 100644
index 0000000..cf74cef
--- /dev/null
+++ b/nvim/.config/nvim/lua/kdam0/telescope.lua
@@ -0,0 +1,40 @@
+local telescope = require('telescope')
+local actions = require('telescope.actions')
+
+telescope.setup {
+ defaults = {
+ color_devicons = false,
+ prompt_prefix = "$ ",
+ file_ignore_patterns = { "^.git/" },
+ mappings = {
+ i = {
+ ['<esc>'] = actions.close
+ }
+ }
+ }
+}
+
+-- To get fzf loaded and working with telescope, you need to call
+-- load_extension, somewhere after setup function:
+telescope.load_extension('fzf')
+
+local M = {}
+
+M.search_dotfiles = function()
+ require('telescope.builtin').find_files({
+ prompt_title = "<.dotfiles>",
+ cwd = '~/dotfiles',
+ hidden = true
+ })
+end
+
+M.project_files = function()
+ local opts = {}
+ local ok = pcall(require('telescope.builtin').git_files, opts)
+ if not ok then require('telescope.builtin').find_files(opts) end
+end
+
+vim.api.nvim_set_keymap('n', '<Leader>f', ':lua require\'kdam0.telescope\'.project_files()<Cr>', {noremap = true, silent = true})
+vim.api.nvim_set_keymap('n', '<Leader>g', ':lua require\'kdam0.telescope\'.search_dotfiles()<Cr>', {noremap = true, silent = true})
+
+return M
diff --git a/nvim/.config/nvim/lua/kdam0/treesitter.lua b/nvim/.config/nvim/lua/kdam0/treesitter.lua
new file mode 100644
index 0000000..3824f6a
--- /dev/null
+++ b/nvim/.config/nvim/lua/kdam0/treesitter.lua
@@ -0,0 +1,10 @@
+require('nvim-treesitter.configs').setup {
+ ensure_installed = "all",
+ auto_install = true,
+ highlight = {
+ enable = true,
+ },
+ indent = {
+ enable = true,
+ },
+}