Skip to content

Instantly share code, notes, and snippets.

@lmduc
Last active July 19, 2019 09:15
Show Gist options
  • Save lmduc/6428fc3be86b02481b5eed0b0a88bf8c to your computer and use it in GitHub Desktop.
Save lmduc/6428fc3be86b02481b5eed0b0a88bf8c to your computer and use it in GitHub Desktop.
set nocompatible
filetype off
let mapleader=" "
set t_Co=256
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
" NERDTree
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
map <leader>eo :NERDTreeMirrorToggle<cr>
map <leader>ec :NERDTreeFind<cr>
let NERDTreeQuitOnOpen=1
let g:nerdtree_tabs_autofind=1
" Theme
Plugin 'flazz/vim-colorschemes'
syntax enable
set background=dark
colorscheme flattown
hi StatusLine ctermbg=215 ctermfg=25
hi VertSplit ctermbg=153 guibg=153
hi StatusLineNC ctermfg=20 ctermbg=153 guibg=153 guifg=20
hi LineNr ctermfg=45
" Easymotion
Plugin 'Lokaltog/vim-easymotion'
" Search
Plugin 'rking/ag.vim'
nmap gw :Ag! <cword> <cr>
" NERDTREE + ag
Plugin 'taiansu/nerdtree-ag'
" Jump files
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'tacahiroy/ctrlp-funky'
let g:ctrlp_max_depth=50000
let g:ctrlp_max_files=50000
nmap <leader>oo :CtrlP<cr>
nmap <leader>oc :CtrlPClearCache<cr>
let g:ctrlp_extensions = ['funky']
nmap <leader>of :CtrlPFunky<cr>
" Tabular
Plugin 'godlygeek/tabular'
nmap <Leader>a& :Tabularize /&<CR>
vmap <Leader>a& :Tabularize /&<CR>
nmap <Leader>a= :Tabularize /=<CR>
vmap <Leader>a= :Tabularize /=<CR>
nmap <Leader>a=> :Tabularize /=><CR>
vmap <Leader>a=> :Tabularize /=><CR>
nmap <Leader>a: :Tabularize /:<CR>
vmap <Leader>a: :Tabularize /:<CR>
nmap <Leader>a:: :Tabularize /:\zs<CR>
vmap <Leader>a:: :Tabularize /:\zs<CR>
nmap <Leader>a, :Tabularize /,<CR>
vmap <Leader>a, :Tabularize /,<CR>
nmap <Leader>a,, :Tabularize /,\zs<CR>
vmap <Leader>a,, :Tabularize /,\zs<CR>
nmap <Leader>a<Bar> :Tabularize /<Bar><CR>
" Auto pairs
Plugin 'jiangmiao/auto-pairs'
" Rspec
Plugin 'thoughtbot/vim-rspec'
map <leader>rt :call RunCurrentSpecFile()<cr>
map <leader>rs :call RunNearestSpec()<cr>
map <leader>ra :call RunAllSpecs()<cr>
map <leader>rl :call RunLastSpec()<cr>
let g:rspec_command = 'call Send_to_Tmux("bundle exec rspec {spec}\n")'
let g:rspec_runner = "os_x_iterm"
" Tmux
Plugin 'jgdavey/tslime.vim'
" Commenter
Plugin 'scrooloose/nerdcommenter'
" Git
Plugin 'tpope/vim-fugitive'
" Ident visual
" :IndentGuidesEnable
" :IndentGuidesDisable
" :IndentGuidesToggle
Plugin 'nathanaelkane/vim-indent-guides'
let g:indent_guides_enable_on_vim_startup = 1
let g:indent_guides_auto_colors = 0
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=red ctermbg=239
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=green ctermbg=235
" Rails power tool
" :Rails
Plugin 'tpope/vim-rails'
call vundle#end()
filetype plugin indent on
" Fast saving
nmap <leader>w :w!<cr>
" Fast quitting
nmap <leader>q :q<cr>
" Fast copy to clipboard
vmap <leader>yc "*y<cr>
" Tabs to spaces
set expandtab
set tabstop=2
set shiftwidth=2
set smarttab
set ai "Auto indent
set si "Smart indent
set wrap "Wrap lines"
" 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>
" Show line numbers
set number
" Show current line and current column
set cursorline! cursorcolumn!
" Set to auto read when a file is changed from the outside
set autoread
" Ignore case when searching
set ignorecase
" Highlight search results
set hlsearch
" Makes search act like search in modern browsers
set incsearch
" Show matching brackets when text indicator is over them
set showmatch
" How many tenths of a second to blink when matching brackets
set mat=2"
" Set utf8 as standard encoding and en_US as the standard language
set encoding=utf8
" Turn backup off, since most stuff is in SVN, git et.c anyway...
set nobackup
set nowb
set noswapfile
" Switch focus on new split
set splitbelow
set splitright
" Not show breaking line
set nowrap
" Turn off beep and flash
set noerrorbells visualbell t_vb=
autocmd GUIEnter * set visualbell t_vb=
" Remove trailing spaces when saving
autocmd BufWritePre * :%s/\s\+$//e
" Backspace
set backspace=indent,eol,start
" Vim gf
set path+=**
" Vim fold
set foldmethod=indent
set foldnestmax=10
set nofoldenable
set foldlevel=2
" VIM to tmux
let g:tslime_always_current_session = 1
let g:tslime_always_current_window = 1
nmap <leader>tdg :Tmux rails docs:generate<CR>
nmap <leader>tgpo :Tmux gpo<CR>
nmap <leader>tgru :Tmux gru<CR>
nmap <leader>tmg :Tmux rails db:migrate && rails db:migrate RAILS_ENV=test<CR>
nmap <leader>trb :Tmux rubocop<CR>
nmap <leader>trt :Tmux bundle exec rspec<CR>
nmap <leader>tbc :Tmux g++ -Wall -Wextra -pedantic -std=c++11 -O2 -Wshadow -Wformat=2 -Wfloat-equal -Wconversion -Wshift-overflow -Wcast-qual -Wcast-align -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -fsanitize=address -fsanitize=undefined -fno-sanitize-recover=undefined,integer -fstack-protector -std=c++14 -o test test.cpp && ./test<CR>
nmap <leader>tbn :Tmux cp test.cpp test$RANDOM.bk && cp template.cpp test.cpp<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment