Skip to content

Instantly share code, notes, and snippets.

@dep-deprecated
Last active July 22, 2016 16:59
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 dep-deprecated/5670757 to your computer and use it in GitHub Desktop.
Save dep-deprecated/5670757 to your computer and use it in GitHub Desktop.
my vimrc file
execute pathogen#infect()
" Inits
filetype off
au! BufRead,BufNewFile *.tmpl
setf tt2html
" fuzzyfind (https://github.com/junegunn/fzf)
set rtp+=~/.fzf
" Maps
map <C-t> :bn<cr>
map <C-w> :bd<cr>
map z :bnext<cr>
map Z :bprevious<cr>
map <F2> :set nowrap! <CR>
map <F4> :%s//gc<Left><Left><Left>
map <F5> :s//gc<Left><Left><Left>
map <F6> "=strftime("%c")<CR>P
map <tab> >>
map <s-tab> <<
map <C-v> :r !pbpaste<cr>
map <c-a> ggVG
nmap <leader>p :CtrlPnBuffer<CR>
"map \ :cclose<CR>
map \ :FZF -m<CR>
" Sets
set nocompatible
set ts=4
set number
set iskeyword-=_
set nuw=3
set nobackup
set nowritebackup
set noswapfile
set history=100
set hidden
set ruler
set title
set pastetoggle=<F2>
set ignorecase smartcase
set wildmenu
" set noautoindent smartindent
set shiftround
set nojoinspaces
set background=dark
set laststatus=2
set statusline=[%02n]\ %f\ %(\[%M%R%H]%)%=\ %4l,%02c%2V\ %P%*
set showmatch
set ff=unix
set backspace=indent,eol,start
set wildignore=.svn,CVS,.git,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif,*.pyc,*/venv/*,*docs/*,*.xml,*.o,*.obj,*.bak,*.exe
set incsearch
set cursorline
set hlsearch
set runtimepath+=~/temp.vim
" bind K to grep word under cursor
nn K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>
if executable('ag')
set grepprg=ag\ --vimgrep\ $*
set grepformat=%f:%l:%c:%m
let g:CtrlSpaceGlobCommand = 'ag -l --nocolor -g ""'
endif
" Tabs
autocmd FileType * set softtabstop=4|set shiftwidth=4|set expandtab
filetype indent on
" Show trailing whitespace:
highlight ExtraWhitespace ctermbg=darkgreen guibg=darkgreen
match ExtraWhitespace /\v\s+$/
" Paren matching
highlight MatchParen ctermbg=darkblue guibg=blue
" Highlighting
if has("gui_running")
syntax on
endif
if &diff
syntax off
endif
syntax enable
highlight LineNr ctermfg=grey
highlight LineNr term=bold cterm=NONE ctermfg=DarkGrey ctermbg=NONE gui=NONE guifg=DarkGrey guibg=NONE
" Remove whitespace on save
autocmd BufWritePre * :%s/\s\+$//e
" Show only the filename in the buffer tab
let g:buftabs_only_basename=1
" Theme
colorscheme darkzen
" Because Brandon rules
let g:ctrlp_user_command = ['.git/', 'git ls-files --cached --others --exclude-standard %s']
" Grep current word
if executable('ag')
set grepprg=ag\ --vimgrep\ $*
set grepformat=%f:%l:%c:%m
endif
function! GetCurrentWord()
return shellescape(expand("<cword>"))
endfunction
nn gsa :let cmd="silent grep! " . GetCurrentWord() <bar> exec cmd <bar> call histadd("cmd", cmd)<CR>
nn gsp :let cmd="silent grep! " . GetCurrentWord() . " --ignore tests --ignore migrations --ignore core_data.json --ignore schema.sql" <bar> exec cmd <bar> call histadd("cmd", cmd)<CR>
@wieczorek1990
Copy link

Nice one.
See janus.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment