Skip to content

Instantly share code, notes, and snippets.

@kyleterry
Created April 22, 2020 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyleterry/340f5da367643dbcd2ab5b7b9555b0b7 to your computer and use it in GitHub Desktop.
Save kyleterry/340f5da367643dbcd2ab5b7b9555b0b7 to your computer and use it in GitHub Desktop.
set nocompatible
set nobackup
set nowritebackup
set noswapfile
call plug#begin()
Plug 'morhetz/gruvbox'
Plug 'jlanzarotta/bufexplorer'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-commentary'
Plug 'mattn/vim-gist'
Plug 'mattn/webapi-vim'
Plug 'kien/ctrlp.vim'
Plug 'mileszs/ack.vim'
Plug 'junegunn/fzf', { 'dir': '~/.config/fzf', 'do': './install --all' }
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'govim/govim'
Plug 'PotatoesMaster/i3-vim-syntax'
Plug 'majutsushi/tagbar'
call plug#end()
syntax on
filetype on
filetype plugin on
let mapleader=','
set nu
set relativenumber
set numberwidth=1
set title
set confirm
set encoding=utf-8
set t_Co=256
set background=dark
colorscheme gruvbox
let g:gruvbox_italic=1
set matchpairs+=<:>
set scrolloff=3 " Keep 3 context lines above and below the cursor
set backspace=2 " Allow backspacing over autoindent, EOL, and BOL
set showmatch " Briefly jump to a paren once it's balanced
set nowrap " don't wrap text
set linebreak " don't wrap textin the middle of a word
set autoindent " always set autoindenting on
set tabstop=4 " <tab> inserts 4 spaces
set shiftwidth=4 " but an indent level is 2 spaces wide.
set softtabstop=4 " <BS> over an autoindent deletes both spaces.
set expandtab " Use spaces, not tabs, for autoindent/tab key.
set shiftround " rounds indent to a multiple of shiftwidth
set laststatus=2
" searching
set ignorecase
set smartcase
set smarttab
set hlsearch
set incsearch
nnoremap <silent> <leader><space> :nohlsearch<cr>
" diff
set diffopt+=vertical
" remove trailing whitespace
nnoremap <leader>S :%s/\s\+$//<cr>:let @/=''<CR>
" show background lines for row/col
set cursorcolumn
set cursorline
nnoremap <silent> <Leader>c :set cursorline! cursorcolumn!<CR>
" ctrl-jklm navigates around split windows
map <c-j> <c-w>j
map <c-k> <c-w>k
map <c-l> <c-w>l
map <c-h> <c-w>h
" better selection movement.
" after using > to indent or deindent, we use gv to reselect
" the last selection allowing us to indent selected text more
" than once.
vnoremap > ><CR>gv
vnoremap < <<CR>gv
" NERDTree
let g:NERDTreeDirArrows=1
map <leader>nt :NERDTreeToggle<CR>
" ctrlp
let g:ctrlp_map = '<leader>f'
map <leader>b :CtrlPBuffer<CR>
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn|collected_static)$',
\ 'file': '\v\.(exe|so|dll|pyc|swp|swo)$',
\}
" tagbar
nmap <leader>tb :TagbarToggle<CR>
nmap <leader>tf :TagbarOpen j<CR>
let g:tagbar_type_go = {
\ 'ctagstype' : 'go',
\ 'kinds' : [
\ 'p:package',
\ 'i:imports:1',
\ 'c:constants',
\ 'v:variables',
\ 't:types',
\ 'n:interfaces',
\ 'w:fields',
\ 'e:embedded',
\ 'm:methods',
\ 'r:constructor',
\ 'f:functions'
\ ],
\ 'sro' : '.',
\ 'kind2scope' : {'t' : 'ctype', 'n' : 'ntype'},
\ 'scope2kind' : {'ctype' : 't','ntype' : 'n'},
\ 'ctagsbin' : 'gotags',
\ 'ctagsargs' : '-sort -silent'
\ }
" completion
set completeopt=popup
set completepopup=align:menu,border:off,highlight:Pmenu
" grep
nnoremap <Leader>a :Ack!<Space>
if executable('rg')
let g:ackprg = 'rg --vimgrep'
endif
autocmd FileType go nmap <buffer> <leader>a :Ack! -g '!vendor'<Space>
" language: go
call govim#config#Set("QuickfixAutoDiagnostics", 1)
augroup go
autocmd!
autocmd FileType go nmap <silent> <buffer> <leader>h :call GOVIMHover()<CR>
autocmd FileType go nmap <silent> <buffer> gh :call GOVIMHover()<CR>
autocmd FileType go nmap <silent> <buffer> gr :call GOVIMReferences()<CR>
autocmd FileType go nmap <silent> <buffer> gs :call GOVIMStringFn()<CR>
augroup END
" markdown
au BufRead,BufNewFile *.md setlocal textwidth=80
" set most files to a common space-based indent of 2
autocmd FileType
\ c,json,ruby,eruby,haml,yaml,coffee,js,javascript,html,css,sass,gitconfig
\ setlocal expandtab shiftwidth=2 softtabstop=2 tabstop=2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment