2017-02-08 13:05:01 -06:00
|
|
|
|
if has('nvim')
|
|
|
|
|
if empty(glob('~/.config/nvim/autoload/plug.vim'))
|
|
|
|
|
silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
|
|
|
|
autocmd VimEnter * PlugInstall
|
|
|
|
|
endif
|
|
|
|
|
else
|
|
|
|
|
if empty(glob('~/.vim/autoload/plug.vim'))
|
|
|
|
|
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
|
|
|
|
autocmd VimEnter * PlugInstall
|
|
|
|
|
endif
|
|
|
|
|
end
|
2017-02-08 11:54:30 -06:00
|
|
|
|
|
2017-12-21 12:18:17 -06:00
|
|
|
|
" vim compatibility
|
2017-02-28 10:56:23 -06:00
|
|
|
|
let $vimdir = $HOME.'/.vim'
|
|
|
|
|
if has('nvim')
|
|
|
|
|
let $vimdir = $HOME.'/.config/nvim'
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
" OS detection functions
|
|
|
|
|
silent function! OSX()
|
|
|
|
|
return has('macunix')
|
|
|
|
|
endfunction
|
|
|
|
|
silent function! LINUX()
|
|
|
|
|
return has('unix') && !has('macunix') && !has('win32unix')
|
|
|
|
|
endfunction
|
|
|
|
|
silent function! WINDOWS()
|
|
|
|
|
return (has('win32') || has('win64'))
|
|
|
|
|
endfunction
|
|
|
|
|
|
2017-02-08 11:54:30 -06:00
|
|
|
|
" tell vim to reload the init.vim file when it saves it
|
2017-02-28 10:56:23 -06:00
|
|
|
|
" if has('nvim')
|
|
|
|
|
" autocmd! BufWritePost init.vim source %
|
|
|
|
|
" else
|
|
|
|
|
" autocmd! BufWritePost .vimrc source %
|
|
|
|
|
" end
|
|
|
|
|
|
|
|
|
|
" load a per-environment file if one exists
|
|
|
|
|
if filereadable(expand("$HOME/.env_init.vim"))
|
|
|
|
|
source "$HOME/.env_init.vim"
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
if has('vim_starting')
|
|
|
|
|
set encoding=utf8
|
|
|
|
|
endif
|
2017-02-08 11:54:30 -06:00
|
|
|
|
|
|
|
|
|
" plugin build functions
|
|
|
|
|
function! BuildComposer(info)
|
|
|
|
|
if a:info.status != 'unchanged' || a:info.force
|
|
|
|
|
!cargo build --release
|
|
|
|
|
UpdateRemotePlugins
|
|
|
|
|
endif
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
function! DoRemote(arg)
|
|
|
|
|
UpdateRemotePlugins
|
|
|
|
|
endfunction
|
|
|
|
|
|
2017-02-28 10:56:23 -06:00
|
|
|
|
" initialize plugin manager
|
2017-02-08 13:05:01 -06:00
|
|
|
|
if has('nvim')
|
|
|
|
|
call plug#begin('~/.config/nvim/bundle')
|
|
|
|
|
else
|
|
|
|
|
call plug#begin('~/.vim/bundle')
|
|
|
|
|
endif
|
|
|
|
|
|
2017-02-08 11:54:30 -06:00
|
|
|
|
" let plugin manager manage itself
|
|
|
|
|
Plug 'junegunn/vim-plug'
|
|
|
|
|
|
|
|
|
|
" plugins
|
|
|
|
|
|
2017-12-21 12:18:17 -06:00
|
|
|
|
" if vim is being launched to view man pages, don't do our session stuff!
|
2017-02-08 11:54:30 -06:00
|
|
|
|
if exists('asmanviewer')
|
|
|
|
|
let g:prosession_dir = '/dev/null'
|
|
|
|
|
else
|
2017-02-08 13:05:01 -06:00
|
|
|
|
Plug 'tpope/vim-obsession' " session ease-of-use
|
2017-02-08 11:54:30 -06:00
|
|
|
|
Plug 'dhruvasagar/vim-prosession' " more session ease-of-use
|
|
|
|
|
let g:prosession_dir = '~/.config/nvim/session/'
|
|
|
|
|
endif
|
2017-02-28 10:56:23 -06:00
|
|
|
|
|
2017-11-13 15:55:11 -06:00
|
|
|
|
Plug 'vim-airline/vim-airline' " statusline
|
2017-04-14 15:03:39 -05:00
|
|
|
|
let g:airline_powerline_fonts = 1
|
2017-02-08 11:54:30 -06:00
|
|
|
|
let g:airline#extensions#tabline#enabled = 1 " automatically displays all buffers when there's only one tab open
|
|
|
|
|
let g:airline#extensions#tabline#fnamemod = ':t'
|
|
|
|
|
" set laststatus=2 " always show statusline
|
|
|
|
|
" set noshowmode " hides default mode
|
|
|
|
|
let g:airline#extensions#tabline#left_sep = ''
|
|
|
|
|
let g:airline#extensions#tabline#left_alt_sep = ''
|
|
|
|
|
let g:airline_right_alt_sep = ''
|
|
|
|
|
let g:airline_right_sep = ''
|
|
|
|
|
let g:airline_left_alt_sep= ''
|
|
|
|
|
let g:airline_left_sep = ''
|
2017-02-28 10:56:23 -06:00
|
|
|
|
let g:airline#extensions#tabline#buffers_label = ''
|
2017-02-08 11:54:30 -06:00
|
|
|
|
Plug 'vim-airline/vim-airline-themes'
|
2017-04-28 08:31:28 -05:00
|
|
|
|
let g:airline_mode_map = {
|
|
|
|
|
\ '__' : '-',
|
|
|
|
|
\ 'n' : 'N',
|
|
|
|
|
\ 'i' : 'I',
|
|
|
|
|
\ 'R' : 'R',
|
|
|
|
|
\ 'c' : 'C',
|
|
|
|
|
\ 'v' : 'V',
|
|
|
|
|
\ 'V' : 'V',
|
|
|
|
|
\ '' : 'V',
|
|
|
|
|
\ 's' : 'S',
|
|
|
|
|
\ 'S' : 'S',
|
|
|
|
|
\ '' : 'S',
|
|
|
|
|
\ }
|
2017-02-08 11:54:30 -06:00
|
|
|
|
|
|
|
|
|
Plug 'scrooloose/nerdtree', {'on': ['NERDTreeToggle', 'NERDTree']} " nice sidebar for files
|
|
|
|
|
let g:NERDTreeDirArrowExpandable = ' '
|
|
|
|
|
let g:NERDTreeDirArrowCollapsible = ' '
|
|
|
|
|
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif " close vim if last buffer is a NERD buffer
|
|
|
|
|
|
2018-06-05 14:34:53 -05:00
|
|
|
|
Plug 'nathanaelkane/vim-indent-guides' " indentation guides
|
|
|
|
|
let g:indent_guide_auto_colors = 1
|
|
|
|
|
let g:indent_guides_enable_on_vim_startup = 1
|
2017-02-08 11:54:30 -06:00
|
|
|
|
|
2018-06-05 14:34:53 -05:00
|
|
|
|
" Plug 'roxma/nvim-completion-manager'
|
2017-06-05 22:15:32 -05:00
|
|
|
|
|
2017-06-05 22:17:31 -05:00
|
|
|
|
" Plug 'vimwiki/vimwiki'
|
2018-06-05 14:34:53 -05:00
|
|
|
|
" let wiki1 = {}
|
|
|
|
|
" let wiki1.path = "~/../doc/wiki/"
|
|
|
|
|
" let wiki1.syntax = "markdown"
|
|
|
|
|
" let wiki1.ext = ".md"
|
|
|
|
|
" let g:vimwiki_list = [wiki1]
|
|
|
|
|
|
|
|
|
|
" Plug 'scrooloose/syntastic' " syntax checker
|
|
|
|
|
Plug 'w0rp/ale' " syntax checker
|
2018-06-06 15:55:34 -05:00
|
|
|
|
let g:ale_sign_column_always = 0
|
|
|
|
|
let g:ale_set_signs = 0
|
|
|
|
|
highlight clear ALEErrorSign
|
|
|
|
|
highlight clear ALEWarningSign
|
2017-02-08 11:54:30 -06:00
|
|
|
|
Plug 'bkad/CamelCaseMotion' " camel case and underscore word movements
|
2017-05-09 13:04:00 -05:00
|
|
|
|
Plug 'vim-scripts/LargeFile' " gracefully handle very large files
|
2018-06-05 14:34:53 -05:00
|
|
|
|
Plug 'vim-scripts/utl.vim' " allow for inter-file linking (I meant to use this instead of vimwiki)
|
2017-02-08 11:54:30 -06:00
|
|
|
|
Plug 'tpope/vim-commentary' " toggle comments in code easily
|
2018-06-05 14:34:53 -05:00
|
|
|
|
Plug 'tpope/vim-repeat' " better vim repeating for plugin-provided actions
|
2017-06-05 22:15:32 -05:00
|
|
|
|
Plug 'vim-scripts/SyntaxRange' " defined different syntax ranges in a file for highlighting
|
2017-02-08 11:54:30 -06:00
|
|
|
|
Plug 'tmux-plugins/vim-tmux-focus-events' " allow transitions within tmux
|
|
|
|
|
Plug 'christoomey/vim-tmux-navigator' " allow transitions within tmux
|
2018-06-05 14:34:53 -05:00
|
|
|
|
Plug 'godlygeek/tabular' " align text
|
|
|
|
|
Plug 'dhruvasagar/vim-table-mode' " for creating and editing crazy vim tables (I mostly use sc now though)
|
|
|
|
|
let g:table_mode_corner='|'
|
2017-02-08 11:54:30 -06:00
|
|
|
|
Plug 'lytedev/vim-superman' " view man pages with vim
|
|
|
|
|
Plug 'tpope/vim-surround' " quickly modify text surrounding objects
|
|
|
|
|
Plug 'tpope/vim-speeddating' " vim knows about date-like text objects
|
2017-04-28 08:31:28 -05:00
|
|
|
|
Plug 'tpope/vim-fugitive' " vim git commands
|
2017-07-12 02:20:50 -05:00
|
|
|
|
" Plug 'airblade/vim-gitgutter' " vim git gutter information
|
|
|
|
|
" let g:gitgutter_override_sign_column_highlight = 0
|
|
|
|
|
" let g:gitgutter_sign_added = '+'
|
|
|
|
|
" let g:gitgutter_sign_modified = '~'
|
|
|
|
|
" let g:gitgutter_sign_removed = '-'
|
|
|
|
|
" let g:gitgutter_sign_removed_first_line = '-'
|
|
|
|
|
" let g:gitgutter_sign_modified_removed = '~'
|
2017-02-08 11:54:30 -06:00
|
|
|
|
Plug 'michaeljsmith/vim-indent-object' " adds an indentation level text object
|
|
|
|
|
Plug 'wellle/targets.vim' " adds some more handy text objects
|
2017-04-02 16:35:39 -05:00
|
|
|
|
Plug 'dbakker/vim-projectroot' " adds helper functions for getting to a project's root directory
|
2017-02-28 10:56:23 -06:00
|
|
|
|
Plug 'mikewest/vimroom' " distraction-free editing
|
2017-02-08 11:54:30 -06:00
|
|
|
|
Plug 'editorconfig/editorconfig-vim' " loads project-specific editor settings
|
|
|
|
|
let g:vimroom_sidebar_height = 0
|
|
|
|
|
|
|
|
|
|
Plug 'junegunn/fzf', {'dir': '~/.fzf', 'do': './install --all'} " fuzzy file finding
|
|
|
|
|
Plug 'junegunn/fzf.vim' " helpers for using fzf in vim
|
|
|
|
|
let g:fzf_layout = { 'window': 'enew' }
|
|
|
|
|
|
|
|
|
|
" plugins for specific file types
|
2017-02-28 10:56:23 -06:00
|
|
|
|
|
2018-06-06 15:55:34 -05:00
|
|
|
|
Plug 'junegunn/vader.vim', {'for': ['vader', 'vimscript', 'vim']}
|
2017-03-09 17:52:47 -06:00
|
|
|
|
Plug 'othree/html5.vim', {'for': ['jade', 'pug', 'html', 'vue']}
|
2017-03-14 20:35:15 -05:00
|
|
|
|
Plug 'mxw/vim-jsx', {'for': ['jsx', 'javascript', 'js', 'javascript.jsx']}
|
|
|
|
|
let g:jsx_ext_required = 0 " allow JSX in normal JS files
|
2018-06-05 14:34:53 -05:00
|
|
|
|
Plug 'hail2u/vim-css3-syntax', {'for': ['styl', 'stylus', 'sass', 'scss', 'css', 'vue']}
|
2017-02-08 11:54:30 -06:00
|
|
|
|
Plug 'kchmck/vim-coffee-script', {'for': ['coffee', 'coffeescript', 'vue']}
|
|
|
|
|
Plug 'posva/vim-vue', {'for': ['vue']}
|
2018-04-25 20:01:39 -05:00
|
|
|
|
Plug 'elixir-lang/vim-elixir', {'for': ['elixir', 'ex', 'exs']}
|
2018-06-05 11:05:20 -05:00
|
|
|
|
Plug 'OrangeT/vim-csharp', {'for': ['cshtml', 'cshtml.html', 'cs', 'razor']}
|
2018-04-25 22:53:43 -05:00
|
|
|
|
Plug 'vim-erlang/vim-erlang-runtime', {'for': ['erlang', 'erl']}
|
2018-06-05 14:34:53 -05:00
|
|
|
|
" Plug 'slashmili/alchemist.vim', {'for': ['elixir', 'ex', 'exs']}
|
|
|
|
|
Plug 'mattn/emmet-vim', {'for': ['html', 'vue']}
|
2017-02-08 11:54:30 -06:00
|
|
|
|
Plug 'wavded/vim-stylus', {'for': ['styl', 'stylus', 'vue']}
|
2017-11-14 17:31:30 -06:00
|
|
|
|
Plug 'quabug/vim-gdscript', {'for': ['gd', 'gdscript']}
|
2017-02-08 11:54:30 -06:00
|
|
|
|
Plug 'rust-lang/rust.vim', {'for': ['rs', 'rust']}
|
2017-04-20 08:16:02 -05:00
|
|
|
|
Plug 'mustache/vim-mustache-handlebars', {'for': ['html.handlebars', 'handlebars', 'hbs']}
|
2017-06-05 22:15:32 -05:00
|
|
|
|
Plug 'plasticboy/vim-markdown', {'for': ['md', 'markdown', 'vimwiki']}
|
2017-11-13 15:55:11 -06:00
|
|
|
|
Plug 'lifepillar/pgsql.vim', {'for': ['psql', 'sql']}
|
2018-03-18 12:51:03 -05:00
|
|
|
|
Plug 'cespare/vim-toml', {'for': ['toml']}
|
2017-06-05 22:15:32 -05:00
|
|
|
|
let g:utl_cfg_hdl_scm_http_system = "silent !$BROWSER '%u#%f' &"
|
2018-06-05 14:34:53 -05:00
|
|
|
|
Plug 'digitaltoad/vim-pug', {'for': ['pug', 'jade', 'vue']}
|
2017-02-08 11:54:30 -06:00
|
|
|
|
Plug 'leafo/moonscript-vim', {'for': ['moon', 'moonscript']}
|
2018-06-05 14:34:53 -05:00
|
|
|
|
Plug 'evidens/vim-twig', {'for': ['php']}
|
2017-02-08 11:54:30 -06:00
|
|
|
|
Plug 'leafgarland/typescript-vim', {'for': ['ts', 'typescript']}
|
|
|
|
|
Plug 'jwalton512/vim-blade', {'for': ['blade', 'blade.php']}
|
|
|
|
|
|
|
|
|
|
call plug#end()
|
|
|
|
|
|
|
|
|
|
filetype on
|
|
|
|
|
filetype indent on
|
|
|
|
|
filetype plugin on
|
|
|
|
|
|
2017-11-13 15:55:11 -06:00
|
|
|
|
let $NVIM_TUI_ENABLE_CURSOR_SHAPE = 1
|
|
|
|
|
|
2017-02-08 11:54:30 -06:00
|
|
|
|
" language specific configuration
|
|
|
|
|
|
|
|
|
|
" C
|
|
|
|
|
let c_space_errors = 1
|
|
|
|
|
let c_comment_strings = 0 " dont highlight strings inside C comments
|
|
|
|
|
|
|
|
|
|
" Python
|
|
|
|
|
let python_space_errors = 1
|
|
|
|
|
" autocmd FileType python setl tabstop=4 expandtab shiftwidth=4 softtabstop=4
|
|
|
|
|
" autocmd FileType js setl tabstop=2 expandtab shiftwidth=2 softtabstop=2
|
|
|
|
|
" autocmd FileType vue setl tabstop=2 expandtab shiftwidth=2 softtabstop=2
|
|
|
|
|
autocmd FileType php setl tabstop=4 expandtab shiftwidth=4 softtabstop=4
|
|
|
|
|
|
|
|
|
|
" Markdown
|
2017-02-10 12:06:59 -06:00
|
|
|
|
autocmd BufNewFile,BufReadPost *.md setl filetype=markdown spell
|
2017-02-08 11:54:30 -06:00
|
|
|
|
|
|
|
|
|
" Text
|
|
|
|
|
autocmd BufNewFile,BufReadPost *.txt setl spell textwidth=0 wrapmargin=0
|
|
|
|
|
|
2017-05-20 13:56:34 -05:00
|
|
|
|
" Make any necessary directories in the path when saving a file
|
|
|
|
|
fun! <SID>AutoMakeDirectory()
|
|
|
|
|
let s:directory = expand("<afile>:p:h")
|
|
|
|
|
if !isdirectory(s:directory)
|
|
|
|
|
call mkdir(s:directory, "p")
|
|
|
|
|
endif
|
|
|
|
|
endfun
|
|
|
|
|
autocmd BufWritePre,FileWritePre * :call <SID>AutoMakeDirectory()
|
|
|
|
|
|
|
|
|
|
if !exists("g:make_args")
|
2017-06-05 22:36:35 -05:00
|
|
|
|
let g:make_args="default"
|
2017-05-20 13:56:34 -05:00
|
|
|
|
endif
|
|
|
|
|
fun! RunMake()
|
|
|
|
|
split
|
|
|
|
|
if has('nvim')
|
2017-05-20 22:40:32 -05:00
|
|
|
|
" run from the root of the current git repository
|
|
|
|
|
let path = system("git rev-parse --show-toplevel | tr -d '\\n'")
|
|
|
|
|
" TODO: handle non-git situations
|
|
|
|
|
execute 'terminal cd ' . path . ' && make ' . g:make_args
|
2017-05-20 13:56:34 -05:00
|
|
|
|
else
|
|
|
|
|
execute '!make ' . g:make_args
|
|
|
|
|
endif
|
|
|
|
|
endfun
|
|
|
|
|
|
2017-05-20 22:40:32 -05:00
|
|
|
|
" kill the terminal buffer when the process exits
|
|
|
|
|
" autocmd TermClose * call feedkeys('<cr>')
|
|
|
|
|
|
2017-12-21 12:18:17 -06:00
|
|
|
|
let settingsfile=$vimdir.'/settings.vim'
|
|
|
|
|
exec 'source ' . settingsfile
|
2017-07-12 02:20:50 -05:00
|
|
|
|
|
2017-02-08 11:54:30 -06:00
|
|
|
|
if exists('asmanviewer')
|
|
|
|
|
set nonumber " no line numbers when viewing a man page
|
2017-07-12 02:20:50 -05:00
|
|
|
|
set norelativenumber " no line numbers when viewing a man page
|
2017-02-08 11:54:30 -06:00
|
|
|
|
else
|
2017-07-12 02:20:50 -05:00
|
|
|
|
set nonumber " line numbers
|
|
|
|
|
set norelativenumber " line numbers
|
2017-02-08 11:54:30 -06:00
|
|
|
|
endif
|
2017-02-28 10:56:23 -06:00
|
|
|
|
|
|
|
|
|
" a toggle-able minimalistic distraction-free text editing mode
|
2017-02-08 11:54:30 -06:00
|
|
|
|
let s:distractionFreeMode = 0
|
|
|
|
|
fun! DistractionFreeModeFunc()
|
2017-02-08 13:05:01 -06:00
|
|
|
|
AirlineToggle
|
2017-02-08 11:54:30 -06:00
|
|
|
|
VimroomToggle
|
|
|
|
|
if s:distractionFreeMode == 0
|
|
|
|
|
let s:distractionFreeMode = 1
|
2017-02-08 13:05:01 -06:00
|
|
|
|
set nocursorline
|
2017-02-08 11:54:30 -06:00
|
|
|
|
set laststatus=0
|
|
|
|
|
set noshowmode
|
|
|
|
|
set noruler
|
|
|
|
|
set noshowcmd
|
|
|
|
|
set nonumber
|
|
|
|
|
hi NonText ctermfg=black guifg=black
|
|
|
|
|
else
|
|
|
|
|
let s:distractionFreeMode = 0
|
2017-02-08 13:05:01 -06:00
|
|
|
|
set cursorline
|
2017-02-08 11:54:30 -06:00
|
|
|
|
set showmode
|
|
|
|
|
set ruler
|
|
|
|
|
set laststatus=2
|
|
|
|
|
set showcmd
|
|
|
|
|
set number
|
2017-07-12 02:20:50 -05:00
|
|
|
|
hi NonText ctermfg=black guifg=black
|
2017-02-08 13:05:01 -06:00
|
|
|
|
colorscheme base16-donokai
|
2017-02-08 11:54:30 -06:00
|
|
|
|
endif
|
|
|
|
|
endfunction
|
|
|
|
|
|
2017-02-08 12:08:10 -06:00
|
|
|
|
" prevents normal window navigation and closing while in DistractionFreeMode
|
|
|
|
|
fun! CheckCloseDistractionFreeMode()
|
2017-02-08 13:05:01 -06:00
|
|
|
|
if s:distractionFreeMode == 1
|
|
|
|
|
call DistractionFreeModeFunc()
|
|
|
|
|
endif
|
2017-02-08 12:08:10 -06:00
|
|
|
|
endfunction
|
|
|
|
|
|
2017-02-28 10:56:23 -06:00
|
|
|
|
" run the previous checking function every time we leave a window
|
2017-02-08 12:08:10 -06:00
|
|
|
|
if has('autocmd')
|
|
|
|
|
autocmd WinLeave * call CheckCloseDistractionFreeMode()
|
|
|
|
|
endif
|
|
|
|
|
|
2018-06-05 14:34:53 -05:00
|
|
|
|
nnoremap <silent> <Leader>df :DistractionFreeMode<CR>
|
2017-02-08 11:54:30 -06:00
|
|
|
|
|
|
|
|
|
:command! DistractionFreeMode call DistractionFreeModeFunc()
|
|
|
|
|
|
2017-12-21 12:18:17 -06:00
|
|
|
|
let bindingsfile=$vimdir.'/bindings.vim'
|
|
|
|
|
exec 'source ' . bindingsfile
|
2017-02-08 11:54:30 -06:00
|
|
|
|
|
|
|
|
|
" modify higlight colors
|
|
|
|
|
hi Search cterm=NONE ctermbg=blue ctermfg=black
|
2017-02-28 10:56:23 -06:00
|
|
|
|
highlight LineNr ctermbg=none ctermfg=8
|
|
|
|
|
highlight CursorLineNr ctermbg=18 ctermfg=gray
|
2018-06-05 14:34:53 -05:00
|
|
|
|
hi IndentGuidesEven ctermbg=18
|
2017-03-08 15:06:56 -06:00
|
|
|
|
|
|
|
|
|
fun! VueModifiedFT()
|
|
|
|
|
set ft=vue
|
|
|
|
|
endfunction
|
|
|
|
|
:command! VueModifiedFT call VueModifiedFT()
|
|
|
|
|
autocmd BufRead,BufNewFile *.vue VueModifiedFT
|