sync/vim/vimrc

342 lines
12 KiB
VimL

let g:neosnippet#snippets_directory='~/.vim/bundle/snipmate-snippets/snippets'
if has('conceal')
set conceallevel=2 concealcursor=i
endif
nnoremap <Leader>autoformat! :%s/, /,<CR>:%s/ \/ /\/<CR>:%s/ {/{<CR>:%s/} /}<CR>:%s/ = /=
command! WW %!sudo tee > /dev/null %
au VimResized * exe "normal! \<c-w>="
au BufRead,BufNewFile *.twig set filetype=htmljinja
au FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
au FileType * :hi IndentGuidesOdd guibg=red ctermbg=239
au FileType * :hi IndentGuidesEven guibg=white ctermbg=239
au FileType css setlocal omnifunc=csscomplete#CompleteCSS
au FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
au FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
au FileType python setlocal omnifunc=pythoncomplete#Complete
au FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
"match Error /\s\+$/
"nnoremap s xa
"nnoremap <F5> :UndotreeToggle<CR>
"inoremap <expr><Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
imap <Expr>\ neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : pumvisible() ? "\<C-n>" : "\<TAB>"
smap <Expr>\ neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
nnoremap <C-w>\| <C-w>v<C-w>l
nnoremap <C-w>- <C-w>s<C-w>j
nnoremap <C-d> <C-w>q
nnoremap <F3> :!make&&echo "Uploading robot code";wput ./PPC603gnu/src/Debug/src.out ftp://frc:frc@10.20.59.2/ni-rt/system/FRC_UserProgram.out<CR>
nnoremap G G$
vnoremap G G$
nnoremap <F5> :GundoToggle<CR>
nnoremap <F8> :TagbarToggle<CR>
nnoremap + <C-a>
nnoremap - <C-x>
nnoremap Q <Nop>
nnoremap <Leader><Leader> <C-^>
nnoremap <Leader>a :!git st<CR>:!ls<CR>:!git a
nnoremap <Leader>up :!git pull origin
nnoremap <Leader>st :!git st<CR>
nnoremap <Leader>ci :!git st<CR>:!git ci ""<Left>
nnoremap <Leader>log :!git hist<CR>
nnoremap <Leader>br :!git br<CR>
nnoremap gb :ls<CR>:b
nnoremap <Leader>d :bd
nnoremap <Leader>q :q
nnoremap <Leader>W :%s/\s\+$//<CR>:let @/=''<CR>
nnoremap <Leader>o m`o<Esc>``
nnoremap <Leader>O m`O<Esc>``
nnoremap <Leader>go %m`%x``
nnoremap <Leader>if m"Oif(){<Esc>jo}<Esc>`"v><Esc>k^wa
nnoremap <Leader>else m"kAelse{<Esc>jo}<Esc>`"v><Esc>
nnoremap <Leader>for m"Ofor(){<Esc>jo}<Esc>`"v><Esc>k^wa
nnoremap <Leader>while m"Owhile(){<Esc>jo}<Esc>`"v><Esc>k^wa
nnoremap <Leader>rm m"kddjddkv<<Esc>`"
nnoremap <Leader># O#{{{<Esc>jo#}}}<Esc>kk^a
vnoremap <Leader># <Esc>`<O#{{{<Esc>`>o#}}}<Esc>`<k^a
nnoremap <Leader>{ O//{{{<Esc>jo//}}}<Esc>kk^la
vnoremap <Leader>{ <Esc>`<O//{{{<Esc>`>o//}}}<Esc>`<k^la
vnoremap <Leader>if <Esc>`<Oif(){<Esc>`>o}<Esc>gv><Esc>`<k^wa
vnoremap <Leader>else <Esc>`<kAelse{<Esc>`>o}<Esc>gv><Esc>
vnoremap <Leader>for <Esc>`<Ofor(){<Esc>`>o}<Esc>gv><Esc>`<k^wa
vnoremap <Leader>while <Esc>`<Owhile(){<Esc>`>o}<Esc>gv><Esc>`<k^wa
vnoremap <Leader>rm <Esc>`<<Esc>kdd`>jddgv<<Esc>
vnoremap <silent> * :call VisualSelection('f')<CR>
vnoremap <silent> # :call VisualSelection('b')<CR>
"nnoremap <Space> zo:set hlsearch! hlsearch?<CR>
"nnoremap <Space> :nohlsearch<CR>g<C-g>zo
nnoremap <BS> :nohlsearch<CR>g<C-g>zo
nnoremap U <C-r>
nnoremap K i<CR><Esc>k$
nnoremap <Enter> :up<CR>g<C-g>
vnoremap gj j
vnoremap gk k
vnoremap j gj
vnoremap k gk
vnoremap H ^
vnoremap L $h
vnoremap ; :
nnoremap gj j
nnoremap gk k
nnoremap j gj
nnoremap k gk
nnoremap H ^
nnoremap L $
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
map , <Plug>(easymotion-prefix)
nnoremap ! :!
nnoremap ; :
nnoremap J Jx
vnoremap < <gv
vnoremap > >gv
nnoremap <F1> <nop>
inoremap <F1> <nop>
vnoremap <F1> <nop>
nnoremap <Leader>== yyPv$r=jyypv$r=
nnoremap <Leader>** yyPv$r*jyypv$r*
nnoremap <Leader>= yypv$r=
nnoremap <Leader>- yypv$r-
nnoremap <Leader>^ yypv$r^
nnoremap <Leader>" yypv$r"
inoremap '' ''<Left>
inoremap "" ""<Left>
inoremap () ()<Left>
inoremap <> <><Left>
inoremap {} <Right>{}<Left><CR><Esc>O
inoremap {% {% %}<Left><Left><Left>
inoremap [] []<Left>
inoremap ;;; <Esc>A
inoremap ;; <Esc>m`A;<Esc>``a
inoremap ;;<Space> <Esc>A;<Esc>o
nnoremap ;; m"A;<Esc>`"
nnoremap ;;<Space> A;<Esc>o
inoremap <C-l> <Right>
inoremap <C-h> <Left>
inoremap <C-k> <Up>
inoremap <C-j> <Down>
nnoremap Y y$
nnoremap <Up> <C-w>w
nnoremap <Down> <C-w>W
nnoremap <Left> :bp<CR>
nnoremap <Right> :bn<CR>
nnoremap <C-w>z <C-w>_<C-w>\|
nnoremap <Leader>bun G?Bundle<CR>yyjp$hdi'"+gP0Wl3d/\/<CR>xjyyP$"+gp<Esc>:nohlsearch<CR>:up<CR>:BundleInstall
nnoremap <Leader><C-p> :CtrlPFunky<CR>
nnoremap <F2> :set invpaste<CR>
nnoremap <C-Up> [e
nnoremap <C-Down> ]e
vnoremap <C-Up> [egv
vnoremap <C-Down> ]egv
nnoremap / /\v
vnoremap / /\v
inoremap jk <Esc>A
inoremap kj <Esc>A
set guicursor+=n-v-c:blinkon0
set formatoptions-=r
set formatoptions-=o
set diffopt+=iwhite
set noesckeys
set mouse-=a
set shiftwidth=2
set tabstop=2
set softtabstop=2
set expandtab
set history=1000
set hidden
set cursorline
set incsearch
set showmatch
set hlsearch
set scrolloff=3
set scrolljump=5
set autoindent
set backup
set backupdir=~/.vim/backup
set directory=~/.vim/tmp
set undolevels=1000
set history=500
set ttyfast
set ff=unix
set encoding=utf-8
set laststatus=2
set foldmethod=marker
set foldnestmax=10
set foldlevel=2
set rnu
set nu
set ts=2 sw=2 et
set background=dark
set t_Co=256
set gdefault
set nocompatible
set rtp+=~/.vim/bundle/vundle/
set ignorecase
syntax on
let g:airline_left_sep='▶'
let g:airline_right_sep='◀'
let g:airline#extensions#syntastic#enabled=1
let g:airline#extensions#whitespace#enabled=0
let g:airline#extensions#whitespace#show_message=0
let g:airline#extensions#tmuxline#enabled=1
let g:formatprg_cpp="astyle"
let g:formatprg_args_expr_cpp=" --mode=c --style=1tbs -xe -k1 -j"
" These flags don't work for some reason
" -xn -xc -xl -S
"let g:airline#extensions#tabline#enabled=1
let g:Powerline_symbols='fancy'
let g:indent_guides_start_level=1
let g:indent_guides_guide_size=1
let g:indent_guides_enable_on_vim_startup=1
"let g:neocomplcache_enable_at_startup=1
"let g:neocomplcache_enable_camel_case_completion=1
"let g:neocomplcache_enable_smart_case=1
"let g:neocomplcache_enable_underbar_completion=1
"let g:neocomplcache_enable_auto_delimiter=1
"let g:neocomplcache_max_list=20
"let g:neocomplcache_force_overwrite_completefunc=1
"let g:neocomplcache_min_syntax_length=2
"let g:neocomplcache_enable_auto_select=1
let g:neocomplete#enable_at_startup = 1
let g:neocomplete#enable_smart_case = 1
let g:neocomplete#sources#syntax#min_keyword_length = 2
let g:php_refactor_command='php /usr/local/bin/refactor.phar'
let g:ctrlp_extensions=['funky']
"inoremap <expr><BS> neocomplcache#smart_close_popup()."\<C-h>"
function! g:UltiSnips_Complete()
call UltiSnips#ExpandSnippet()
if g:ulti_expand_res == 0
if pumvisible()
return "\<C-n>"
else
call UltiSnips#JumpForwards()
if g:ulti_jump_forwards_res == 0
return "\<TAB>"
endif
endif
endif
return ""
endfunction
au BufEnter * exec "inoremap <silent> " . g:UltiSnipsExpandTrigger . " <C-R>=g:UltiSnips_Complete()<cr>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsListSnippets="<c-e>"
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
let loaded_matchit=1
let g:UltiSnipsEditSplit="vertical"
filetype off
call vundle#rc()
"Bundle 'Floobits/floobits-vim'
"Bundle 'tsaleh/vim-matchit'
"Bundle 'Shougo/neosnippet'
"Bundle 'msanders/snipmate.vim'
"Bundle 'vim-scripts/YankRing.vim'
Bundle 'gmarik/vundle'
"Required: manages all bundles | https://github.com/gmarik/vundle
Bundle 'Chiel92/vim-autoformat'
"Adds autoformat command | https://github.com/Chiel92/vim-autoformat
Bundle 'tpope/vim-surround'
"Surround selection in ({\"' or HTML tags | https://github.com/tpope/vim-surround
Bundle 'scrooloose/syntastic'
"Syntax checker | https://github.com/scrooloose/syntastic
"Bundle 'Shougo/neocomplcache.vim'
" "Tab complete everything | https://github.com/Shougo/neocomplcache.vim
Bundle 'nathanaelkane/vim-indent-guides'
"Indentation guides | https://github.com/nathanaelkane/vim-indent-guides
Bundle 'elzr/vim-json'
"JSON highlighting | https://github.com/elzr/vim-json
Bundle 'groenewege/vim-less'
"LESS highlighting | https://github.com/groenewege/vim-less
Bundle 'pangloss/vim-javascript'
"JS syntax and indentation | https://github.com/pangloss/vim-javascript
Bundle 'briancollins/vim-jst'
"Actually, I do not know what this does | https://github.com/briancollins/vim-jst
Bundle 'kchmck/vim-coffee-script'
"Coffeescript syntax | https://github.com/kchmck/vim-coffee-script
Bundle 'Lokaltog/powerline-fonts'
"Better powerline fonts | https://github.com/Lokaltog/powerline-fonts
Bundle 'bling/vim-airline'
"Bottom status bar | https://github.com/bling/vim-airline
Bundle 'terryma/vim-multiple-cursors'
"Multicursor functionality like Coda | https://github.com/terryma/vim-multiple-cursors
Bundle 'scrooloose/nerdtree'
"File browser | https://github.com/scrooloose/nerdtree
Bundle 'altercation/vim-colors-solarized'
"Theme | https://github.com/altercation/vim-colors-solarized
Bundle 'spf13/vim-colors'
"Theme pack | https://github.com/spf13/vim-colors
Bundle 'spf13/PIV'
"PHP tools | https://github.com/spf13/PIV
Bundle 'vim-scripts/AutoTag'
"Generates taglist with ctags | https://github.com/vim-scripts/AutoTag
Bundle 'Lokaltog/vim-easymotion'
"Move around quickly in a document | https://github.com/Lokaltog/vim-easymotion
Bundle 'sjl/gundo.vim'
"Visual undo | https://github.com/sjl/gundo.vim
Bundle 'tommcdo/vim-exchange'
"Exchange two selections of text | https://github.com/tommcdo/vim-exchange
Bundle 'tpope/vim-repeat'
"Repeat last tpope command with . | https://github.com/tpope/vim-repeat
Bundle 'tpope/vim-commentary'
"Comment selection | https://github.com/tpope/vim-commentary
Bundle 'vim-php/vim-php-refactoring'
"PHP refactoring | https://github.com/vim-php/vim-php-refactoring
Bundle 'tpope/vim-fugitive'
"Great Vim-Git compatibility | https://github.com/tpope/vim-fugitive
Bundle 'tpope/vim-unimpaired'
"Bracket shortcuts | https://github.com/tpope/vim-unimpaired
Bundle 'kien/ctrlp.vim'
"Fuzzy file search | https://github.com/kien/ctrlp.vim
Bundle 'tacahiroy/ctrlp-funky'
"Fuzzy function search | https://github.com/tacahiroy/ctrlp-funky
Bundle 'godlygeek/tabular'
"Quickly make tables in vim | https://github.com/godlygeek/tabular
Bundle 'tpope/vim-abolish'
"Better abbrivation | https://github.com/tpope/vim-abolish
Bundle 'godlygeek/csapprox'
"256 color vim in terminal | https://github.com/godlygeek/csapprox
Bundle 'sirver/UltiSnips'
"Adds snippets | https://github.com/sirver/UltiSnips
Bundle 'honza/vim-snippets'
" | https://github.com/honza/vim-snippets
Bundle 'Shougo/neocomplete.vim'
"Autocompletes | https://github.com/Shougo/neocomplete.vim
Bundle 'othree/eregex.vim'
"Real regexes in vim | https://github.com/othree/eregex.vim
Bundle 'vim-scripts/sessionman.vim'
" |https://github.com/vim-scripts/sessionman.vim
" |
"DO NOT DELETE LINE ABOVE OR \bun WILL BREAK
filetype plugin indent on
if exists("+undofile")
if isdirectory($HOME . '/.vim/undo')==0
:silent !mkdir -p ~/.vim/undo > /dev/null 2>&1
endif
set undodir=./.vim-undo//
set undodir+=~/.vim/undo//
set undofile
endif
augroup vimrc
au!
au BufWritePost .vimrc,vimrc source %
augroup END
augroup vimrcEx
au!
" When editing a file, always jump to the last known cursor position.
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <=line("$") |
\ exe "normal g`\"" |
\ endif
augroup END
if has('gui_running')
set guioptions-=T
set lines=40
"colorscheme fruity
else
if &term=='xterm' || &term=='screen'
set t_Co=256
endif
"colorscheme torte
endif
silent! colorscheme fruity
nnoremap <Leader>W :%s/\s\+$//<cr>:let @/=''<cr>