Created
November 15, 2022 16:11
-
-
Save nirvanadev/e83daa5c5220237c45074b45829988a2 to your computer and use it in GitHub Desktop.
NeoVim Config 2022
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
call plug#begin('~/.vim/plugged') | |
" File Tree | |
Plug 'preservim/nerdtree' | |
" File Searching | |
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | |
Plug 'junegunn/fzf.vim' | |
" Intellisense | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
let g:coc_global_extensions = ['coc-emmet', 'coc-css', 'coc-html', 'coc-json', 'coc-prettier', 'coc-tsserver', 'coc-phpls', 'coc-python', 'coc-diagnostic', 'coc-fzf-preview'] | |
Plug 'dense-analysis/ale' | |
Plug 'sheerun/vim-polyglot' | |
" Misc | |
Plug 'vim-airline/vim-airline' | |
Plug 'tpope/vim-commentary' | |
Plug 'ap/vim-css-color' | |
Plug 'rafi/awesome-vim-colorschemes' | |
Plug 'othree/html5.vim' | |
Plug 'pangloss/vim-javascript' | |
Plug 'evanleck/vim-svelte', {'branch': 'main'} | |
call plug#end() | |
" NERDTree | |
let g:NERDTreeShowHidden = 1 | |
let g:NERDTreeMinimalUI = 1 | |
let g:NERDTreeIgnore = [] | |
let g:NERDTreeStatusline = '' | |
" Automaticaly close nvim if NERDTree is only thing left open | |
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif | |
" Toggle the tree | |
nnoremap <silent> <C-b> :NERDTreeToggle<CR> | |
set clipboard=unnamed | |
set encoding=UTF-8 | |
set number relativenumber | |
syntax on | |
set laststatus=2 | |
filetype plugin indent on | |
set tabstop=4 | |
set shiftwidth=4 | |
set expandtab | |
set noshowmode | |
" CoC settings | |
set nobackup | |
set nowritebackup | |
set cmdheight=1 | |
set updatetime=300 | |
set shortmess+=c | |
if has("nvim-0.5.0") || has("patch-8.1.1564") | |
set signcolumn=number | |
else | |
set signcolumn=yes | |
endif | |
inoremap <silent><expr> <TAB> | |
\ pumvisible() ? "\<C-n>" : | |
\ CheckBackspace() ? "\<TAB>" : | |
\ coc#refresh() | |
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>" | |
function! CheckBackspace() abort | |
let col = col('.') - 1 | |
return !col || getline('.')[col - 1] =~# '\s' | |
endfunction | |
if has('nvim') | |
inoremap <silent><expr> <c-space> coc#refresh() | |
else | |
inoremap <silent><expr> <c-@> coc#refresh() | |
endif | |
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm() | |
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>" | |
nmap <silent> [g <Plug>(coc-diagnostic-prev) | |
nmap <silent> ]g <Plug>(coc-diagnostic-next) | |
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) | |
nnoremap <silent> K :call ShowDocumentation()<CR> | |
function! ShowDocumentation() | |
if CocAction('hasProvider', 'hover') | |
call CocActionAsync('doHover') | |
else | |
call feedkeys('K', 'in') | |
endif | |
endfunction | |
autocmd CursorHold * silent call CocActionAsync('highlight') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment