Created
June 26, 2020 14:36
-
-
Save thiagoramos23/18e9d5968dd4dee11457de4ec296a467 to your computer and use it in GitHub Desktop.
.vimrc
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
let mapleader="," | |
set nocompatible " be iMproved, required | |
filetype off " required | |
set cf " Enable error files & error jumping. | |
set clipboard+=unnamed " Yanks go on clipboard instead. | |
set history=256 " Number of things to remember in history. | |
set autowrite " Writes on make/shell commands | |
set ruler " Ruler on | |
set nu " Line numbers on | |
set nowrap " Line wrapping off | |
set timeoutlen=250 " Time to wait after ESC (default causes an annoying delay) | |
" colorscheme gruvbox " Uncomment this to set a default theme | |
" Formatting (some of these are for coding in C and C++) | |
set ts=2 " Tabs are 2 spaces | |
set bs=2 " Backspace over everything in insert mode | |
set shiftwidth=2 " Tabs under smart indent | |
set nocp incsearch | |
set cinoptions=:0,p0,t0 | |
set cinwords=if,else,while,do,for,switch,case | |
set formatoptions=tcqr | |
set cindent | |
set autoindent | |
set smartindent | |
set smarttab | |
set expandtab | |
set tabstop=2 | |
if has("gui_running") | |
if has("gui_gtk2") | |
:set guifont=Hack:h15 | |
elseif has("x11") | |
" Also for GTK 1 | |
:set guifont=Hack:h15 | |
elseif has("gui_win32") | |
:set guifont=Hack:h15 | |
elseif has("gui_macvim") | |
:set guifont=Hack:h15 | |
endif | |
endif | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" alternatively, pass a path where Vundle should install plugins | |
"call vundle#begin('~/some/path/here') | |
" let Vundle manage Vundle, required | |
Plugin 'gmarik/Vundle.vim' | |
" The following are examples of different formats supported. | |
" Keep Plugin commands between vundle#begin/end. | |
" plugin on GitHub repo | |
"Plugin 'tpope/vim-fugitive' | |
" plugin from http://vim-scripts.org/vim/scripts.html | |
"Plugin 'L9' | |
" Git plugin not hosted on GitHub | |
" Plugin 'git://git.wincent.com/command-t.git' | |
" git repos on your local machine (i.e. when working on your own plugin) | |
"Plugin 'file:///home/gmarik/path/to/plugin' | |
" The sparkup vim script is in a subdirectory of this repo called vim. | |
" Pass the path to set the runtimepath properly. | |
"Plugin 'rstacruz/sparkup', {'rtp': 'vim/'} | |
" Avoid a name conflict with L9 | |
"Plugin 'user/L9', {'name': 'newL9'} | |
" My plugins | |
Plugin 'tpope/vim-rails' | |
Plugin 'tpope/vim-rake' | |
Plugin 'tpope/vim-bundler' | |
Plugin 'thoughtbot/vim-rspec' | |
Plugin 'janko-m/vim-test' | |
Plugin 'scrooloose/nerdtree' | |
Plugin 'tpope/vim-projectionist' | |
Plugin 'jlanzarotta/bufexplorer' | |
Plugin 'scrooloose/nerdcommenter' | |
Plugin 'tpope/vim-fugitive' | |
Plugin 'morhetz/gruvbox' | |
Plugin 'junegunn/fzf', { 'do': { -> fzf#install() } } | |
Plugin 'junegunn/fzf.vim' | |
Plugin 'kassio/neoterm' | |
Plugin 'neoclide/coc.nvim', {'branch': 'release'} | |
Plugin 'MattesGroeger/vim-bookmarks' | |
" KEy Bindings | |
nnoremap <silent> <expr> <C-\> g:NERDTree.IsOpen() ? "\:NERDTreeClose<CR>" : bufexists(expand('%')) ? "\:NERDTreeFind<CR>" : "\:NERDTree<CR>" | |
" KEy Bindings | |
nnoremap <silent> <expr> <C-\> g:NERDTree.IsOpen() ? "\:NERDTreeClose<CR>" : bufexists(expand('%')) ? "\:NERDTreeFind<CR>" : "\:NERDTree<CR>" | |
nnoremap vv :vsp<CR> | |
nnoremap ss :sp<CR> | |
" Move between splits | |
nnoremap <C-J> <C-W><C-J> | |
nnoremap <C-K> <C-W><C-K> | |
nnoremap <C-L> <C-W><C-L> | |
nnoremap <C-H> <C-W><C-H> | |
"" FZF | |
nnoremap <silent> <leader>t :Files<CR> | |
nnoremap <silent> <leader>b :Buffers<CR> | |
" Search -- Need to install: brew install ripgrep | |
nnoremap <Leader>f :Rg<Space> | |
nnoremap <Leader>F :Rg!<Space> | |
" Vim Fugitive and FZF configuration | |
let g:fzf_commits_log_options = '--graph --color=always | |
\ --format="%C(yellow)%h%C(red)%d%C(reset) | |
\ - %C(bold green)(%ar)%C(reset) %s %C(blue)<%an>%C(reset)"' | |
nnoremap <silent> <Leader>c :Commits<CR> | |
nnoremap <silent> <Leader>bc :BCommits<CR> | |
" Run Specs | |
nnoremap <silent> <leader>rt :TestFile<CR> | |
nnoremap <silent> <leader>rs :TestNearest<CR> | |
nnoremap <silent> <leader>rl :TestLast<CR> | |
nnoremap <silent> <leader>q :<c-u>exec 'Tclose'<cr> | |
" All of your Plugins must be added before the following line | |
call vundle#end() " required | |
let &runtimepath.=',~/.vim/bundle/neoterm' | |
filetype plugin indent on " required | |
" To ignore plugin indent changes, instead use: | |
filetype plugin on | |
" | |
" Brief help | |
" :PluginList - list configured plugins | |
" :PluginInstall(!) - install (update) plugins | |
" :PluginSearch(!) foo - search (or refresh cache first) for foo | |
" :PluginClean(!) - confirm (or auto-approve) removal of unused plugins | |
" Color Scheme | |
colo gruvbox | |
set background=dark " Setting dark mode | |
set t_Co=256 | |
let NERDTreeWinSize=80 | |
let g:test#strategy = "neoterm" | |
let g:neoterm_shell = '$SHELL -l' " use the login shell | |
let g:neoterm_default_mod = 'vert' | |
let g:neoterm_autoscroll = 1 " autoscroll to the bottom when entering insert mode | |
let g:neoterm_size = 140 | |
let g:neoterm_fixedsize = 1 " fixed size. The autosizing was wonky for me | |
let g:neoterm_keep_term_open = 0 " when buffer closes, exit the terminal too. | |
command! -nargs=+ Tg :T git <args> | |
" see :h vundle for more details or wiki for FAQ | |
" Put your non-Plugin stuff after this line | |
syntax on | |
set rtp+=/usr/local/opt/fzf | |
" COC VIM Configuration | |
" ===================== DO NOT FORGET TO INSTALL SOLARGRAPH ========= | |
" gem install solargraph | |
" | |
let g:coc_global_extensions = ['coc-solargraph', 'coc-json'] | |
" Give more space for displaying messages. | |
set cmdheight=2 | |
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable | |
" delays and poor user experience. | |
set updatetime=300 | |
" Don't pass messages to |ins-completion-menu|. | |
set shortmess+=c | |
" Always show the signcolumn, otherwise it would shift the text each time | |
" diagnostics appear/become resolved. | |
if has("patch-8.1.1564") | |
" Recently vim can merge signcolumn and number column into one | |
set signcolumn=number | |
else | |
set signcolumn=yes | |
endif | |
" Use tab for trigger completion with characters ahead and navigate. | |
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by | |
" other plugin before putting this into your config. | |
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. | |
inoremap <silent><expr> <c-space> coc#refresh() | |
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current | |
" position. Coc only does snippet and additional edit on confirm. | |
" <cr> could be remapped by other vim plugin, try `:verbose imap <CR>`. | |
if exists('*complete_info') | |
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>" | |
else | |
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" | |
endif | |
" 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>') | |
else | |
call CocAction('doHover') | |
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) | |
" Formatting selected code. | |
xmap <leader>f <Plug>(coc-format-selected) | |
nmap <leader>f <Plug>(coc-format-selected) | |
augroup mygroup | |
autocmd! | |
" Setup formatexpr specified filetype(s). | |
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') | |
" Update signature help on jump placeholder. | |
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') | |
augroup end | |
" Applying codeAction to the selected region. | |
" Example: `<leader>aap` for current paragraph | |
xmap <leader>a <Plug>(coc-codeaction-selected) | |
nmap <leader>a <Plug>(coc-codeaction-selected) | |
" 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) | |
" Map function and class text objects | |
" NOTE: Requires 'textDocument.documentSymbol' support from the language server. | |
xmap if <Plug>(coc-funcobj-i) | |
omap if <Plug>(coc-funcobj-i) | |
xmap af <Plug>(coc-funcobj-a) | |
omap af <Plug>(coc-funcobj-a) | |
xmap ic <Plug>(coc-classobj-i) | |
omap ic <Plug>(coc-classobj-i) | |
xmap ac <Plug>(coc-classobj-a) | |
omap ac <Plug>(coc-classobj-a) | |
" Use CTRL-S for selections ranges. | |
" Requires 'textDocument/selectionRange' support of LS, ex: coc-tsserver | |
nmap <silent> <C-s> <Plug>(coc-range-select) | |
xmap <silent> <C-s> <Plug>(coc-range-select) | |
" Add `:Format` command to format current buffer. | |
command! -nargs=0 Format :call CocAction('format') | |
" Add `:Fold` command to fold current buffer. | |
command! -nargs=? Fold :call CocAction('fold', <f-args>) | |
" Add `:OR` command for organize imports of the current buffer. | |
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') | |
" Add (Neo)Vim's native statusline support. | |
" NOTE: Please see `:h coc-status` for integrations with external plugins that | |
" provide custom statusline: lightline.vim, vim-airline. | |
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} | |
" 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> | |
" PATHS | |
:set path+=/Users/thiagoramos/WORK/TIDY/gotidy/** | |
:set path+=/Users/thiagoramos/WORK/TIDY/billing_api/** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment