diff --git a/.gitignore b/.gitignore index 05b82ad..47af852 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ vim/autoload/plug.vim vim/plugged/* vim/rc/*.local.rc.vim vim/tmp/*.swp +vim/tmp/*.swo vim/.netrwhist diff --git a/Makefile b/Makefile index 6fe550c..73475e6 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,13 @@ default: install install: - ./vim-sync-append.sh + sh ./vim-sync-append.sh + +uninstall: + rm ~/.vimrc + rm ~/.nvimrc + rm -fr ~/.vim + rm -fr ~/.nvim clean: rm -fr ./vim/plugged diff --git a/vim-sync-append.sh b/vim-sync-append.sh index 3707ee9..ad46859 100755 --- a/vim-sync-append.sh +++ b/vim-sync-append.sh @@ -4,15 +4,15 @@ ############################ #! /bin/bash -if [ -d ~/.vim ] || [ -f ~/.vimrc ]; then - echo "Vim files already exist. Please backup or remove .vim and .vimrc" +if [ -d ~/.vim ] || [ -f ~/.vimrc ] || [ -d ~/.nvim ] || [ -f ~/.nvimrc ]; then + echo "Vim files already exist. Please backup or remove .(n)vim and .(n)vimrc" exit 1 fi # Try to load .bashrc to load rvm functions -if [ -f ~/.bashrc ]; then - . ~/.bashrc -fi +# if [ -f ~/.bashrc ]; then + # . ~/.bashrc +# fi # Get current directory for future use in links VIM_SYNC_DIR=$(dirname $0) @@ -20,15 +20,21 @@ cd $VIM_SYNC_DIR VIM_SYNC_DIR=$(pwd) +# Vim ln -s $VIM_SYNC_DIR/vimrc ~/.vimrc ln -s $VIM_SYNC_DIR/vim ~/.vim +# Neovim +ln -s $VIM_SYNC_DIR/vimrc ~/.nvimrc +ln -s $VIM_SYNC_DIR/vim ~/.nvim + # # Download and install vim-plug # curl -fLo ~/.vim/autoload/plug.vim https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim # Install all bundles echo "Install all bundles" vim +PlugInstall +qall +nvim +PlugInstall +qall vim --version | grep -q '\+ruby' || { echo "Warning: Default vim does not include ruby."; } vim --version | grep -q '\+python' || { echo "Warning: Default vim does not include python"; } diff --git a/vim/rc/plugins.rc.vim b/vim/rc/plugins.rc.vim index 57b4363..bb1968c 100644 --- a/vim/rc/plugins.rc.vim +++ b/vim/rc/plugins.rc.vim @@ -1,55 +1,25 @@ " Navigation {{ Plug 'file-line' Plug 'tpope/vim-vinegar' -Plug 'tpope/vim-fugitive', { 'on': ['Gblame', 'Gdiff', 'Gcommit', 'Gstatus', 'Gwrite'] } " {{ +Plug 'tpope/vim-fugitive', { 'on': ['Gblame', 'Gdiff', 'Gcommit', 'Gstatus', 'Gwrite'] } +" {{ nnoremap gb :Gblame nnoremap gc :Gcommit nnoremap gd :Gdiff nnoremap gs :Gstatus nnoremap gw :Gwrite - " }} +" }} Plug 'sandeepcr529/Buffet.vim', { 'on': 'Bufferlist' } " {{ nnoremap :Bufferlist " }} -Plug 'ctrlpvim/ctrlp.vim' -" {{ - " Ensure max height isn't too large. (for performance) - let g:ctrlp_max_height = 10 - " Conditional Mappings - let g:ctrlp_map = '' - " Allow ctrl p to open over the initial nerdtree window - let g:ctrlp_dont_split = 'netrw' - " Support tag jumping - let g:ctrlp_extensions = ['tag', 'buffertag'] - " Support Apex language - let g:ctrlp_buftag_types = { - \ 'apex' : '--language-force=c#', - \ 'go' : { - \ 'bin' : 'gotags', - \ 'args' : '-sort -silent', - \} - \} - " Leader Commands - nnoremap b :CtrlPBuffer - nnoremap t :CtrlPBufTag - nnoremap r :CtrlPTag - nnoremap u :CtrlPCurFile - nnoremap m :CtrlPMRUFiles - - " Special stuff for The Silver Searcher - if executable('ag') - " use ag - set grepprg=ag\ --nogroup\ --nocolor - " use ag for CtrlP - let g:ctrlp_user_command = 'ag %s -l --nocolor --nogroup -g ""' - " ag is fast enough we don't need cache - let g:ctrlp_use_caching = 0 - endif - " }} " }} -" Search {{ + +Plug 'ctrlpvim/ctrlp.vim' +call g:source_rc('plugins/ctrlp.rc.vim') + +" ag / ack {{ if executable('ag') Plug 'rking/ag.vim' " {{ @@ -106,36 +76,43 @@ end " }} " Programming {{ -Plug 'majutsushi/tagbar' " {{ +Plug 'majutsushi/tagbar' +" {{ nnoremap :TagbarToggle " Autofocus tagbar let g:tagbar_autofocus = 1 - " }} -Plug 'scrooloose/syntastic' " {{ - let g:syntastic_html_tidy_ignore_errors = [ - \ 'proprietary attribute "ng-show"', - \ 'proprietary attribute "ng-controller"', - \ 'proprietary attribute "ng-repeat"', - \ 'proprietary attribute "ng-app"', - \ 'proprietary attribute "ng-click"' - \ ] - let g:syntastic_python_checkers = ['flake8'] - let g:syntastic_python_flake8_args='--max-line-length=80' - " let g:syntastic_python_checkers = ['pep8'] - " " let g:syntastic_python_pep8_args='--ignore=E501' - " " let g:syntastic_python_checkers = ['jshint'] - " " let g:syntastic_javascript_jshint_args='--ignore=E501' - " " }} -Plug 'tomtom/tcomment_vim', { 'on': ['TComment', 'TCommentBlock'] } " {{ +" syntastic {{ +if !has('nvim') + " Only use if not neovim, on neovim we have Neomake + Plug 'scrooloose/syntastic' " {{ + let g:syntastic_html_tidy_ignore_errors = [ + \ 'proprietary attribute "ng-show"', + \ 'proprietary attribute "ng-controller"', + \ 'proprietary attribute "ng-repeat"', + \ 'proprietary attribute "ng-app"', + \ 'proprietary attribute "ng-click"' + \ ] + let g:syntastic_python_checkers = ['flake8'] + let g:syntastic_python_flake8_args='--max-line-length=80' + " let g:syntastic_python_checkers = ['pep8'] + " " let g:syntastic_python_pep8_args='--ignore=E501' + " " let g:syntastic_python_checkers = ['jshint'] + " " let g:syntastic_javascript_jshint_args='--ignore=E501' + " + " }} +endif +" }} +Plug 'tomtom/tcomment_vim', { 'on': ['TComment', 'TCommentBlock'] } +" {{ nnoremap // :TComment vnoremap // :TCommentBlock - " }} -Plug 'benekastah/neomake' +" }} " }} " GUI {{ -Plug 'bling/vim-airline' " {{ +Plug 'bling/vim-airline' +" {{ " Use short-form mode text let g:airline_mode_map = { \ '__' : '-', @@ -159,15 +136,16 @@ Plug 'bling/vim-airline' " {{ let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#tabline#left_sep = ' ' let g:airline#extensions#tabline#left_alt_sep = '|' - " }} +" }} Plug 'gregsexton/MatchTag' Plug 'rizzatti/dash.vim', { 'on': 'Dash'} " }} " Filetypes {{ -Plug 'PreserveNoEOL' " {{ +Plug 'PreserveNoEOL' +" {{ let g:PreserveNoEOL = 1 - " }} +" }} Plug 'ViViDboarder/vim-forcedotcom' Plug 'avakhov/vim-yaml' Plug 'dart-lang/dart-vim-plugin' @@ -177,25 +155,26 @@ Plug 'hsanson/vim-android' Plug 'pangloss/vim-javascript' Plug 'pdurbin/vim-tsv' Plug 'tfnico/vim-gradle' +" }} + " Python {{ - Plug 'alfredodeza/coveragepy.vim' - Plug 'alfredodeza/pytest.vim' - Plug 'davidhalter/jedi-vim' - " {{ - let g:jedi#completions_enabled = 0 - let g:jedi#auto_vim_configuration = 0 - " }} - Plug 'klen/python-mode' - " {{ - let g:pymode_lint = 1 - let g:pymode_lint_on_write = 0 - let g:pymode_lint_checkers = ['flake8'] - let g:pymode_rope = 0 - let g:pymode_rope_completion = 0 - let g:pymode_rope_complete_on_dot = 0 - let g:pymode_breakpoint = 0 - "}} - " }} +Plug 'alfredodeza/coveragepy.vim' +Plug 'alfredodeza/pytest.vim' +Plug 'davidhalter/jedi-vim' +" {{ + let g:jedi#completions_enabled = 0 + let g:jedi#auto_vim_configuration = 0 +" }} +Plug 'klen/python-mode' +" {{ + let g:pymode_lint = 1 + let g:pymode_lint_on_write = 0 + let g:pymode_lint_checkers = ['flake8'] + let g:pymode_rope = 0 + let g:pymode_rope_completion = 0 + let g:pymode_rope_complete_on_dot = 0 + let g:pymode_breakpoint = 0 + "}} " }} " Themes {{ @@ -212,8 +191,31 @@ Plug 'wombat256.vim' " }} " System {{ +" neomake / vim-dispatch {{ +if has('nvim') + Plug 'benekastah/neomake' + " {{ + let g:neomake_apex_force_maker = { + \ 'exe': 'force', + \ 'args': ['push'], + \ 'errorformat': &errorformat, + \ } + + let g:neomake_apex_atf_maker = { + \ 'exe': 'atf deploy file', + \ 'args': [], + \ 'errorformat': &errorformat, + \ } + + let g:neomake_apex_enabled_makers = ['force'] + " let g:neomake_apex_enabled_makers = ['atf'] + let g:neomake_python_makers = ['flake8'] + " }} +else + Plug 'tpope/vim-dispatch' +endif +" }} Plug 'Shougo/vimproc.vim', { 'do': 'make' } -Plug 'tpope/vim-dispatch' Plug 'tpope/vim-repeat' " emacs bindinds in insert Plug 'tpope/vim-rsi' diff --git a/vim/rc/plugins/ctrlp.rc.vim b/vim/rc/plugins/ctrlp.rc.vim index e69de29..1d810b0 100644 --- a/vim/rc/plugins/ctrlp.rc.vim +++ b/vim/rc/plugins/ctrlp.rc.vim @@ -0,0 +1,34 @@ +" Configurationf or ctrlp.vim + +" Ensure max height isn't too large. (for performance) +let g:ctrlp_max_height = 10 +" Conditional Mappings +let g:ctrlp_map = '' +" Allow ctrl p to open over the initial nerdtree window +let g:ctrlp_dont_split = 'netrw' +" Support tag jumping +let g:ctrlp_extensions = ['tag', 'buffertag'] +" Support Apex language +let g:ctrlp_buftag_types = { + \ 'apex' : '--language-force=c#', + \ 'go' : { + \ 'bin' : 'gotags', + \ 'args' : '-sort -silent', + \} + \} +" Leader Commands +nnoremap b :CtrlPBuffer +nnoremap t :CtrlPBufTag +nnoremap r :CtrlPTag +nnoremap u :CtrlPCurFile +nnoremap m :CtrlPMRUFiles + +" Special stuff for The Silver Searcher +if executable('ag') + " use ag + set grepprg=ag\ --nogroup\ --nocolor + " use ag for CtrlP + let g:ctrlp_user_command = 'ag %s -l --nocolor --nogroup -g ""' + " ag is fast enough we don't need cache + let g:ctrlp_use_caching = 0 +endif diff --git a/vim/rc/ui.rc.vim b/vim/rc/ui.rc.vim index 86344f6..d4de34b 100644 --- a/vim/rc/ui.rc.vim +++ b/vim/rc/ui.rc.vim @@ -42,9 +42,9 @@ endif if has("gui_running") if has("gui_win32") set guifont=Consolas:h10:b - elseif has("gui_macvim") + elseif IsMac() && (has("gui_macvim") || has('nvim')) try - set guifont=DejaVu\ Sans\ Mono\ for\ Powerline:h11 + " set guifont=DejaVu\ Sans\ Mono\ for\ Powerline:h11 catch " Failed to set font endtry @@ -53,7 +53,6 @@ endif " }} " Set xterm and screen/tmux's title {{ -set notitle set titlestring=vim\ %{expand(\"%t\")} if &term =~ "^screen" " pretend this is xterm. it probably is anyway, but if term is left as @@ -69,5 +68,6 @@ if &term =~ "^screen" set t_fs=\ set t_ut= endif -set title +set notitle +" set title " }} diff --git a/vimrc b/vimrc index 06f8ee6..fe124d0 100644 --- a/vimrc +++ b/vimrc @@ -7,12 +7,12 @@ if &compatible set nocompatible endif -function! s:smart_source_rc(name) - call s:source_rc(a:name . '.rc.vim') - call s:source_rc(a:name . '.local.rc.vim') +function! g:smart_source_rc(name) + call g:source_rc(a:name . '.rc.vim') + call g:source_rc(a:name . '.local.rc.vim') endfunction -function! s:source_rc(path) +function! g:source_rc(path) let l:f_path = fnameescape(expand('~/.vim/rc/' . a:path)) if filereadable(l:f_path) execute 'source' . l:f_path @@ -43,12 +43,12 @@ if empty(glob('~/.vim/autoload/plug.vim')) autocmd VimEnter * PlugInstall endif -call s:source_rc('init.rc.vim') +call g:source_rc('init.rc.vim') call plug#begin() -call s:smart_source_rc('plugins') +call g:smart_source_rc('plugins') call plug#end() -call s:smart_source_rc('edit') -call s:smart_source_rc('keymap') -call s:smart_source_rc('ui') +call g:smart_source_rc('edit') +call g:smart_source_rc('keymap') +call g:smart_source_rc('ui')