sync/vim/vimrc

417 lines
14 KiB
VimL
Raw Normal View History

2015-06-15 00:28:01 -04:00
"source /home/stonewareslord/.vim/autoload/plug.vim
2014-04-19 13:25:29 -04:00
if has('conceal')
set conceallevel=2 concealcursor=i
endif
2016-01-26 13:47:55 -05:00
let g:formatdef_my_custom_cpp = '"astyle --mode=cpp -xc --style=google -j -s2 -xG -S -K -N -xn -xl -n -p -H"'
let g:formatters_cpp = ['my_custom_cpp']
2016-09-27 13:48:54 -04:00
let g:formatdef_my_custom_java = '"astyle --mode=java -xc --style=google -j -s2 -xG -S -K -N -xn -xl -n -p -H"'
2016-01-14 15:26:37 -05:00
let g:formatters_java = ['my_custom_java']
2016-01-21 12:19:51 -05:00
let g:UltiSnipsUsePythonVersion=3
2014-07-30 13:03:23 -04:00
command! WW %!sudo tee > /dev/null %
"TODO: Fix this
"let g:rbpt_loadcmd_toggle = 1
2015-06-15 01:35:29 -04:00
let g:indent_guides_auto_colors = 0
2016-09-27 13:48:54 -04:00
"Required for CSC216, not needed for current classes
"autocmd FileType java set shiftwidth=3 tabstop=3 softtabstop=3 expandtab
2017-04-30 13:14:50 -04:00
"au FileType twig let b:AutoPairs['%']='%'
2015-07-25 13:35:29 -04:00
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=darkgrey ctermbg=darkgrey
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=grey ctermbg=grey
2015-08-03 10:46:02 -04:00
filetype plugin on
set grepprg=grep\ -nH\ $*
let g:tex_flavor='latex'
"match Error /\s\+$/
2016-01-21 12:19:51 -05:00
" Basic, very important mappings {
" Movement {
"Vertical
nnoremap gj j
nnoremap gk k
nnoremap j gj
nnoremap k gk
vnoremap gj j
vnoremap gk k
vnoremap j gj
vnoremap k gk
"Horizontal
nnoremap Y y$
nnoremap H ^
nnoremap L $
vnoremap L $h
vnoremap H ^
"Move to end of line
2016-02-14 16:36:31 -05:00
inoremap jk <End>
inoremap kj <End>
2016-01-21 12:19:51 -05:00
"Move to last character of last line
nnoremap G G$
vnoremap G G$
" }
" Buffers {
"Control-key movement
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
"Arrow keys
nnoremap <Up> <C-w>w
nnoremap <Down> <C-w>W
nnoremap <Left> :bp<CR>
nnoremap <Right> :bn<CR>
"Vertical and horizontal split
nnoremap <C-w>\| <C-w>v<C-w>l
nnoremap <C-w>- <C-w>s<C-w>j
"Close buffer
nnoremap <C-d> <C-w>q
"Fullscreen buffer
nnoremap <C-w>z <C-w>_<C-w>\|
"Go to last buffer
nnoremap <Leader><Leader> <C-^>
" }
" Misc {
vnoremap <silent> * :call VisualSelection('f')<CR>
vnoremap <silent> # :call VisualSelection('b')<CR>
vnoremap ; :
nnoremap ! :!
vnoremap < <gv
vnoremap > >gv
"Disable F1
nnoremap <F1> <nop>
inoremap <F1> <nop>
vnoremap <F1> <nop>
"F2 toggle paste
nnoremap <F2> :set invpaste<CR>
"Better searching
nnoremap / /\v
vnoremap / /\v
"Addition and subtraction
nnoremap + <C-a>
nnoremap - <C-x>
"Backspace remove highlights
nnoremap <BS> :nohlsearch<CR>g<C-g>zo
"Better save
nnoremap <Enter> :up<CR>:silent! call sy#start()<CR>
"Unmap Q
nnoremap Q <Nop>
" }
" }
" Plugin mappings {
"Easymotion
map , <Plug>(easymotion-prefix)
"Ctrl-p
nnoremap <Leader><C-p> :CtrlPFunky<CR>
"Gundo
nnoremap <F5> :GundoToggle<CR>
"Easytags
2016-05-06 14:50:17 -04:00
"nnoremap <Leader><Space> :CtrlPTag<CR>
"Replacing easytags with ctrl p buffer
nnoremap <Leader><Space> :CtrlPBuffer<CR>
2016-01-21 12:19:51 -05:00
"Tagbar
2016-01-28 16:44:03 -05:00
"nnoremap <Leader><Space> :Tagbar<CR>
2016-01-21 12:19:51 -05:00
"Add a bundle from clipboard
nnoremap <Leader>bun G?Plug <CR>yyjp$hdi'"+gPo " \| <Esc>"+gp<Esc>:nohlsearch<CR>:up<CR>:PlugInstall
"Automatic if/else/for/while wrappers
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>`"
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>
" }
" Trial mappings {
nnoremap <Leader>o m`o<Esc>``
nnoremap <Leader>O m`O<Esc>``
" }
" Gui options {
set gfn=Monospace\ 8
set guioptions=
2017-08-29 11:42:06 -04:00
"set guicursor+=n-v-c:blinkon0
set guicursor+=a:blinkon0
2016-01-21 12:19:51 -05:00
set mouse-=a
" }
" Annoyance fixes {
"Annoying escape timeouts
set ttimeout
set ttimeoutlen=0
set notimeout
2017-04-30 13:14:50 -04:00
set conceallevel=0
2016-01-21 12:19:51 -05:00
" }
" Misc {
set tabstop=2 shiftwidth=2 expandtab
set tags=./tags;/
set wildmode=longest,list,full
set formatoptions-=r
set formatoptions-=o
set diffopt+=iwhite
set noesckeys
set shiftwidth=2
set tabstop=2
set modeline
set softtabstop=2
set expandtab
set history=1000
set hidden
2016-07-25 03:53:50 -04:00
"set cursorline
2016-01-21 12:19:51 -05:00
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 fileformat=unix
set encoding=utf-8
set laststatus=2
set foldmethod=indent
set foldnestmax=10
set foldlevel=2
set relativenumber
set number
set background=dark
set t_Co=256
set gdefault
set nocompatible
set ignorecase
set textwidth=0
syntax on
" }
2017-04-30 13:14:50 -04:00
"Polyglot conflicts with another latex editor
let g:polyglot_disabled = ['latex']
"Symfony
let g:symfony_app_console_caller="php"
let g:symfony_app_console_path="bin/console"
2016-01-28 16:44:03 -05:00
"Signify
2015-06-23 20:26:25 -04:00
let g:signify_vcs_list = [ 'git', 'svn' ]
let g:signify_difftool = 'diff'
2016-01-28 16:44:03 -05:00
"CtrlP
2015-06-19 11:55:49 -04:00
let g:ctrlp_root_markers = ['.cproot']
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/](\.git|\.hg|\.svn|vendor)$',
2016-01-28 16:44:03 -05:00
\ 'file': '\v\.(exe|so|dll|class)$',
2015-06-19 11:55:49 -04:00
\ 'link': 'SOME_BAD_SYMBOLIC_LINKS',
\ }
2016-01-28 16:44:03 -05:00
let g:ctrlp_extensions=['funky']
"Airline
let g:airline_left_sep='▶'
let g:airline_right_sep='◀'
2015-02-20 17:00:42 -05:00
let g:airline#extensions#syntastic#enabled=0
2016-01-26 13:47:55 -05:00
let g:ycm_show_diagnostics_ui=0
2016-03-29 17:12:47 -04:00
let g:ycm_path_to_python_interpreter='/usr/bin/python2.7'
2017-08-14 01:19:54 -04:00
"let g:syntastic_cpp_compiler = 'clang++'
"let g:syntastic_cpp_compiler_options = ' -std=c++11 -stdlib=libc++'
let g:syntastic_cpp_compiler_options = ' -std=c++11'
let g:airline#extensions#whitespace#enabled=0
let g:airline#extensions#whitespace#show_message=0
let g:airline#extensions#tmuxline#enabled=1
2016-01-28 16:44:03 -05:00
"Autoformat
2015-08-21 20:38:19 -04:00
let g:formatdef_my_custom_php = '"astyle --mode=php -xc -A10 -j -s2 -xG -S -K -N -xn -xl -n"'
let g:formatdef_my_custom_cpp = '"astyle --mode=c -xc -A10 -j -s2 -xG -S -K -N -xn -xl -n"'
let g:formatter_cpp = ['formatdef_my_custom_cpp']
let g:formatter_php = ['formatdef_my_custom_php']
"let g:formatprg_cpp="astyle"
"let g:formatprg_args_expr_cpp=" --mode=c --style=1tbs -xe -k1 -j"
2014-06-16 09:42:03 -04:00
" These flags don't work for some reason
2014-04-19 13:25:29 -04:00
" -xn -xc -xl -S
2016-01-28 16:44:03 -05:00
"Syntastic
2016-07-26 23:06:22 -04:00
let g:syntastic_java_javac_classpath = "~/applications/java/junit-4.12.jar:~/applications/java/hamcrest-core-1.3.jar:~/wpilib/java/current/lib/WPILib.jar:~/wpilib/java/current/lib/NetworkTables.jar:~/git/ford-java/src"
2016-01-28 16:44:03 -05:00
"IndentGuides
let g:indent_guides_start_level=1
2014-04-19 13:25:29 -04:00
let g:indent_guides_guide_size=1
let g:indent_guides_enable_on_vim_startup=1
let g:php_refactor_command='php /usr/local/bin/refactor.phar'
2016-01-10 16:41:13 -05:00
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
2016-01-21 12:19:51 -05:00
"inoremap <expr><Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
"inoremap <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
2016-01-28 16:44:03 -05:00
let g:UltiSnipsJumpForwardTrigger="<C-S-Q>"
2016-01-21 12:19:51 -05:00
let g:UltiSnipsExpandTrigger="<S-Tab>"
let g:UltiSnipsListSnippets="<C-e>"
2016-01-10 16:41:13 -05:00
let g:UltiSnipsEditSplit="vertical"
2016-01-21 12:19:51 -05:00
let g:ycm_key_list_select_completion = []
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
let loaded_matchit=1
filetype off
if has("win32")
call plug#begin('~/vimfiles/plugged')
else
call plug#begin('~/.vim/plugged')
endif
2016-01-21 12:19:51 -05:00
" Code writing {
2017-02-05 23:29:05 -05:00
Plug 'https://austenwares.com/gitea/vim/vim-autoformat', { 'on': 'Autoformat'}
2016-01-21 12:19:51 -05:00
"Adds autoformat command | https://github.com/Chiel92/vim-autoformat
2017-02-05 23:29:05 -05:00
Plug 'https://austenwares.com/gitea/vim/vim-surround'
2016-01-21 12:19:51 -05:00
"Surround selection in ({\"' or HTML tags | https://github.com/tpope/vim-surround
2017-02-05 23:29:05 -05:00
Plug 'https://austenwares.com/gitea/vim/syntastic'
2016-01-21 12:19:51 -05:00
"Syntax checker | https://github.com/scrooloose/syntastic
2017-02-05 23:29:05 -05:00
Plug 'https://austenwares.com/gitea/vim/nerdtree', { 'on': 'NERDTreeToggle' }
2016-01-21 12:19:51 -05:00
"File browser | https://github.com/scrooloose/nerdtree
2017-02-05 23:29:05 -05:00
Plug 'https://austenwares.com/gitea/vim/vim-easymotion'
2016-01-21 12:19:51 -05:00
"Move around quickly in a document | https://github.com/Lokaltog/vim-easymotion
2017-08-14 01:20:11 -04:00
"Plug 'https://austenwares.com/gitea/vim/gundo.vim', { 'on': 'GundoToggle' }
2016-01-21 12:19:51 -05:00
"Visual undo | https://github.com/sjl/gundo.vim
2017-02-05 23:29:05 -05:00
Plug 'https://austenwares.com/gitea/vim/vim-exchange'
2016-01-21 12:19:51 -05:00
"Exchange two selections of text | https://github.com/tommcdo/vim-exchange
2017-02-05 23:29:05 -05:00
Plug 'https://austenwares.com/gitea/vim/vim-repeat'
2016-01-21 12:19:51 -05:00
"Repeat last tpope command with . | https://github.com/tpope/vim-repeat
2017-10-10 17:24:36 -04:00
Plug 'https://austenwares.com/gitea/vim/vim-fugitive'
2016-01-21 12:19:51 -05:00
"Great Vim-Git compatibility | https://github.com/tpope/vim-fugitive
2017-02-05 23:29:05 -05:00
Plug 'https://austenwares.com/gitea/vim/ctrlp.vim'
2016-01-21 12:19:51 -05:00
"Fuzzy file search | https://github.com/kien/ctrlp.vim
2017-02-05 23:29:05 -05:00
Plug 'https://austenwares.com/gitea/vim/tabular', { 'on': 'Tab' }
2016-01-21 12:19:51 -05:00
"Quickly make tables in vim | https://github.com/godlygeek/tabular
2017-02-05 23:29:05 -05:00
Plug 'https://austenwares.com/gitea/vim/UltiSnips'
2016-10-12 23:42:35 -04:00
"Adds snippet support | https://github.com/sirver/UltiSnips
2017-02-05 23:29:05 -05:00
Plug 'https://austenwares.com/gitea/vim/vim-snippets'
2016-10-12 23:42:35 -04:00
"Add snippets | https://github.com/honza/vim-snippets
2017-02-05 23:29:05 -05:00
Plug 'https://austenwares.com/gitea/vim/eregex.vim'
2016-01-21 12:19:51 -05:00
"Real regexes in vim | https://github.com/othree/eregex.vim
2017-02-05 23:29:05 -05:00
Plug 'https://austenwares.com/gitea/vim/vim-signify'
2016-01-21 12:19:51 -05:00
"Git information inline | https://github.com/mhinz/vim-signify
2017-02-05 23:29:05 -05:00
Plug 'https://austenwares.com/gitea/vim/auto-pairs'
2016-01-21 12:19:51 -05:00
"Automatic pairs | https://github.com/jiangmiao/auto-pairs
2017-02-05 23:29:05 -05:00
Plug 'https://austenwares.com/gitea/vim/YouCompleteMe'
2016-03-29 17:12:47 -04:00
"Autocompletion | https://github.com/Valloric/YouCompleteMe
2017-08-14 01:20:11 -04:00
"Plug 'https://austenwares.com/gitea/vim/vim-java-getset.git'
2017-02-05 23:29:05 -05:00
"Java getters and setters| https://austenwares.com/gitea/vim/vim-java-getset.git
Plug 'https://austenwares.com/gitea/vim/double-tap.git'
2016-05-22 13:52:20 -04:00
"Double tap for comments
2016-01-21 12:19:51 -05:00
" }
" Style {
2017-08-14 01:20:11 -04:00
"Plug 'https://austenwares.com/gitea/vim/vim-indent-guides'
2016-01-21 12:19:51 -05:00
"Indentation guides | https://github.com/nathanaelkane/vim-indent-guides
2017-08-14 01:20:11 -04:00
"Plug 'https://austenwares.com/gitea/vim/vim-airline'
2016-01-21 12:19:51 -05:00
"Bottom status bar | https://github.com/bling/vim-airline
2017-02-05 23:29:05 -05:00
Plug 'https://austenwares.com/gitea/vim/vim-colors'
2016-01-21 12:19:51 -05:00
"Theme pack | https://github.com/spf13/vim-colors
2017-02-05 23:29:05 -05:00
Plug 'https://austenwares.com/gitea/vim/csapprox'
2016-01-21 12:19:51 -05:00
"256 color vim in terminal | https://github.com/godlygeek/csapprox
" }
" Syntax {
2017-04-30 13:14:50 -04:00
Plug 'https://austenwares.com/gitea/vim/vimtex'
"Latex | https://github.com/lervag/vimtex
2017-02-05 23:29:05 -05:00
Plug 'https://austenwares.com/gitea/vim/vim-polyglot'
"Many languages | https://github.com/sheerun/vim-polyglot
2017-02-05 23:29:05 -05:00
Plug 'https://austenwares.com/gitea/vim/vim-vimperator'
2016-01-21 12:19:51 -05:00
"Vimperator for vim | https://github.com/superbrothers/vim-vimperator
2017-02-05 23:29:05 -05:00
Plug 'https://austenwares.com/gitea/vim/i3-vim-syntax'
2016-01-21 12:19:51 -05:00
"i3 syntax | https://github.com/PotatoesMaster/i3-vim-syntax
" }
" Misc {
2017-02-05 23:29:05 -05:00
Plug 'https://austenwares.com/gitea/vim/flappyvird-vim', { 'on': [] }
2016-01-21 12:19:51 -05:00
"The amazing Flappy Bird game | https://github.com/mattn/flappyvird-vim
2017-02-05 23:29:05 -05:00
Plug 'https://austenwares.com/gitea/vim/vim-gnupg'
2016-01-21 12:19:51 -05:00
"GPG support | https://github.com/jamessan/vim-gnupg
2017-02-05 23:29:05 -05:00
Plug 'https://austenwares.com/gitea/vim/vim-bracketed-paste'
2016-08-21 15:04:53 -04:00
"Automatic :set paste funcationality | https://github.com/ConradIrwin/vim-bracketed-paste
2017-02-14 01:43:35 -05:00
Plug 'https://austenwares.com/gitea/vim/HiCursorWords'
"Highlight word under cursor automatically | http://www.vim.org/scripts/script.php?script_id=4306
2016-01-21 12:19:51 -05:00
" }
" Unused {
2017-02-05 23:29:05 -05:00
"Plug 'https://austenwares.com/gitea/vim/mirror.vim'
2016-02-14 13:55:10 -05:00
" "Edit files remotely | https://github.com/zenbro/mirror.vim
2016-01-21 12:19:51 -05:00
" }
2016-10-12 23:42:35 -04:00
" Staging {
2017-04-30 13:14:50 -04:00
"Plug 'https://austenwares.com/gitea/vim/vim-symfony'
"Plug 'dracula/vim'
"Plug 'idanarye/vim-vebugger'
2016-10-12 23:42:35 -04:00
"Debugger | https://github.com/idanarye/vim-vebugger
" }
call plug#end()
2014-04-19 13:25:29 -04:00
filetype plugin indent on
if exists("+undofile")
if isdirectory($HOME . '/.vim/undo')==0
2014-04-19 13:25:29 -04:00
:silent !mkdir -p ~/.vim/undo > /dev/null 2>&1
endif
set undodir=./.vim-undo//
set undodir+=~/.vim/undo//
set undofile
endif
2015-06-23 10:24:46 -04:00
augroup autosave
au!
au BufWritePost .vimrc,vimrc source %
2015-06-23 10:24:46 -04:00
au BufWritePost .Xresources,Xresources silent! !xrdb %
augroup END
2014-04-19 13:25:29 -04:00
augroup vimrcEx
au!
" When editing a file, always jump to the last known cursor position.
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <=line("$") |
2014-04-19 13:25:29 -04:00
\ exe "normal g`\"" |
\ endif
augroup END
if has('gui_running')
set guioptions-=T
else
2017-01-24 15:54:05 -05:00
set t_Co=256
if &term=='xterm' || &term=='screen'
2014-04-19 13:25:29 -04:00
set t_Co=256
endif
"colorscheme torte
2014-04-19 13:25:29 -04:00
endif
silent! colorscheme fruity
function! Initialize()
if has("win32")
if empty(glob("~/_vim/autoload/plug.vim"))
cd ~
silent !mkdir vimfiles
cd vimfiles
silent !mkdir autoload
silent !mkdir plugin
silent !mkdir backup
silent !mkdir undo
silent !mkdir tmp
cd autoload
silent !powershell -command "& { iwr https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim -OutFile plug.vim }"
silent! so ~/_vimrc
silent! PlugInstall
q
endif
else
if empty(glob("~/.vim/autoload/plug.vim"))
silent !mkdir -p ~/.vim/autoload
silent !mkdir -p ~/.vim/plugin
silent !mkdir -p ~/.vim/backup
silent !mkdir -p ~/.vim/undo
silent !mkdir -p ~/.vim/tmp
silent !curl -fLo ~/.vim/autoload/plug.vim https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
silent! so ~/.vimrc
silent! PlugInstall
q
endif
endif
endfunction
2015-08-03 10:46:02 -04:00
if !exists('g:ycm_semantic_triggers')
let g:ycm_semantic_triggers = {}
endif
let g:ycm_semantic_triggers.tex = [
\ 're!\\[A-Za-z]*(ref|cite)[A-Za-z]*([^]]*])?{([^}]*, ?)*'
\ ]
2017-08-29 11:42:06 -04:00
set guifont=Gohu\ GohuFont
2016-01-21 12:19:51 -05:00
inoremap <Tab> <C-R>=g:UltiSnips_Complete()<cr>
2016-01-28 16:44:03 -05:00
map <unique> <buffer> <LocalLeader>b <Plug>JavagetsetInsertBothGetterSetter
2016-04-02 09:49:12 -04:00
map <Leader>a O<Esc>:Autoformat<CR>:v/\S/d<CR>:nohlsearch<CR>
2016-04-02 16:51:27 -04:00
inoremap <expr> <CR> getline(".") =~ '^\s*\([#"]\)\s*$' ? "\<C-u>" : "\<CR>"