From 048e43aceeabb7a54bf6115ab0a63cc1ff5b3cab Mon Sep 17 00:00:00 2001 From: Kumar Damani Date: Thu, 14 Jul 2022 12:49:34 -0400 Subject: nvim switch to native lsp conf --- nvim/.config/nvim/coc-settings.json | 16 -- nvim/.config/nvim/coc.vim | 163 -------------- nvim/.config/nvim/init.vim | 327 +++++++++++------------------ nvim/.config/nvim/lua/kdam0/autopairs.lua | 3 + nvim/.config/nvim/lua/kdam0/commenter.lua | 13 ++ nvim/.config/nvim/lua/kdam0/init.lua | 6 + nvim/.config/nvim/lua/kdam0/lspconfig.lua | 104 +++++++++ nvim/.config/nvim/lua/kdam0/neogen.lua | 10 + nvim/.config/nvim/lua/kdam0/telescope.lua | 40 ++++ nvim/.config/nvim/lua/kdam0/treesitter.lua | 10 + 10 files changed, 306 insertions(+), 386 deletions(-) delete mode 100644 nvim/.config/nvim/coc-settings.json delete mode 100644 nvim/.config/nvim/coc.vim create mode 100644 nvim/.config/nvim/lua/kdam0/autopairs.lua create mode 100644 nvim/.config/nvim/lua/kdam0/commenter.lua create mode 100644 nvim/.config/nvim/lua/kdam0/init.lua create mode 100644 nvim/.config/nvim/lua/kdam0/lspconfig.lua create mode 100644 nvim/.config/nvim/lua/kdam0/neogen.lua create mode 100644 nvim/.config/nvim/lua/kdam0/telescope.lua create mode 100644 nvim/.config/nvim/lua/kdam0/treesitter.lua (limited to 'nvim/.config') 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 ' to make sure tab is not mapped by -" other plugin before putting this into your config. -inoremap - \ pumvisible() ? "\" : - \ check_back_space() ? "\" : - \ coc#refresh() -inoremap pumvisible() ? "\" : "\" - -function! s:check_back_space() abort - let col = col('.') - 1 - return !col || getline('.')[col - 1] =~# '\s' -endfunction - -" Use to trigger completion. -if has('nvim') - inoremap coc#refresh() -else - inoremap coc#refresh() -endif - -" Make auto-select the first completion item and notify coc.nvim to -" format on enter, could be remapped by other vim plugin -inoremap pumvisible() ? coc#_select_confirm() - \: "\u\\=coc#on_enter()\" - -" Use `[g` and `]g` to navigate diagnostics -" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. -nmap [g (coc-diagnostic-prev) -nmap ]g (coc-diagnostic-next) - -" GoTo code navigation. -nmap gd (coc-definition) -nmap gy (coc-type-definition) -nmap gi (coc-implementation) -nmap gr (coc-references) - -" Use K to show documentation in preview window. -nnoremap K :call show_documentation() - -function! s:show_documentation() - if (index(['vim','help'], &filetype) >= 0) - execute 'h '.expand('') - elseif (coc#rpc#ready()) - call CocActionAsync('doHover') - else - execute '!' . &keywordprg . " " . expand('') - endif -endfunction - -" Highlight the symbol and its references when holding the cursor. -autocmd CursorHold * silent call CocActionAsync('highlight') - -" Symbol renaming. -nmap rn (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: `aap` for current paragraph -xmap a (coc-codeaction-selected) -nmap a (coc-codeaction-selected) - -" Remap keys for applying codeAction to the current buffer. -nmap ac (coc-codeaction) -" Apply AutoFix to problem on the current line. -nmap qf (coc-fix-current) - -" Map function and class text objects -" NOTE: Requires 'textDocument.documentSymbol' support from the language server. -xmap if (coc-funcobj-i) -omap if (coc-funcobj-i) -xmap af (coc-funcobj-a) -omap af (coc-funcobj-a) -xmap ic (coc-classobj-i) -omap ic (coc-classobj-i) -xmap ac (coc-classobj-a) -omap ac (coc-classobj-a) - -" Remap and for scroll float windows/popups. -if has('nvim-0.4.0') || has('patch-8.2.0750') - nnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" - nnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" - inoremap coc#float#has_scroll() ? "\=coc#float#scroll(1)\" : "\" - inoremap coc#float#has_scroll() ? "\=coc#float#scroll(0)\" : "\" - vnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" - vnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" -endif - -" Use CTRL-S for selections ranges. -" Requires 'textDocument/selectionRange' support of language server. -nmap (coc-range-select) -xmap (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', ) - -" 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 a :CocList diagnostics -" Manage extensions. -nnoremap e :CocList extensions -" Show commands. -nnoremap c :CocList commands -" Find symbol of current document. -nnoremap o :CocList outline -" Search workspace symbols. -nnoremap s :CocList -I symbols -" Do default action for next item. -nnoremap j :CocNext -" Do default action for previous item. -nnoremap k :CocPrev -" Resume latest coc list. -nnoremap p :CocListResume - - 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=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=v - nmap , :w - -" 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 :tabnew +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 - -"Shortcutting split navigation, saving a keypress: - map h - map j - map k - map 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 = { + \ '': 'tab split', + \ '': 'split', + \ '': 'vsplit' } +let g:nnn#set_default_mappings = 0 -" Spell-check set to F6: - map :setlocal spell! spelllang=en_ca +" --- 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 , :w +" C-T for new tab buffer +nnoremap :tabnew +" 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 +"Shortcutting split navigation, saving a keypress: +map h +map j +map k +map l +" Spell-check set to F6: +map :setlocal spell! spelllang=en_ca "Replace all is aliased to S. - nnoremap S :%s//g - vnoremap S noop - vnoremap S :s//g - - vnoremap K xkP`[V`] - vnoremap J xp`[V`] - vnoremap L >gv - vnoremap H - map gp :bp - map gd :bd - +nnoremap S :%s//g +vnoremap S noop +vnoremap S :s//g +" indent blocks in visual mode. +vnoremap K xkP`[V`] +vnoremap J xp`[V`] +vnoremap L >gv +vnoremap H ,precedes:<,nbsp:~ - set showbreak=↪\ - set listchars=tab:→\ ,eol:↲,nbsp:␣,trail:•,extends:⟩,precedes:⟨ - noremap l :set list! - set list - -" Latex settings -" Compile document, be it groff/LaTeX/markdown/etc. - map c :w! \| !compiler % - -" Open corresponding .pdf/.html or preview - map p :!opout % - -" 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 g :ProjectFiles - map f :Files - map b :Buffers - - -" 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 = { - \ '': 'tab split', - \ '': 'split', - \ '': '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 ga (coc-codeaction-line) - xmap ga (coc-codeaction-selected) - nmap gA (coc-codeaction) - imap (coc-snippets-expand) - " Use for jump to next placeholder, it's default of coc.nvim - let g:coc_snippet_next = '' - " Use for jump to previous placeholder, it's default of coc.nvim - let g:coc_snippet_prev = '' - 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 l :set list! +" Snippets jumping +imap luasnip#expand_or_jumpable() ? 'luasnip-expand-or-jump' : '' +inoremap lua require'luasnip'.jump(-1) +snoremap lua require('luasnip').jump(1) +snoremap lua require('luasnip').jump(-1) +" Generate annotations +nnoremap d lua require('neogen').generate() +nnoremap dc lua require('neogen').generate({ type = 'class' }) +nnoremap df lua require('neogen').generate({ type = 'file' }) +nnoremap dt lua require('neogen').generate({ type = 'type' }) +" Start n³ in the current file's directory +nnoremap n :NnnPicker %:p:h 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 = 'c', + block = 'b', + }, + opleader = { + line = 'c', + block = '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', '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', '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', '', vim.lsp.buf.signature_help, bufopts) + vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, bufopts) + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, bufopts) + vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, bufopts) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) + vim.keymap.set('n', '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({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = 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 = { + [''] = 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', 'f', ':lua require\'kdam0.telescope\'.project_files()', {noremap = true, silent = true}) +vim.api.nvim_set_keymap('n', 'g', ':lua require\'kdam0.telescope\'.search_dotfiles()', {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, + }, +} -- cgit v1.2.3