aboutsummaryrefslogtreecommitdiff
path: root/nvim/.config
diff options
context:
space:
mode:
authorKumar Damani <kdamani@kepler.space>2021-11-05 20:04:43 +0000
committerKumar Damani <kdamani@kepler.space>2021-11-05 20:04:43 +0000
commit992c409f722e2a394aa4e4be31e1d91cfa57cb28 (patch)
treee1b9a0fb50d2aaf5a7c67f287c626aa5ece610c0 /nvim/.config
parent1fc5cb0fc03a790d1c6e47b6d36f67ac56a390b3 (diff)
added coc to nvim
Diffstat (limited to 'nvim/.config')
-rw-r--r--nvim/.config/nvim/init.vim76
1 files changed, 56 insertions, 20 deletions
diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim
index 88a69ea..943e3f3 100644
--- a/nvim/.config/nvim/init.vim
+++ b/nvim/.config/nvim/init.vim
@@ -6,13 +6,11 @@ if empty(glob('~/.config/nvim/autoload/plug.vim'))
endif
call plug#begin('~/.config/nvim/autoload/plugged')
- Plug 'ncm2/ncm2'
- Plug 'roxma/nvim-yarp'
- Plug 'ncm2/ncm2-bufword'
- Plug 'ncm2/ncm2-path'
- Plug 'ncm2/ncm2-ultisnips'
+ 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'
@@ -25,13 +23,15 @@ call plug#begin('~/.config/nvim/autoload/plugged')
Plug 'mcchrish/nnn.vim'
Plug 'brainfucksec/wal.vim'
Plug 'pearofducks/ansible-vim'
+ Plug 'neoclide/coc.nvim', {'branch': 'release'}
+ "Plug 'lukas-reineke/indent-blankline.nvim'
call plug#end()
" Some basics:
filetype plugin on
syntax on
- "colorscheme koehler
- colorscheme wal
+ colorscheme koehler
+ "colorscheme wal
highlight NonText ctermfg=yellow guifg=yellow
set noswapfile
set encoding=utf-8
@@ -116,7 +116,7 @@ call plug#end()
autocmd BufRead,BufNewFile *.tex set filetype=tex
" Ansible settings
- au BufRead,BufNewFile */playbooks/*.yml set filetype=yaml.ansible
+ 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'
@@ -138,12 +138,19 @@ call plug#end()
" colorscheme nord
let g:lightline = {
\ 'active': {
- \ 'left': [['mode', 'paste' ], ['readonly', 'filename', 'modified']],
+ \ 'left': [['mode', 'paste' ], ['readonly', 'filename', 'modified'], ['cocstatus']],
\ 'right': [['lineinfo'], ['percent'], ['fileformat', 'fileencoding']]
\ },
- \ 'colorscheme': 'srcery_drk'
+ \ 'colorscheme': 'srcery_drk',
+ \ '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]
@@ -154,16 +161,6 @@ call plug#end()
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
-
" 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
@@ -179,3 +176,42 @@ call plug#end()
\ '<c-x>': 'split',
\ '<c-v>': 'vsplit' }
+" Gruvbox
+ "Use 24-bit (true-color) mode in Vim/Neovim when outside tmux.
+ "If you're using tmux version 2.2 or later, you can remove the outermost $TMUX check and use tmux's 24-bit color support
+ "(see < http://sunaku.github.io/tmux-24bit-color.html#usage > for more information.)
+ if (empty($TMUX))
+ if (has("nvim"))
+ "For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 >
+ let $NVIM_TUI_ENABLE_TRUE_COLOR=1
+ endif
+ "For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 >
+ "Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd >
+ " < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 >
+ 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)
+ 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>'
+
+" To format python files for specific project
+ function! PyFormat()
+ silent !yapf --style ~/kepler/python/.style.yapf -i %
+ let view = winsaveview()
+ silent edit
+ call winrestview(view)
+ redraw!
+ endfunction
+ autocmd BufWritePost ~/kepler/python/kepler/*.py call PyFormat()
+
+