Created
March 30, 2021 19:31
-
-
Save armand1m/d3355b2493ecbe8b5c5744ab7e4cda3e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 " enable syntax highlighting | |
set cursorline " highlight the current line | |
set ruler " show line number in bar | |
set nobackup " don't create pointless backup files; Use VCS instead | |
set autoread " watch for file changes | |
set number " show line numbers | |
set showcmd " show selection metadata | |
set showmode " show INSERT, VISUAL, etc. mode | |
set autoindent smartindent " auto/smart indent | |
set smarttab " better backspace and tab functionality | |
set scrolloff=5 " show at least 5 lines above/below | |
filetype on " enable filetype detection | |
filetype indent on " enable filetype-specific indenting | |
filetype plugin on " enable filetype-specific plugins | |
" column-width visual indication | |
" tabs and indenting | |
set autoindent " auto indenting | |
set smartindent " smart indenting | |
set expandtab " spaces instead of tabs | |
set tabstop=2 " 2 spaces for tabs | |
set shiftwidth=2 " 2 spaces for indentation | |
" bells | |
set noerrorbells " turn off audio bell | |
set visualbell " but leave on a visual bell | |
" search | |
set hlsearch " highlighted search results | |
set showmatch " show matching bracket | |
" other | |
set guioptions=aAace " don't show scrollbar in MacVim | |
" clipboard | |
set clipboard=unnamed " allow yy, etc. to interact with OS X clipboard | |
" remapped keys | |
inoremap { {}<Left> | |
inoremap {<CR> {<CR>}<Esc>O | |
inoremap {{ { | |
inoremap {} {} | |
call plug#begin('~/.vim/plugged') | |
Plug 'scrooloose/nerdtree' | |
"Plug 'airblade/vim-gitgutter' | |
Plug 'tpope/vim-surround' | |
Plug 'zivyangll/git-blame.vim' | |
Plug 'Xuyuanp/nerdtree-git-plugin' | |
Plug 'tpope/vim-fugitive' | |
Plug 'arcticicestudio/nord-vim' | |
Plug 'leafgarland/typescript-vim' | |
Plug 'peitalin/vim-jsx-typescript' | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
Plug 'vim-airline/vim-airline' | |
Plug 'vim-airline/vim-airline-themes' | |
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } | |
Plug 'preservim/nerdcommenter' | |
Plug 'mhartington/oceanic-next' | |
call plug#end() | |
" Theme | |
let g:oceanic_next_terminal_bold = 1 | |
let g:oceanic_next_terminal_italic = 1 | |
colorscheme OceanicNext | |
" shortcuts | |
map <c-u> :call gitblame#echo()<cr> | |
" map <c-b> :nerdtreetoggle<cr> | |
nmap <c-b> :CocCommand explorer<cr> | |
autocmd VimEnter * :CocCommand explorer | |
set background=dark | |
set cmdheight=2 | |
set updatetime=300 | |
set shortmess+=c | |
inoremap <silent><expr> <tab> | |
\ pumvisible() ? "\<c-n>" : | |
\ <sid>check_back_space() ? "\<tab>" : | |
\ coc#refresh() | |
inoremap <expr><s-tab> pumvisible() ? "\<c-p>" : "\<c-h>" | |
function! s:check_back_space() abort | |
let col = col('.') - 1 | |
return !col || getline('.')[col - 1] =~# '\s' | |
endfunction | |
" use <c-space> to trigger completion. | |
if has('nvim') | |
inoremap <silent><expr> <C-Space> coc#refresh() | |
else | |
inoremap <silent><expr> <C-Space> coc#refresh() | |
endif | |
inoremap <C-@> <C-Space> | |
" Make <CR> auto-select the first completion item and notify coc.nvim to | |
" format on enter, <cr> could be remapped by other vim plugin | |
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm() | |
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>" | |
" Use `[g` and `]g` to navigate diagnostics | |
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. | |
nmap <silent> [g <Plug>(coc-diagnostic-prev) | |
nmap <silent> ]g <Plug>(coc-diagnostic-next) | |
" GoTo code navigation. | |
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) | |
" Use K to show documentation in preview window. | |
nnoremap <silent> K :call <SID>show_documentation()<CR> | |
function! s:show_documentation() | |
if (index(['vim','help'], &filetype) >= 0) | |
execute 'h '.expand('<cword>') | |
elseif (coc#rpc#ready()) | |
call CocActionAsync('doHover') | |
else | |
execute '!' . &keywordprg . " " . expand('<cword>') | |
endif | |
endfunction | |
" Highlight the symbol and its references when holding the cursor. | |
autocmd CursorHold * silent call CocActionAsync('highlight') | |
" Symbol renaming. | |
nmap <leader>rn <Plug>(coc-rename) | |
" Apply AutoFix to problem on the current line. | |
nmap <leader>qf <Plug>(coc-fix-current) | |
" Mappings for CoCList | |
" Show all diagnostics. | |
nnoremap <silent><nowait> <space>a :<C-u>CocList diagnostics<cr> | |
" Manage extensions. | |
nnoremap <silent><nowait> <space>e :<C-u>CocList extensions<cr> | |
" Show commands. | |
nnoremap <silent><nowait> <space>c :<C-u>CocList commands<cr> | |
" Find symbol of current document. | |
nnoremap <silent><nowait> <space>o :<C-u>CocList outline<cr> | |
" Search workspace symbols. | |
nnoremap <silent><nowait> <space>s :<C-u>CocList -I symbols<cr> | |
" Do default action for next item. | |
nnoremap <silent><nowait> <space>j :<C-u>CocNext<CR> | |
" Do default action for previous item. | |
nnoremap <silent><nowait> <space>k :<C-u>CocPrev<CR> | |
" Resume latest coc list. | |
nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR> | |
nnoremap <C-j> :m .+1<CR>== | |
nnoremap <C-k> :m .-2<CR>== | |
inoremap <C-j> <Esc>:m .+1<CR>==gi | |
inoremap <C-k> <Esc>:m .-2<CR>==gi | |
vnoremap <C-j> :m '>+1<CR>gv=gv | |
vnoremap <C-k> :m '<-2<CR>gv=gv | |
" move between tabs using shifted H and L | |
nnoremap H gT | |
nnoremap L gt | |
vnoremap <C-r> "hy:%s/<C-r>h//gc<left><left><left> | |
map <Space> <Leader> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment