Skip to content

Instantly share code, notes, and snippets.

@danielsousaio
Created July 31, 2020 17:15
Show Gist options
  • Save danielsousaio/803dc67b1ed6d61da804f4b30d452f2d to your computer and use it in GitHub Desktop.
Save danielsousaio/803dc67b1ed6d61da804f4b30d452f2d to your computer and use it in GitHub Desktop.
Daniel's vimrc
call plug#begin()
Plug 'junegunn/fzf.vim'
Plug 'sheerun/vim-polyglot'
Plug 'dracula/vim'
Plug 'preservim/nerdtree'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
call plug#end()
map <C-n> :NERDTreeToggle<CR>
"" Turn-on dracula color scheme
syntax on
color dracula
" Leader
let mapleader = " "
set backspace=2 " Backspace deletes like most programs in insert mode
set nobackup
set nowritebackup
set noswapfile " http://robots.thoughtbot.com/post/18739402579/global-gitignore#comment-458413287
set history=50
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
set laststatus=2 " Always display the status line
set autowrite " Automatically :write before running commands
" When the type of shell script is /bin/sh, assume a POSIX-compatible
" shell for syntax highlighting purposes.
let g:is_posix = 1
" Softtabs, 2 spaces
set tabstop=2
set shiftwidth=2
set shiftround
set expandtab
" Display extra whitespace
set list listchars=tab:»·,trail:·,nbsp:·
" Use one space, not two, after punctuation.
set nojoinspaces
" Make it obvious where 80 characters is
set textwidth=80
set colorcolumn=+1
" Numbers
set relativenumber
set numberwidth=5
" Open new split panes to right and bottom, which feels more natural
set splitbelow
set splitright
" Quicker window movement
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
" Always use vertical diffs
set diffopt+=vertical
" copy to buffer
vmap <C-c> :w! ~/.vimbuffer<CR>
nmap <C-c> :.w! ~/.vimbuffer<CR>
" paste from buffer
nmap <C-v> :r ~/.vimbuffer<CR>
" persistent undos
set undofile
set undodir=~/.vim/undodir
" Keep all vim-related temp files in a single directory
let $TMPDIR = '/tmp/vim-' . $USER
silent! call mkdir($TMPDIR, '', 0700)
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if (&t_Co > 2 || has("gui_running")) && !exists("syntax_on")
syntax on
endif
filetype plugin indent on
" Get off my lawn
nnoremap <Left> :echoe "Use h boomer"<CR>
nnoremap <Right> :echoe "Use l boomer"<CR>
nnoremap <Up> :echoe "Use k boomer"<CR>
nnoremap <Down> :echoe "Use j boomer"<CR>
" junegunn/FZF
set grepprg=rg\ --vimgrep\ --smart-case\ --follow
command! -bang -nargs=* Rg call fzf#vim#grep("rg --column --line-number --no-heading --color=always --smart-case ".shellescape(<q-args>), 1, {'options': '--delimiter : --nth 4..'}, <bang>0)
set rtp+=~/.fzf
nnoremap <silent> <C-p> :Files<CR>
nnoremap <silent> <C-f> :Rg<CR>
" neoclide/coc
" 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment