Skip to content

Instantly share code, notes, and snippets.

@adam-beck
Created November 17, 2014 14:29
Show Gist options
  • Save adam-beck/f82b46a0db8db6af8738 to your computer and use it in GitHub Desktop.
Save adam-beck/f82b46a0db8db6af8738 to your computer and use it in GitHub Desktop.
execute pathogen#infect()
set t_Co=256
let mapleader =","
map <leader>n :bn<cr>
map <leader>p :bp<cr>
map <leader>d :bd<cr>
" open the current buffer in a new tab
map <leader>t :tabnew %<cr>
" switch to last used buffer
map <leader>g :e#<cr>
" list buffers
map <leader>l :ls<cr>
" use jk as another way to switch to normal mode
inoremap jk <esc>
nnoremap <leader>1 :1b<cr>
nnoremap <leader>2 :2b<cr>
nnoremap <leader>3 :3b<cr>
nnoremap <leader>4 :4b<cr>
nnoremap <leader>5 :5b<cr>
nnoremap <leader>6 :6b<cr>
nnoremap <leader>7 :7b<cr>
nnoremap <leader>8 :8b<cr>
nnoremap <leader>9 :9b<cr>
nnoremap <leader>0 :10b<cr>
" search visually selected text with //
vnorem // y/<c-r>0<cr>
" toggle paste mode with F11
" also provides visual feedback in the status line when not in insert mode
nnoremap <F11> :set invpaste paste?<CR>
set pastetoggle=<F11>
set showmode
"allow to switch buffers by {Buffer#}gb (e.g. 52gb --> buffer 52)
let c = 1
while c <= 99
execute "nnoremap " . c . "gb :" . c . "b\<cr>"
let c += 1
endwhile
syntax on
filetype plugin indent on
set hidden " allow buffers to be hidden instead of closing
set nowrap " do not wrap lines
set tabstop=4 " a tab is 4 spaces
set autoindent " always set autoindenting on
set number " show the line numbers
set shiftwidth=4 " set number of spaces to use for autoindenting
set expandtab
set smarttab
set incsearch " start searching as soon as first characters are entered
set laststatus=2 " displays vim powerline without split
let g:airline_theme='powerlineish'
set background=light
colorscheme solarized
set wildchar=<Tab> wildmenu wildmode=full
set wildcharm=<C-Z>
nnoremap <F10> :b <C-Z>
" tmux-complete configuration
let g:tmuxcomplete#trigger = 'completefunc'
" ctrlp
"set runtimepath^=~/.vim/bundle/ctrlp.vim
let g:ctrlp_map = '<c-p>' " change the default mapping
let g:ctrlp_cmd = 'CtrlP' " change the defualt command to invoke CtrlP
set wildignore+=*/tmp*,*.so,*.swp,*.zip " exclude files and directories
let g:ctrlp_custom_ignore = '\v[\/](.*reports.*|\.idea|node_modules|bower_components|dist|target)|(\.(swp|ico|git))$'
let g:ctrlp_show_hidden = 1 " index dotfiles
" airline
"let g:airline#extensions#tabline#enabled = 1 " enable the list of buffers
"let g:airline#extensions#tabline#fnamemod = ':t' " show just the filename
let g:airline_section_b = '%{fugitive#head()}'
" vim git-gutter
" let g:gitgutter_sign_column_always = 1 " always show the git-gutter
highlight SignColumn ctermbg=Black
" 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>
" syntastic
let g:syntastic_javascript_checkers = ['jshint', 'jscs']
nnoremap <silent> <C-d> :lclose<CR>:bdelete<CR>
cabbrev <silent> bd lclose\|bdelete
" allows me to use Alt key
" http://stackoverflow.com/questions/6778961/alt-key-shortcuts-not-working-on-gnome-terminal-with-vim
" not sure if this breaks anything else
let c='a'
while c <= 'z'
exec "set <A-".c.">=\e".c
exec "imap \e".c." <A-".c.">"
let c = nr2char(1+char2nr(c))
endw
set timeout ttimeoutlen=50
nnoremap <A-j> :m .+1<CR>
nnoremap <A-k> :m .-2<CR>
inoremap <A-j> <ESC>:m .+1<CR>==gi
inoremap <A-k> <ESC>:m .-2<CR>==gi
vnoremap <A-j> :m '>+1<CR>gv==gv
vnoremap <A-k> :m '<-2<CR>gv==gv
nnoremap <C-e> :NERDTreeToggle<CR>
let g:NERDTreeWinSize=50
autocmd BufNewFile,BufReadPost *.md set filetype=markdown
" prevent window from scrolling when switching buffers
if v:version >= 700
au BufLeave * let b:winview = winsaveview()
au BufEnter * if(exists('b:winview')) | call winrestview(b:winview) | endif
endif
let g:tmuxline_powerline_separators = 0
" code folding
set foldmethod=syntax
" Keep all folds open when a file is opened
augroup OpenAllFoldsOnFileOpen
autocmd!
autocmd BufRead * normal zR
augroup END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment