Last active
June 17, 2016 00:16
-
-
Save wilmoore/3901161 to your computer and use it in GitHub Desktop.
Vim Configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" My Personal Vim Configuration | |
" Wil Moore III <[email protected]> | |
" | |
" I keep this configuration documented here: | |
" https://gist.github.com/3901161 | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
"""""""""""""""""""""""""""""" | |
"" base | |
"""""""""""""""""""""""""""""" | |
" no annoying sound on errors | |
set noerrorbells | |
set novisualbell | |
set t_vb= | |
set tm=500 | |
"""""""""""""""""""""""""""""" | |
"" files, backups and undo | |
"""""""""""""""""""""""""""""" | |
" Turn backup off, since most stuff is in source control | |
set nobackup | |
set nowb | |
set noswapfile | |
"""""""""""""""""""""""""""""" | |
"" mouse | |
"""""""""""""""""""""""""""""" | |
set mouse=a | |
set ttym=xterm2 | |
"""""""""""""""""""""""""""""" | |
"" keyboard | |
"""""""""""""""""""""""""""""" | |
" <Ctrl-C> -- copy selected to system clipboard (see: http://vim.wikia.com/wiki/Quick_yank_and_paste) | |
vmap <C-C> "*y | |
" <Ctrl-A> -- visually select all and copy to system clipboard | |
map <C-A> ggvG$"*y<C-o><C-o> | |
" ,cp copies path to clipboard | |
nmap <leader>cp :let @" = expand("%:p")<cr><cr> | |
"""""""""""""""""""""""""""""" | |
"" formatting | |
"""""""""""""""""""""""""""""" | |
" do not wrap | |
set nowrap | |
set textwidth=0 | |
set wrapmargin=0 | |
"""""""""""""""""""""""""""""" | |
"" colors and Fonts | |
"""""""""""""""""""""""""""""" | |
" Enable syntax highlighting | |
syntax enable | |
colorscheme solarized | |
let g:solarized_termcolors=256 | |
let g:solarized_termtrans=1 | |
set t_Co=256 | |
set background=dark | |
" Set extra options when running in GUI mode | |
if has("gui_running") | |
set guioptions-=T | |
set guioptions+=e | |
set t_Co=256 | |
set guitablabel=%M\ %t | |
endif | |
" Set utf8 as standard encoding and en_US as the standard language | |
set encoding=utf8 | |
" Use Unix as the standard file type | |
set ffs=unix,dos,mac | |
"""""""""""""""""""""""""""""" | |
"" testing | |
"""""""""""""""""""""""""""""" | |
" <leader>t runs tests (make test) | |
map <leader>t :make test<cr> | |
"""""""""""""""""""""""""""""" | |
"" editing | |
"""""""""""""""""""""""""""""" | |
" <leader>pp toggles paste mode | |
map <leader>pp :setlocal paste!<cr> | |
" <leader>ss toggles spell checking | |
map <leader>ss :setlocal spell!<cr> | |
" <leader>hh turns off search highlight | |
map <leader>hh :noh<cr> | |
"""""""""""""""""""""""""""""" | |
"" splits / windows | |
"""""""""""""""""""""""""""""" | |
" instead of ctrl-w then one of {j,k,h,l}, just ctrl-{j,k,h,l}: | |
" http://robots.thoughtbot.com/post/48275867281/vim-splits-move-faster-and-more-naturally | |
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> | |
"""""""""""""""""""""""""""""" | |
"" tabs | |
"""""""""""""""""""""""""""""" | |
" Maximum number of tabs to display | |
set tabpagemax=50 | |
" Useful mappings for managing tabs (Vim 7 specific mappings) | |
if version >= 700 | |
nnoremap <CS-Right> :tabnext<cr> | |
nnoremap <CS-Left> :tabprevious<cr> | |
nnoremap <C-n> :tabnew<cr> | |
nnoremap <C-t> :tabclose<cr> | |
nnoremap <C-m> :tabmove<cr> | |
endif | |
" opens a new tab edit the file whose name is under or after the cursor | |
:map gt :tabedit <cfile><CR> | |
" Opens a new tab with the current buffer's path | |
" Super useful when editing files in the same directory | |
map <leader>te :tabedit <c-r>=expand("%:p:h")<cr>/ | |
" Switch CWD to the directory of the open buffer | |
map <leader>cd :cd %:p:h<cr>:pwd<cr> | |
" Specify the behavior when switching between buffers | |
try | |
set switchbuf=useopen,usetab,newtab | |
set stal=2 | |
catch | |
endtry | |
" Return to last edit position when opening files (You want this!) | |
autocmd BufReadPost * | |
\ if line("'\"") > 0 && line("'\"") <= line("$") | | |
\ exe "normal! g`\"" | | |
\ endif | |
" Remember info about open buffers on close | |
set viminfo^=% | |
"""""""""""""""""""""""""""""" | |
"" fugitive.vim | |
"""""""""""""""""""""""""""""" | |
" Github domains configuration | |
let g:fugitive_github_domains = ['http://github.webapps.rr.com'] | |
"""""""""""""""""""""""""""""" | |
"" open all the things | |
"""""""""""""""""""""""""""""" | |
" open url under cursor | |
map gu :!open <cfile><cr> | |
"""""""""""""""""""""""""""""" | |
"" git | |
"""""""""""""""""""""""""""""" | |
" [goto] Git Conflict | |
nmap gitc /^<<<<<<< HEAD$<cr> | |
"""""""""""""""""""""""""""""" | |
"" NERDTreeFind | |
"""""""""""""""""""""""""""""" | |
" <leader>f invokes NERDTreeFind | |
nmap <leader>f :NERDTreeFind<cr> | |
"""""""""""""""""""""""""""""" | |
"" search (ack) | |
"""""""""""""""""""""""""""""" | |
" ensure grep commands still work even if `ack` is not installed | |
if executable("ack") | |
" use ack instead of grep | |
set grepprg=ack\ -H\ --nogroup\ --nocolor\ --column | |
set grepformat=%f:%l:%c:%m | |
endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""""""""""""""""""""""""""""" | |
"" disable janus plugins | |
"""""""""""""""""""""""""""""" | |
" call janus#disable_plugin('fugitive') | |
"""""""""""""""""""""""""""""" | |
"" nerdtree.vim | |
"""""""""""""""""""""""""""""" | |
let NERDTreeShowHidden=1 | |
let NERDTreeShowBookmarks=1 | |
let NERDTreeWinSize=26 | |
"""""""""""""""""""""""""""""" | |
"" vim-nerdtree-tabs.vim | |
"""""""""""""""""""""""""""""" | |
map <F6> <plug>NERDTreeTabsToggle<CR> | |
let g:nerdtree_tabs_startup_cd=1 " When given a directory name as a command line parameter when launching Vim, :cd into it. | |
let g:nerdtree_tabs_open_on_gui_startup=1 " Open NERDTree on gvim/macvim startup | |
let g:nerdtree_tabs_open_on_console_startup=1 " Open NERDTree on console vim startup | |
let g:nerdtree_tabs_open_on_new_tab=1 " Open NERDTree on new tab creation | |
let g:nerdtree_tabs_meaningful_tab_names=1 " Unfocus NERDTree when leaving a tab for descriptive tab names | |
let g:nerdtree_tabs_autoclose=1 " Close current tab if there is only one window in it and it's NERDTree | |
let g:nerdtree_tabs_synchronize_view=1 " Synchronize view of all NERDTree windows (scroll and cursor position) | |
let g:nerdtree_tabs_focus_on_files=1 " When switching into a tab, make sure that focus is on the file window, | |
" not in the NERDTree window. (Note that this can get annoying if you use | |
" NERDTree's feature "open in new tab silently", as you will lose focus on the NERDTree.) | |
" When switching into a tab, make sure that focus is on the file window, not in the NERDTree window. | |
let g:nerdtree_tabs_focus_on_files=1 | |
" t " Opens the selected file in a new tab. | |
" T " The same as |NERDTree-t| except that the focus is kept in the current tab. | |
" i " Opens the selected file in a new split window and puts the cursor in the new window. | |
" gi " The same as |NERDTree-i| except that the cursor is not moved. |NERDTree-i|). | |
" s " Opens the selected file in a new vertically split window and puts the cursor in the new window. | |
" gs " The same as |NERDTree-s| except that the cursor is not moved. | |
" x " Closes the parent of the selected node. | |
" X " Recursively closes all children of the selected directory. | |
" o " Open a file or a directory. | |
" O " Recursively opens the selelected directory. | |
"""""""""""""""""""""""""""""" | |
"" nerdtree.vim | |
"""""""""""""""""""""""""""""" | |
" auto-open / auto-close Tagbar | |
"au BufHidden * :TagbarClose | |
"au BufUnload * :TagbarClose | |
"au BufReadPre,FileReadPre *.{php,js,html,htm,rb,py,coffee,c,cpp,sh,bash,zsh,scala} :TagbarOpen | |
"""""""""""""""""""""""""""""" | |
"" numbers.vim | |
"""""""""""""""""""""""""""""" | |
"" toggle number | |
nnoremap <F3> :NumbersToggle<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
NOTE: I am using Janus; however, I'm not really using anything Janus-specific so I'll be going vanilla vim + vundle soon.