diff options
| author | Kumar Damani <damani.kumar@gmail.com> | 2020-03-10 03:40:27 +0000 |
|---|---|---|
| committer | Kumar Damani <damani.kumar@gmail.com> | 2020-03-10 03:40:27 +0000 |
| commit | 7a73d436072a322498f3b668a29e8731b0255f35 (patch) | |
| tree | aee7f80fbae80c1730fb2919755d0ec89fab017b /nvim/.config | |
| parent | 63ad7837556192589799261cdccc28ee3002b36e (diff) | |
added nvim
Diffstat (limited to 'nvim/.config')
| -rw-r--r-- | nvim/.config/nvim/init.vim | 138 |
1 files changed, 138 insertions, 0 deletions
diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim new file mode 100644 index 0000000..896d282 --- /dev/null +++ b/nvim/.config/nvim/init.vim @@ -0,0 +1,138 @@ +call plug#begin() + Plug 'ncm2/ncm2' + Plug 'roxma/nvim-yarp' + Plug 'ncm2/ncm2-bufword' + Plug 'ncm2/ncm2-path' + Plug 'ncm2/ncm2-ultisnips' + Plug 'SirVer/ultisnips' + Plug 'honza/vim-snippets' + Plug '/usr/bin/fzf' + Plug 'junegunn/fzf.vim' + Plug 'itchyny/lightline.vim' + Plug 'airblade/vim-gitgutter' + Plug 'raimondi/delimitmate' + Plug 'pearofducks/ansible-vim' + Plug 'nathanielc/vim-tickscript' +call plug#end() + +" Some basics: + filetype plugin on + syntax on + colorscheme koehler + 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 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 + +" 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 + + +" Saving view folds + au BufWinLeave * mkview + +" Spell-check set to F6: + map <F6> :setlocal spell! spelllang=en_ca<CR> + +" Enable autocompletion: + set wildmode=longest,list,full + set wildmenu + +" Automatically deletes all tralling whitespace on save. + autocmd BufWritePre * %s/\s\+$//e + +"Replace all is aliased to S. Visual mode shortcut doesn't work yet for some +"reason... + 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> + +" toggle line chars view + set listchars=tab:→\ ,eol:↲,nbsp:␣,trail:•,extends:⟩,precedes:⟨ + noremap <Leader>l :set list!<CR> + set list + +" Ansible settings + au BufRead,BufNewFile */playbooks/*.yaml set filetype=yaml.ansible + au BufRead,BufNewFile */tasks/*.yaml set filetype=yaml.ansible + au BufRead,BufNewFile */group_vars/*.yaml set filetype=yaml.ansible + au BufRead,BufNewFile *.j2 set filetype=yaml.ansible + let g:ansible_attribute_highlight = "ad" + let g:ansible_name_highlight = 'd' + 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']], + \ 'right': [['lineinfo'], ['percent'], ['fileformat', 'fileencoding']] + \ }, + \ 'colorscheme': 'srcery_drk' + \ } + +" 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> + + +" IMPORTANT: :help Ncm2PopupOpen for more information + set completeopt=noinsert,menuone,noselect + +" enable ncm2 for all buffers + autocmd BufEnter * call ncm2#enable_for_buffer() + + let g:UltiSnipsJumpForwardTrigger = "<c-j>" + let g:UltiSnipsJumpBackwardTrigger = "<c-k>" + let g:UltiSnipsRemoveSelectModeMappings = 0 |
