Skip to content

Instantly share code, notes, and snippets.

@xlbruce
Last active April 12, 2019 13:39
Show Gist options
  • Select an option

  • Save xlbruce/a926214119ad6e43b9bcfc69e4f720ea to your computer and use it in GitHub Desktop.

Select an option

Save xlbruce/a926214119ad6e43b9bcfc69e4f720ea to your computer and use it in GitHub Desktop.
My ~/.vimrc file
" Vundle setup
set nocompatible
filetype off
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'vim-airline/vim-airline'
"Plugin 'kien/ctrlp.vim'
Plugin 'vimwiki'
Plugin 'pearofducks/ansible-vim'
Plugin 'scrooloose/nerdtree'
Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'terryma/vim-multiple-cursors'
Plugin 'wincent/command-t'
Plugin 'MarcWeber/vim-addon-mw-utils'
Plugin 'tomtom/tlib_vim'
Plugin 'garbas/vim-snipmate'
Plugin 'honza/vim-snippets'
Plugin 'tpope/vim-commentary'
"Plugin 'vim-syntastic/syntastic'
" pip install flake8
Plugin 'nvie/vim-flake8'
Plugin 'sjl/gundo.vim'
Plugin 'godlygeek/tabular'
"Plugin 'Valloric/YouCompleteMe'
Plugin 'mtth/scratch.vim'
Plugin 'nathanaelkane/vim-indent-guides'
Plugin 'nginx.vim'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-repeat'
Plugin 'martinda/Jenkinsfile-vim-syntax'
Plugin 'hashivim/vim-terraform'
" Themes
Plugin 'YorickPeterse/happy_hacking.vim'
call vundle#end()
filetype plugin indent on
" My config
color happy_hacking
set backspace=indent,eol,start
set number
set relativenumber
set autoread
set hlsearch
set incsearch
set tabstop=4 softtabstop=4 shiftwidth=4 expandtab
set splitbelow
set splitright
set wildmenu
" Vim air-line plugin
set laststatus=2
set shellslash
set encoding=utf-8
syntax on
" CtrlP plugin
let g:ctrlp_custom_ignore = {
\ 'dir': '.*\.(git|hg|svn|target)$',
\ 'file': '\v\.(exe|so|dll|class|pyc)$',
\ }
" Tab maps
nmap <C-H> <Nop>
nmap <C-t> <Nop>
nmap <C-t> :tabnew<CR>
nmap <C-H> :tabprev<CR>
nmap <C-L> :tabnext<CR>
nmap <C-J> :tabfirst<CR>
nmap <C-K> :tablast<CR>
nmap <C-q> :q<CR>
imap <F5> <C-R>=strftime("%d/%m/%Y %H:%M")<CR>
if $VIM_CRONTAB == "true"
set nobackup
set nowritebackup
endif
" Avoid backspace problems http://vim.wikia.com/wiki/Backspace_and_delete_problems
set backspace=indent,eol,start
set grepprg=grep\ -nH\ $*
" The Silver Searcher
if executable('ag')
" Use ag over grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 1
endif
" Persistent undo
set undodir=$HOME/.vim/undo
set undofile
" vimwiki
let g:vimwiki_list = [{'path': '~/vimwiki/', 'syntax': 'markdown', 'ext': '.md'}]
nnoremap <space> za
nnoremap <Leader>n :set number! <CR> :set relativenumber! <CR>
nnoremap <Leader>s :term<CR>
nnoremap <Leader>d :windo diffthis<CR>
nnoremap <C-f> :NERDTreeToggle<CR>
" Return cursor to where left
au BufWinLeave ?* mkview
au BufWinEnter ?* silent loadview
" Syntax config
au BufRead,BufNewFile */ansible/*.yml set filetype=yaml.ansible
au BufRead,BufNewFile *.j2 set filetype=jinja
au BufRead,BufNewFile *.md set filetype=markdown
" `gf` opens file under cursor in a new vertical split
nnoremap gf :vertical wincmd f<CR>
" Command-T config
nmap <silent> <Leader>r <Plug>(CommandTMRU)
" Gundo
nnoremap <F5> :GundoToggle<CR>
cab W w
cab Q q
cab Q! q!
cab Wq wq
cab Wq! wq!
" vim-indent-guides
let g:indent_guides_enable_on_vim_startup = 1
" command-t
let g:CommandTFileScanner = 'find'
set wildignore+=*/node_modules
" vim-terraform
let g:terraform_remap_spacebar=1
let g:terraform_fold_sections=1
let g:terraform_align=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment