Last active
March 26, 2018 11:44
-
-
Save brianyang/1626363 to your computer and use it in GitHub Desktop.
vimrc 2
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
function serve(){ | |
local port="${1:-8000}" | |
open "http://localhost:${port}/" | |
python -m SimpleHTTPServer "$port" | |
} |
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
PS1="[\W]\\$ " | |
alias pbcopy='xclip -selection clipboard' | |
alias pbpaste='xclip -selection clipboard -o' |
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
set guifont=DeJaVuSansMono\ 10 | |
let s:pattern = '^\(.* \)\([1-9][0-9]*\)$' | |
let s:minfontsize = 6 | |
let s:maxfontsize = 16 | |
function! AdjustFontSize(amount) | |
if has("gui_gtk2") && has("gui_running") | |
let fontname = substitute(&guifont, s:pattern, '\1', '') | |
let cursize = substitute(&guifont, s:pattern, '\2', '') | |
let newsize = cursize + a:amount | |
if (newsize >= s:minfontsize) && (newsize <= s:maxfontsize) | |
let newfont = fontname . newsize | |
let &guifont = newfont | |
endif | |
else | |
echoerr "You need to run the GTK2 version of Vim to use this function." | |
endif | |
endfunction | |
function! LargerFont() | |
call AdjustFontSize(1) | |
endfunction | |
command! LargerFont call LargerFont() | |
function! SmallerFont() | |
call AdjustFontSize(-1) | |
endfunction | |
command! SmallerFont call SmallerFont() | |
let g:ackprg="ack-grep -H --nocolor --nogroup --column" | |
nnoremap - :call SmallerFont()<CR> | |
nnoremap + :call LargerFont()<CR> |
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
autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif | |
" autocmd! BufWritePost *.js JSHint | |
" Restore cursor position to where it was before | |
augroup JumpCursorOnEdit | |
au! | |
autocmd BufReadPost * | |
\ if expand("<afile>:p:h") !=? $TEMP | | |
\ if line("'\"") > 1 && line("'\"") <= line("$") | | |
\ let JumpCursorOnEdit_foo = line("'\"") | | |
\ let b:doopenfold = 1 | | |
\ if (foldlevel(JumpCursorOnEdit_foo) > foldlevel(JumpCursorOnEdit_foo - 1)) | | |
\ let JumpCursorOnEdit_foo = JumpCursorOnEdit_foo - 1 | | |
\ let b:doopenfold = 2 | | |
\ endif | | |
\ exe JumpCursorOnEdit_foo | | |
\ endif | | |
\ endif | |
" Need to postpone using "zv" until after reading the modelines. | |
autocmd BufWinEnter * | |
\ if exists("b:doopenfold") | | |
\ exe "normal zv" | | |
\ if(b:doopenfold > 1) | | |
\ exe "+".1 | | |
\ endif | | |
\ unlet b:doopenfold | | |
\ endif | |
augroup END | |
"}}} | |
"{{{Misc Settings | |
" Necesary for lots of cool vim things | |
set nocompatible | |
" This shows what you are typing as a command. I love this! | |
set showcmd | |
" Folding Stuffs | |
set foldmethod=marker | |
" Needed for Syntax Highlighting and stuff | |
filetype on | |
" filetype plugin on | |
syntax enable | |
set grepprg=grep\ -nH\ $* | |
" Spaces are better than a tab character | |
set expandtab | |
set smarttab | |
" Use english for spellchecking, but don't spellcheck by default | |
if version >= 700 | |
set spl=en spell | |
set nospell | |
endif | |
" Real men use gcc | |
"compiler gcc | |
" Cool tab completion stuff | |
set wildmenu | |
set wildmode=list:longest,full | |
" Enable mouse support in console | |
set mouse=a | |
" Got backspace? | |
set backspace=2 | |
" Line Numbers PWN! | |
set number | |
" Ignoring case is a fun trick | |
set ignorecase | |
" And so is Artificial Intellegence! | |
set smartcase | |
" This is totally awesome - remap jj to escape in insert mode. You'll never type jj anyway, so it's great! | |
" inoremap jj <Esc> | |
nnoremap JJJJ <Nop> | |
" Incremental searching is sexy | |
set incsearch | |
" Highlight things that we find with the search | |
set hlsearch | |
" Since I use linux, I want this | |
let g:clipbrdDefaultReg = '+' | |
" When I close a tab, remove the buffer | |
set nohidden | |
" Set off the other paren | |
highlight MatchParen ctermbg=4 | |
" }}} | |
highlight Comment cterm=italic | |
"{{{Look and Feel | |
" Favorite Color Scheme | |
if has("gui_running") | |
colorscheme inkpot | |
colorscheme solarized | |
" Remove Toolbar | |
set guioptions-=T | |
"Terminus is AWESOME | |
set guifont=Terminus\ 9 | |
set guifont=DeJaVuSansMono\ 9 | |
else | |
" colorscheme developer | |
endif | |
"Status line gnarliness | |
set laststatus=2 | |
set statusline=%F%m%r%h%w\ (%{&ff}){%Y}\ [%l,%v][%p%%] | |
" }}} | |
"{{{ Functions | |
"{{{Theme Rotating | |
let themeindex=0 | |
function! RotateColorTheme() | |
let y = -1 | |
while y == -1 | |
"let colorstring = "inkpot#wombat256#ron#blue#elflord#evening#koehler#murphy#pablo#desert#torte#" | |
" let colorstring = "gruvbox#candy#bluechia#breeze#3dglasses#blacksea#carvedwood#breeze#inkpot#wombat256#zenburn#Tomorrow-Night#Tomorrow-Night-Eighties#xoria256#twilight#neon#tetragrammation#developer" | |
let colorstring = "gruvbox#solarized" | |
let x = match( colorstring, "#", g:themeindex ) | |
let y = match( colorstring, "#", x + 1 ) | |
let g:themeindex = x + 1 | |
if y == -1 | |
let g:themeindex = 0 | |
else | |
let themestring = strpart(colorstring, x + 1, y - x - 1) | |
return ":colorscheme ".themestring | |
endif | |
endwhile | |
endfunction | |
" }}} | |
"{{{ Paste Toggle | |
let paste_mode = 0 " 0 = normal, 1 = paste | |
func! Paste_on_off() | |
if g:paste_mode == 0 | |
set paste | |
let g:paste_mode = 1 | |
else | |
set nopaste | |
let g:paste_mode = 0 | |
endif | |
return | |
endfunc | |
"}}} | |
"{{{ Todo List Mode | |
function! TodoListMode() | |
e ~/.todo.otl | |
Calendar | |
wincmd l | |
set foldlevel=1 | |
tabnew ~/.notes.txt | |
tabfirst | |
" or 'norm! zMzr' | |
endfunction | |
"}}} | |
"}}} | |
"{{{ Mappings | |
" Next Tab | |
nnoremap <silent> <C-Right> :tabnext<CR> | |
nnoremap <F7> :tabn <CR> | |
" Previous Tab | |
nnoremap <silent> <C-Left> :tabprevious<CR> | |
nnoremap <F6> :tabp <CR> | |
" New Tab | |
nnoremap <silent> <C-t> :tabnew<CR> | |
" Rotate Color Scheme <F8> | |
nnoremap <silent> <F8> :execute RotateColorTheme()<CR> | |
" random color scheme | |
nnoremap <F5> :colorscheme random <CR> | |
" Paste Mode! Dang! <F10> | |
nnoremap <silent> <F10> :call Paste_on_off()<CR> | |
set pastetoggle=<F10> | |
" Edit vimrc \ev | |
nnoremap <silent> <Leader>ev :tabnew<CR>:e ~/.vimrc<CR> | |
" Edit gvimrc \gv | |
nnoremap <silent> <Leader>gv :tabnew<CR>:e ~/.gvimrc<CR> | |
" Create Blank Newlines and stay in Normal mode | |
nnoremap <silent> zj o<Esc> | |
nnoremap <silent> zk O<Esc> | |
" Space will toggle folds! | |
nnoremap <space> za | |
" Search mappings: These will make it so that going to the next one in a | |
" search will center on the line it's found in. | |
map N Nzz | |
map n nzz | |
" Testing | |
set completeopt=longest,menuone,preview | |
inoremap <expr> <cr> pumvisible() ? "\<c-y>" : "\<c-g>u\<cr>" | |
inoremap <expr> <c-n> pumvisible() ? "\<lt>c-n>" : "\<lt>c-n>\<lt>c-r>=pumvisible() ? \"\\<lt>down>\" : \"\"\<lt>cr>" | |
inoremap <expr> <m-;> pumvisible() ? "\<lt>c-n>" : "\<lt>c-x>\<lt>c-o>\<lt>c-n>\<lt>c-p>\<lt>c-r>=pumvisible() ? \"\\<lt>down>\" : \"\"\<lt>cr>" | |
" Swap ; and : Convenient. | |
nnoremap ; : | |
nnoremap : ; | |
" Swap j and k | |
" nnoremap j k | |
" nnoremap k j | |
" map Alt arrow keys to jump windows | |
map <A-Left> ,h | |
map <A-Right> ,l | |
map <A-Up> ,k | |
map <A-Down> ,j | |
" map w to open files while staying in NERDTree | |
map w go | |
" map ctrl f to open folders and files | |
nnoremap <silent> <C-f> :NERDTreeTabsToggle<CR> | |
" map ctrl g to open tree in new tabs | |
" nnoremap <silent> <C-g> :NERDTree<CR> | |
"}}} | |
" call pathogen#infect() | |
filetype plugin indent on | |
syntax on | |
" colorscheme Tomorrow-Night | |
" colorscheme developer | |
" colorscheme blacklight | |
" | |
"set guifont=Lucida\Console:h12 | |
"set guifont=Monospace\ 10 | |
set guifont=Menlo\Standard:h13 | |
nmap <D-[> << | |
nmap <D-]> >> | |
vmap <D-[> <gv | |
vmap <D-]> >gv | |
set autoindent | |
set smartindent | |
filetype indent on | |
set guioptions-=m "remove menu bar | |
set guioptions-=T "remove toolbar | |
set guioptions-=r "remove right-hand scroll bar | |
"set background=dark | |
colorscheme solarized | |
au BufNewFile,BufRead *.ejs set filetype=html | |
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS | |
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags | |
autocmd FileType css set omnifunc=csscomplete#CompleteCSS | |
autocmd FileType php set omnifunc=phpcomplete#CompletePHP | |
" set terminal colors | |
set t_Co=256 | |
" If the current buffer has never been saved, it will have no name, | |
" call the file browser to save it, otherwise just save it. | |
nnoremap <silent> <C-S> :if expand("%") == ""<CR>browse confirm w<CR>else<CR>confirm w<CR>endif<CR> | |
" save in insert mode | |
" inoremap <expr> <c-s> "\<esc>:" . (@% == "" ? "browse saveas" : "w") . "\<cr>gi" | |
inoremap <expr> <c-s> "\<esc>:" . (@% == "" ? "browse saveas" : "w") . "\<cr>" | |
" map <C-s> <Esc>:w<cr> | |
let s:pattern = '^\(.* \)\([1-9][0-9]*\)$' | |
let s:minfontsize = 6 | |
let s:maxfontsize = 16 | |
function! AdjustFontSize(amount) | |
if has("gui_gtk2") && has("gui_running") | |
let fontname = substitute(&guifont, s:pattern, '\1', '') | |
let cursize = substitute(&guifont, s:pattern, '\2', '') | |
let newsize = cursize + a:amount | |
if (newsize >= s:minfontsize) && (newsize <= s:maxfontsize) | |
let newfont = fontname . newsize | |
let &guifont = newfont | |
endif | |
else | |
echoerr "You need to run the GTK2 version of Vim to use this function." | |
endif | |
endfunction | |
function! LargerFont() | |
call AdjustFontSize(1) | |
endfunction | |
command! LargerFont call LargerFont() | |
function! SmallerFont() | |
call AdjustFontSize(-1) | |
endfunction | |
command! SmallerFont call SmallerFont() | |
let g:ackprg="ack-grep -H --nocolor --nogroup --column" | |
set wmh=0 | |
map <C-J> <C-W>j<C-W>_ | |
map <C-K> <C-W>k<C-W>_ | |
map <c-h> <c-w>h<c-w><Bar> | |
nmap <c-l> <c-w>l<c-w><Bar> | |
set nobackup "no backup files | |
set nowritebackup "only in case you don't want a backup file while editing | |
set noswapfile "no swap files | |
" Move the cursor to the window left of the current one | |
noremap <silent> ,h :wincmd h<cr> | |
" Move the cursor to the window below the current one | |
noremap <silent> ,j :wincmd j<cr> | |
" Move the cursor to the window above the current one | |
noremap <silent> ,k :wincmd k<cr> | |
" Move the cursor to the window right of the current one | |
noremap <silent> ,l :wincmd l<cr> | |
" Close the window below this one | |
noremap <silent> ,cj :wincmd j<cr>:close<cr> | |
" Close the window above this one | |
noremap <silent> ,ck :wincmd k<cr>:close<cr> | |
" Close the window to the left of this one | |
noremap <silent> ,ch :wincmd h<cr>:close<cr> | |
" Close the window to the right of this one | |
noremap <silent> ,cl :wincmd l<cr>:close<cr> | |
" Close the current window | |
noremap <silent> ,cc :close<cr> | |
" Move the current window to the right of the main Vim window | |
noremap <silent> ,ml <C-W>L | |
" Move the current window to the top of the main Vim window | |
noremap <silent> ,mk <C-W>K | |
" Move the current window to the left of the main Vim window | |
noremap <silent> ,mh <C-W>H | |
" Move the current window to the bottom of the main Vim window | |
noremap <silent> ,mj <C-W>J | |
set guioptions-=T "get rid of toolbar | |
set guioptions-=m "get rid of menu | |
set guifont=DejaVu\ Sans\ Mono\ for\ Powerline\ 10 | |
let g:Powerline_symbols = 'fancy' | |
" add mappings to open new tabs and file tree | |
set tabstop=8 | |
let g:nerdtree_tabs_open_on_console_startup=1 | |
" let g:nerdtree_tabs_open_on_gui_startup=1 | |
let g:syntastic_html_tidy_ignore_errors=[" proprietary attribute \"ng-"] | |
set tabstop=4 softtabstop=4 shiftwidth=4 expandtab | |
set clipboard=unnamed | |
vmap '' :w !pbcopy<CR><CR> | |
highlight jsString cterm=italic | |
highlight Comment cterm=italic | |
set completefunc=emoji#complete | |
colorscheme solarized | |
set statusline+=%#warningmsg# | |
set statusline+=%{SyntasticStatuslineFlag()} | |
set statusline+=%* | |
let g:syntastic_always_populate_loc_list = 1 | |
let g:syntastic_auto_loc_list = 1 | |
let g:syntastic_check_on_open = 1 | |
let g:syntastic_check_on_wq = 0 | |
let g:syntastic_error_symbol = "✗" | |
let g:syntastic_warning_symbol = "⚠" | |
" let g:syntastic_quiet_messages = { "type": "style"} | |
" let g:syntastic_quiet_messages = { "level": "warnings"} | |
" let g:syntastic_javascript_eslint_exe = 'npm run eslint --' | |
" let g:syntastic_always_populate_loc_list = 1 | |
" let g:syntastic_auto_loc_list = 1 | |
" let g:syntastic_check_on_open = 1 | |
" let g:syntastic_check_on_wq = 0 | |
" let g:jsx_ext_required = 0 | |
" " see :help 'errorformat' | |
" setlocal errorformat=%E%f:\ line\ %l\\,\ col\ %c\\,\ Error\ -\ %m,%-G%.%#,%W%f:\ line\ %l\\,\ col\ %c\\,\ Warning\ -\ %m,%-G%.%# | |
" | |
" " see :help 'makeprg' and $ eslint --help | |
" setlocal makeprg=eslint\ -f\ compact | |
" | |
" " run :make % on write | |
" autocmd! BufWritePost <buffer> silent make % | silent redraw! | |
let g:NERDTreeHijackNetrw=0 | |
" autocmd FileType javascript set formatprg=prettier-eslint\ --stdin | |
" autocmd BufWritePre *.js :normal gggqG | |
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
# | |
# Executes commands at the start of an interactive session. | |
# | |
# Authors: | |
# Sorin Ionescu <[email protected]> | |
# | |
# Source Prezto. | |
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then | |
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" | |
fi | |
# Customize to your needs... | |
for config_file ($HOME/.yadr/zsh/*.zsh) source $config_file | |
prompt sorin | |
# # fix term wierdness in unix shell | |
# # term=xterm-256color | |
# use brew vim if present | |
/usr/local/bin/vim --version > /dev/null 2>&1 | |
BREW_VIM_INSTALLED=$? | |
if [ $BREW_VIM_INSTALLED -eq 0 ]; then | |
alias vi="/usr/local/bin/vim" | |
fi |
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
drwxr-xr-x 10 b staff 340B Jun 5 21:04 typescript-vim | |
drwxr-xr-x 13 b staff 442B Jun 5 21:59 vimshell.vim | |
drwxr-xr-x 17 b staff 578B Jun 5 22:35 tsuquyomi | |
drwxr-xr-x 7 b staff 238B Jun 5 22:41 vim-js-indent | |
drwxr-xr-x 24 b staff 816B Jun 7 13:28 vimproc.vim | |
drwxr-xr-x 14 b staff 476B Jun 7 13:28 emmet-vim | |
https://github.com/ternjs/tern_for_vim |
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
autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif | |
" autocmd! BufWritePost *.js JSHint | |
" Restore cursor position to where it was before | |
augroup JumpCursorOnEdit | |
au! | |
autocmd BufReadPost * | |
\ if expand("<afile>:p:h") !=? $TEMP | | |
\ if line("'\"") > 1 && line("'\"") <= line("$") | | |
\ let JumpCursorOnEdit_foo = line("'\"") | | |
\ let b:doopenfold = 1 | | |
\ if (foldlevel(JumpCursorOnEdit_foo) > foldlevel(JumpCursorOnEdit_foo - 1)) | | |
\ let JumpCursorOnEdit_foo = JumpCursorOnEdit_foo - 1 | | |
\ let b:doopenfold = 2 | | |
\ endif | | |
\ exe JumpCursorOnEdit_foo | | |
\ endif | | |
\ endif | |
" Need to postpone using "zv" until after reading the modelines. | |
autocmd BufWinEnter * | |
\ if exists("b:doopenfold") | | |
\ exe "normal zv" | | |
\ if(b:doopenfold > 1) | | |
\ exe "+".1 | | |
\ endif | | |
\ unlet b:doopenfold | | |
\ endif | |
augroup END | |
"}}} | |
"{{{Misc Settings | |
" Necesary for lots of cool vim things | |
set nocompatible | |
" This shows what you are typing as a command. I love this! | |
set showcmd | |
" Folding Stuffs | |
set foldmethod=marker | |
" Needed for Syntax Highlighting and stuff | |
filetype on | |
" filetype plugin on | |
syntax enable | |
set grepprg=grep\ -nH\ $* | |
" Spaces are better than a tab character | |
set expandtab | |
set smarttab | |
" Use english for spellchecking, but don't spellcheck by default | |
if version >= 700 | |
set spl=en spell | |
set nospell | |
endif | |
" Real men use gcc | |
"compiler gcc | |
" Cool tab completion stuff | |
set wildmenu | |
set wildmode=list:longest,full | |
" Enable mouse support in console | |
set mouse=a | |
" Got backspace? | |
set backspace=2 | |
" Line Numbers PWN! | |
set number | |
" Ignoring case is a fun trick | |
set ignorecase | |
" And so is Artificial Intellegence! | |
set smartcase | |
" This is totally awesome - remap jj to escape in insert mode. You'll never type jj anyway, so it's great! | |
" inoremap jj <Esc> | |
nnoremap JJJJ <Nop> | |
" Incremental searching is sexy | |
set incsearch | |
" Highlight things that we find with the search | |
set hlsearch | |
" Since I use linux, I want this | |
let g:clipbrdDefaultReg = '+' | |
" When I close a tab, remove the buffer | |
set nohidden | |
" Set off the other paren | |
highlight MatchParen ctermbg=4 | |
" }}} | |
highlight Comment cterm=italic | |
"{{{Look and Feel | |
" Favorite Color Scheme | |
if has("gui_running") | |
colorscheme inkpot | |
" colorscheme solarized | |
" Remove Toolbar | |
set guioptions-=T | |
"Terminus is AWESOME | |
set guifont=Terminus\ 9 | |
set guifont=DeJaVuSansMono\ 9 | |
else | |
" colorscheme developer | |
endif | |
"Status line gnarliness | |
set laststatus=2 | |
set statusline=%F%m%r%h%w\ (%{&ff}){%Y}\ [%l,%v][%p%%] | |
" }}} | |
"{{{ Functions | |
"{{{Theme Rotating | |
let themeindex=0 | |
function! RotateColorTheme() | |
let y = -1 | |
while y == -1 | |
"let colorstring = "inkpot#wombat256#ron#blue#elflord#evening#koehler#murphy#pablo#desert#torte#" | |
" let colorstring = "gruvbox#candy#bluechia#breeze#3dglasses#blacksea#carvedwood#breeze#inkpot#wombat256#zenburn#Tomorrow-Night#Tomorrow-Night-Eighties#xoria256#twilight#neon#tetragrammation#developer" | |
let colorstring = "gruvbox#solarized" | |
let x = match( colorstring, "#", g:themeindex ) | |
let y = match( colorstring, "#", x + 1 ) | |
let g:themeindex = x + 1 | |
if y == -1 | |
let g:themeindex = 0 | |
else | |
let themestring = strpart(colorstring, x + 1, y - x - 1) | |
return ":colorscheme ".themestring | |
endif | |
endwhile | |
endfunction | |
" }}} | |
"{{{ Paste Toggle | |
let paste_mode = 0 " 0 = normal, 1 = paste | |
func! Paste_on_off() | |
if g:paste_mode == 0 | |
set paste | |
let g:paste_mode = 1 | |
else | |
set nopaste | |
let g:paste_mode = 0 | |
endif | |
return | |
endfunc | |
"}}} | |
"{{{ Todo List Mode | |
function! TodoListMode() | |
e ~/.todo.otl | |
Calendar | |
wincmd l | |
set foldlevel=1 | |
tabnew ~/.notes.txt | |
tabfirst | |
" or 'norm! zMzr' | |
endfunction | |
"}}} | |
"}}} | |
"{{{ Mappings | |
" Next Tab | |
nnoremap <silent> <C-Right> :tabnext<CR> | |
nnoremap <F7> :tabn <CR> | |
" Previous Tab | |
nnoremap <silent> <C-Left> :tabprevious<CR> | |
nnoremap <F6> :tabp <CR> | |
" New Tab | |
nnoremap <silent> <C-t> :tabnew<CR> | |
" Rotate Color Scheme <F8> | |
nnoremap <silent> <F8> :execute RotateColorTheme()<CR> | |
" random color scheme | |
nnoremap <F5> :colorscheme random <CR> | |
" Paste Mode! Dang! <F10> | |
nnoremap <silent> <F10> :call Paste_on_off()<CR> | |
set pastetoggle=<F10> | |
" Edit vimrc \ev | |
nnoremap <silent> <Leader>ev :tabnew<CR>:e ~/.vimrc<CR> | |
" Edit gvimrc \gv | |
nnoremap <silent> <Leader>gv :tabnew<CR>:e ~/.gvimrc<CR> | |
" Create Blank Newlines and stay in Normal mode | |
nnoremap <silent> zj o<Esc> | |
nnoremap <silent> zk O<Esc> | |
" Space will toggle folds! | |
nnoremap <space> za | |
" Search mappings: These will make it so that going to the next one in a | |
" search will center on the line it's found in. | |
map N Nzz | |
map n nzz | |
" Testing | |
set completeopt=longest,menuone,preview | |
inoremap <expr> <cr> pumvisible() ? "\<c-y>" : "\<c-g>u\<cr>" | |
inoremap <expr> <c-n> pumvisible() ? "\<lt>c-n>" : "\<lt>c-n>\<lt>c-r>=pumvisible() ? \"\\<lt>down>\" : \"\"\<lt>cr>" | |
inoremap <expr> <m-;> pumvisible() ? "\<lt>c-n>" : "\<lt>c-x>\<lt>c-o>\<lt>c-n>\<lt>c-p>\<lt>c-r>=pumvisible() ? \"\\<lt>down>\" : \"\"\<lt>cr>" | |
" Swap ; and : Convenient. | |
nnoremap ; : | |
nnoremap : ; | |
" Swap j and k | |
" nnoremap j k | |
" nnoremap k j | |
" map Alt arrow keys to jump windows | |
map <A-Left> ,h | |
map <A-Right> ,l | |
map <A-Up> ,k | |
map <A-Down> ,j | |
" map w to open files while staying in NERDTree | |
map w go | |
" map ctrl f to open folders and files | |
nnoremap <silent> <C-f> :NERDTreeTabsToggle<CR> | |
" map ctrl g to open tree in new tabs | |
" nnoremap <silent> <C-g> :NERDTree<CR> | |
"}}} | |
" call pathogen#infect() | |
filetype plugin indent on | |
syntax on | |
" colorscheme Tomorrow-Night | |
" colorscheme developer | |
" colorscheme blacklight | |
" | |
"set guifont=Lucida\Console:h12 | |
"set guifont=Monospace\ 10 | |
set guifont=Menlo\Standard:h13 | |
nmap <D-[> << | |
nmap <D-]> >> | |
vmap <D-[> <gv | |
vmap <D-]> >gv | |
set autoindent | |
set smartindent | |
filetype indent on | |
set guioptions-=m "remove menu bar | |
set guioptions-=T "remove toolbar | |
set guioptions-=r "remove right-hand scroll bar | |
"set background=dark | |
" colorscheme solarized | |
au BufNewFile,BufRead *.ejs set filetype=html | |
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS | |
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags | |
autocmd FileType css set omnifunc=csscomplete#CompleteCSS | |
autocmd FileType php set omnifunc=phpcomplete#CompletePHP | |
" set terminal colors | |
set t_Co=256 | |
" If the current buffer has never been saved, it will have no name, | |
" call the file browser to save it, otherwise just save it. | |
nnoremap <silent> <C-S> :if expand("%") == ""<CR>browse confirm w<CR>else<CR>confirm w<CR>endif<CR> | |
" save in insert mode | |
" inoremap <expr> <c-s> "\<esc>:" . (@% == "" ? "browse saveas" : "w") . "\<cr>gi" | |
inoremap <expr> <c-s> "\<esc>:" . (@% == "" ? "browse saveas" : "w") . "\<cr>" | |
" map <C-s> <Esc>:w<cr> | |
let s:pattern = '^\(.* \)\([1-9][0-9]*\)$' | |
let s:minfontsize = 6 | |
let s:maxfontsize = 16 | |
function! AdjustFontSize(amount) | |
if has("gui_gtk2") && has("gui_running") | |
let fontname = substitute(&guifont, s:pattern, '\1', '') | |
let cursize = substitute(&guifont, s:pattern, '\2', '') | |
let newsize = cursize + a:amount | |
if (newsize >= s:minfontsize) && (newsize <= s:maxfontsize) | |
let newfont = fontname . newsize | |
let &guifont = newfont | |
endif | |
else | |
echoerr "You need to run the GTK2 version of Vim to use this function." | |
endif | |
endfunction | |
function! LargerFont() | |
call AdjustFontSize(1) | |
endfunction | |
command! LargerFont call LargerFont() | |
function! SmallerFont() | |
call AdjustFontSize(-1) | |
endfunction | |
command! SmallerFont call SmallerFont() | |
let g:ackprg="ack-grep -H --nocolor --nogroup --column" | |
set wmh=0 | |
map <C-J> <C-W>j<C-W>_ | |
map <C-K> <C-W>k<C-W>_ | |
map <c-h> <c-w>h<c-w><Bar> | |
nmap <c-l> <c-w>l<c-w><Bar> | |
set nobackup "no backup files | |
set nowritebackup "only in case you don't want a backup file while editing | |
set noswapfile "no swap files | |
" Move the cursor to the window left of the current one | |
noremap <silent> ,h :wincmd h<cr> | |
" Move the cursor to the window below the current one | |
noremap <silent> ,j :wincmd j<cr> | |
" Move the cursor to the window above the current one | |
noremap <silent> ,k :wincmd k<cr> | |
" Move the cursor to the window right of the current one | |
noremap <silent> ,l :wincmd l<cr> | |
" Close the window below this one | |
noremap <silent> ,cj :wincmd j<cr>:close<cr> | |
" Close the window above this one | |
noremap <silent> ,ck :wincmd k<cr>:close<cr> | |
" Close the window to the left of this one | |
noremap <silent> ,ch :wincmd h<cr>:close<cr> | |
" Close the window to the right of this one | |
noremap <silent> ,cl :wincmd l<cr>:close<cr> | |
" Close the current window | |
noremap <silent> ,cc :close<cr> | |
" Move the current window to the right of the main Vim window | |
noremap <silent> ,ml <C-W>L | |
" Move the current window to the top of the main Vim window | |
noremap <silent> ,mk <C-W>K | |
" Move the current window to the left of the main Vim window | |
noremap <silent> ,mh <C-W>H | |
" Move the current window to the bottom of the main Vim window | |
noremap <silent> ,mj <C-W>J | |
set guioptions-=T "get rid of toolbar | |
set guioptions-=m "get rid of menu | |
set guifont=DejaVu\ Sans\ Mono\ for\ Powerline\ 10 | |
let g:Powerline_symbols = 'fancy' | |
" add mappings to open new tabs and file tree | |
set tabstop=8 | |
let g:nerdtree_tabs_open_on_console_startup=1 | |
" let g:nerdtree_tabs_open_on_gui_startup=1 | |
let g:syntastic_html_tidy_ignore_errors=[" proprietary attribute \"ng-"] | |
set tabstop=4 softtabstop=4 shiftwidth=4 expandtab | |
set clipboard=unnamed | |
vmap '' :w !pbcopy<CR><CR> | |
highlight jsString cterm=italic | |
highlight Comment cterm=italic | |
set completefunc=emoji#complete | |
" colorscheme solarized | |
set statusline+=%#warningmsg# | |
set statusline+=%{SyntasticStatuslineFlag()} | |
set statusline+=%* | |
let g:syntastic_always_populate_loc_list = 1 | |
let g:syntastic_auto_loc_list = 1 | |
let g:syntastic_check_on_open = 1 | |
let g:syntastic_check_on_wq = 0 | |
let g:syntastic_error_symbol = "✗" | |
let g:syntastic_warning_symbol = "⚠" | |
" let g:syntastic_quiet_messages = { "type": "style"} | |
" let g:syntastic_quiet_messages = { "level": "warnings"} | |
" let g:syntastic_javascript_eslint_exe = 'npm run eslint --' | |
" let g:syntastic_always_populate_loc_list = 1 | |
" let g:syntastic_auto_loc_list = 1 | |
" let g:syntastic_check_on_open = 1 | |
" let g:syntastic_check_on_wq = 0 | |
" let g:jsx_ext_required = 0 | |
" " see :help 'errorformat' | |
" setlocal errorformat=%E%f:\ line\ %l\\,\ col\ %c\\,\ Error\ -\ %m,%-G%.%#,%W%f:\ line\ %l\\,\ col\ %c\\,\ Warning\ -\ %m,%-G%.%# | |
" | |
" " see :help 'makeprg' and $ eslint --help | |
" setlocal makeprg=eslint\ -f\ compact | |
" | |
" " run :make % on write | |
" autocmd! BufWritePost <buffer> silent make % | silent redraw! | |
let g:NERDTreeHijackNetrw=0 | |
" autocmd FileType javascript set formatprg=prettier-eslint\ --stdin | |
" autocmd BufWritePre *.js :normal gggqG | |
set invlist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment