Last active
July 22, 2017 03:54
-
-
Save PYuen1029/19653a42c4883ac27953f537579b638d to your computer and use it in GitHub Desktop.
This file contains 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
" 256-color terminal | |
set t_Co=256 | |
set nocompatible | |
syntax on | |
set backspace=indent,eol,start | |
let mapleader = ',' | |
set hlsearch | |
" Make sure to install Vundle first before using this | |
"---------------Visuals---------------" | |
colorscheme elflord | |
" change color of cursor | |
if &term =~ "xterm\\|rxvt" | |
" use an orange cursor in insert mode | |
let &t_SI = "\<Esc>]12;orange\x7" | |
" use a red cursor otherwise | |
let &t_EI = "\<Esc>]12;red\x7" | |
silent !echo -ne "\033]12;red\007" | |
" reset cursor when vim exits | |
autocmd VimLeave * silent !echo -ne "\033]112\007" | |
" use \003]12;gray\007 for gnome-terminal and rxvt up to version 9.21 | |
endif | |
"---------------Split Management---------------" | |
nmap <C-J> <C-W><C-J> | |
nmap <C-K> <C-W><C-K> | |
nmap <C-H> <C-W><C-H> | |
nmap <C-L> <C-W><C-L> | |
"--------------Non-Document Mappings----------------" | |
"makes it easy to edit the vimrc fi | |
nmap <Leader>ev :tabedit $MYVIMRC<CR> | |
nmap <Leader>ep :tabedit ~/.vim/plugins.vim<CR> | |
nmap <Leader>es :tabedit ~/.vim/snippets/ | |
nmap <leader>tc :tabclose<CR> | |
"Add simple highlight removal." | |
nmap <Leader><space> :nohlsearch<CR> | |
"Make NERDTree easier to toggle. | |
nmap <Leader>nt :NERDTreeToggle<CR> | |
nmap <Leader>f :tag<space> | |
"Show File hotkey | |
nmap <Leader>sf :echo expand('%:p')<CR> | |
"code-folding settings | |
set foldmethod=manual "manual fold method" | |
set foldnestmax=10 "deepest fold is 10 levels | |
set nofoldenable "dont fold by default | |
set foldlevel=1 " | |
"--------------Search Mappings----------------" | |
"Case-insensitive search | |
nmap <Leader>cis :/\c | |
"Search for string, showing count of results" | |
cmap s!! %s/stringa//gn | |
"search and replace, can be appended to range from a visual | |
cmap sr!! s/stringa/stringb/g | |
"Search and Replace within Visual for string after V (hidden for convenience) | |
"and stringb | |
cmap srv!! s/\%V/stringb/g | |
"Replace Spaces with Commas within visual | |
cmap rsc!! s/\%V /-/g | |
"search for visual selection with // | |
vnoremap // y/<C-R>"<CR> | |
"Search and Delete the Visual selection with ,sdv | |
vnoremap <Leader>sdv y:%s/<C-R>//g | |
"Search and Replace in the Whole document | |
cmap srw!! :%s/foo/bar/g | |
"--------------Documentation Mappings----------------" | |
" PHP documenter script bound to ,doc | |
"autocmd FileType php inoremap <Leader>doc <ESC>:call PhpDocSingle()<CR> | |
"autocmd FileType php nnoremap <Leader>doc :call PhpDocSingle()<CR> | |
"autocmd FileType php vnoremap <Leader>doc :call PhpDocRange()<CR> | |
nmap <Leader>doc :call PhpDoc()<CR> | |
""--------------Savevers Stuff----------------" | |
"set backup | |
"set patchmode=.clean | |
"let savevers_dirs="~/backups" | |
"--------------Code Editing Shortcuts----------------" | |
nmap <Leader>phpl :!php -l %<CR> | |
"---------------File Management---------------" | |
"Write with sudo from Vim" | |
cmap w!! w !sudo tee >/dev/null % | |
"---------------Auto-Commands---------------" | |
"Automatically source the vimrc file on save. | |
augroup autosourcing | |
autocmd! | |
autocmd BufWritePost .vimrc source % | |
augroup END | |
"---------------VIM CHEAT SHEET-------------" | |
"| code-folding |" | |
"za -- basic | |
"zM -- fold everything | |
"zR -- unfold everything | |
"zm and zr -- more specific | |
"| select |" | |
" vat -- visual select basic containing html element | |
" O/o toggle cursor between opening and closing tags | |
" vi' -- visual select everything between ' (applicable to [, {, etc.) | |
" di' -- delete everything between ' (applicable to [, {, etc.) | |
" | |
" | |
"| miscellaneous |" | |
"gg=G -- re-indent the entire file | |
"| all lines in file |" | |
" :%y -- yank all lines | |
" :%d -- delete all lines | |
" | |
"| ctags |" | |
"!ctags-R -- updates ctags file in vim | |
"ctrl + ] -- find ctag under cursor | |
" | |
"| file movement |" | |
"ctrl + 6 -- go back to previous edit locatoin | |
"ctrl + O and ctrl + I go to cursor positions before older jumps and back | |
"again. | |
" | |
"| vim surround | " | |
"ysiw] will surround it in [] | |
"cs[" will replace the [] with "" | |
" | |
"| search |" | |
" #, * will search backward, forward, for word under cursor | |
"| splits |" | |
" # set scrollbind binds the window to scroll with other windows that also have | |
" set scrollbind | |
" # vertical resize and resize [+/-] n resizes the width and height | |
" respectively |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment