Created
January 17, 2022 17:01
-
-
Save vijedi/020671c37fea3e26a5d71296fcd668e4 to your computer and use it in GitHub Desktop.
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
syntax on | |
set tabstop=4 | |
set shiftwidth=4 | |
set expandtab | |
set bg=dark | |
set nu | |
set ruler | |
set hlsearch | |
let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:10,results:30' | |
let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard'] | |
nmap ø :NERDTreeToggle<CR> | |
nmap Ø :NERDTreeFind<CR> | |
let NERDTreeIgnore = ['dist', 'node_modules'] | |
set wrap | |
set linebreak | |
set nolist | |
set backspace=indent,eol,start | |
set virtualedit= | |
set display+=lastline | |
" Indentation | |
set smartindent | |
set nobackup | |
set nowritebackup | |
set noswapfile | |
set hidden | |
" Enable fancy highlighting with COC | |
let g:coc_global_extensions = [ 'coc-tsserver' ] | |
" Setup ALE for Javascript | |
let g:ale_fixers={ | |
\ '*': ['remove_trailing_lines', 'trim_whitespace'], | |
\ 'javascript': ['prettier', 'eslint'], | |
\ 'typescript': ['prettier', 'eslint'], | |
\ 'typescriptreact': ['prettier', 'eslint'] | |
\} | |
" Allow ALE to automatically fix errors | |
let g:ale_fix_on_save=1 | |
" Make the nerdtree window better | |
let g:NERDTreeWinSize=45 | |
filetype plugin indent on | |
" 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 | |
if executable('ag') | |
let g:ackprg = 'ag --vimgrep' | |
endif | |
set wildmenu " when opening a file with e.g. :e ~/.vim<TAB> there is a graphical menu of all the matches | |
set ttyfast | |
set lazyredraw | |
set updatetime=300 | |
cnoreabbrev Ack Ack! | |
nnoremap <Leader>a :Ack!<Space> | |
" Helpers | |
let mapleader = " " | |
" Open Buffer | |
nnoremap <silent><leader>l :buffers<CR> | |
" Open test file for a current file | |
nnoremap <silent><leader>s :A<CR> | |
" Open test file for a current file in a vertical window | |
nnoremap <silent><leader>v :AV<CR> | |
" Vertically split screen | |
nnoremap <silent><leader>% :vs<CR> | |
" Split screen | |
nnoremap <silent><leader>" :split<CR> | |
" Close current buffer | |
nnoremap <silent><leader>Q :q<CR> | |
" Focus current split | |
nnoremap <silent><leader>M :on<CR> | |
" Unhighlight search | |
nnoremap <silent><leader>C :nohl<CR> | |
" Call Ack! | |
nnoremap <silent><leader>A :Ack!<CR> | |
" Wrapped line navigation | |
noremap <buffer> <silent> <Up> gk | |
noremap <buffer> <silent> <Down> gj | |
noremap <buffer> <silent> <Home> g<Home> | |
noremap <buffer> <silent> <End> g<End> | |
inoremap <buffer> <silent> <Up> <C-o>gk | |
inoremap <buffer> <silent> <Down> <C-o>gj | |
inoremap <buffer> <silent> <Home> <C-o>g<Home> | |
inoremap <buffer> <silent> <End> <C-o>g<End> | |
noremap <silent> k gk | |
noremap <silent> j gj | |
noremap <silent> 0 g0 | |
noremap <silent> $ g$ | |
" CoC extensions | |
let g:coc_global_extensions = ['coc-solargraph', 'coc-tsserver', 'coc-json'] | |
" Add CoC Prettier if prettier is installed | |
if isdirectory('./node_modules') && isdirectory('./node_modules/prettier') | |
let g:coc_global_extensions += ['coc-prettier'] | |
endif | |
" Add CoC ESLint if ESLint is installed | |
if isdirectory('./node_modules') && isdirectory('./node_modules/eslint') | |
let g:coc_global_extensions += ['coc-eslint'] | |
endif | |
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) | |
" Remap keys for applying codeAction to the current buffer. | |
nmap <leader>ac <Plug>(coc-codeaction) | |
" Apply AutoFix to problem on the current line. | |
nmap <leader>qf <Plug>(coc-fix-current) | |
" Format | |
nmap <leader>f :CocCommand prettier.formatFile<CR> | |
" Fix syntax highlight for Coc plugin floating errors | |
hi CocErrorFloat guifg=Magenta guibg=Magenta |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment