""" Optixal's Neovim Init.vim set encoding=UTF-8 set tabstop=4 set shiftwidth=4 set expandtab
""" Vim-Plug call plug#begin() Plug 'ctrlpvim/ctrlp.vim' Plug 'ayu-theme/ayu-vim' Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' Plug 'ryanoasis/vim-devicons' Plug 'preservim/nerdtree' Plug 'caenrique/nvim-toggle-terminal' Plug 'editorconfig/editorconfig-vim' Plug 'preservim/nerdcommenter' call plug#end()
set termguicolors " enable true colors support let ayucolor="light" " for light version of theme let ayucolor="mirage" " for mirage version of theme let ayucolor="dark" " for dark version of theme colorscheme ayu
let g:airline_powerline_fonts = 1 let NERDTreeShowHidden=1
""" Line numbers :set number :set relativenumber
set guifont=Hack_Nerd_Font_Mono:h11
nnoremap :NERDTreeToggle nnoremap <C-]> :CocCommand eslint.executeAutofix
nnoremap :ToggleTerminal tnoremap <C->:ToggleTerminal
""" format command command! -nargs=0 Prettier :CocCommand prettier.formatFile
autocmd vimenter * NERDTree autocmd StdinReadPre * let s:std_in=1 autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" Remap keys for gotos "nmap gd :call CocAction('jumpDefinition', 'tab drop') nmap gd (coc-definition) nmap gy (coc-type-definition) nmap gi (coc-implementation) nmap gr (coc-references)
" use for trigger completion and navigate to next complete item function! s:check_back_space() abort let col = col('.') - 1 return !col || getline('.')[col - 1] =~ '\s' endfunction
inoremap
\ pumvisible() ? "<C-n>" :
\ check_back_space() ? "<TAB>" :
\ coc#refresh()
"use tab and shift-tab to navigate completion list
inoremap pumvisible() ? "<C-n>" : "<Tab>"
inoremap pumvisible() ? "<C-p>" : "<S-Tab>"
"Use to confirm complete
inoremap pumvisible() ? "<C-y>" : "<C-g>u<CR>"
"To force coc select complete item before confirm, use:
inoremap pumvisible() ? coc#_select_confirm() : "<C-g>u<CR>"
"Close preview window when completion is done.
autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif
" Use [c
and ]c
for navigate diagnostics
nmap [c (coc-diagnostic-prev)
nmap ]c (coc-diagnostic-next)
" Use K for show documentation in preview window nnoremap K :call show_documentation()
function! s:show_documentation() if &filetype == 'vim' execute 'h '.expand('') else call CocAction('doHover') endif endfunction
" Highlight symbol under cursor on CursorHold autocmd CursorHold * silent call CocActionAsync('highlight')