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
|
|
|
|
|
|
|
|
|
|
Plug 'nathanaelkane/vim-indent-guides' " indentation guides (NOTE: doesn't seem to work with my colorscheme)
|
|
|
|
|
let g:indent_guides_start_level = 0
|
|
|
|
|
let g:indent_guides_auto_color = 1
|
|
|
|
|
|
2017-11-13 15:55:11 -06:00
|
|
|
|
Plug 'roxma/nvim-completion-manager'
|
2017-02-08 11:54:30 -06:00
|
|
|
|
|
2017-06-05 22:15:32 -05:00
|
|
|
|
Plug 'SirVer/ultisnips'
|
|
|
|
|
Plug 'honza/vim-snippets'
|
|
|
|
|
let g:UltiSnipsExpandTrigger="<tab>"
|
|
|
|
|
let g:UltiSnipsJumpForwardTrigger="<c-f>"
|
|
|
|
|
let g:UltiSnipsJumpBackwardTrigger="<c-p>"
|
|
|
|
|
let g:UltiSnipsEditSplit="vertical"
|
|
|
|
|
|
2017-06-05 22:17:31 -05:00
|
|
|
|
" Plug 'vimwiki/vimwiki'
|
2017-06-05 22:15:32 -05:00
|
|
|
|
let wiki1 = {}
|
|
|
|
|
let wiki1.path = "~/../doc/wiki/"
|
|
|
|
|
let wiki1.syntax = "markdown"
|
|
|
|
|
let wiki1.ext = ".md"
|
|
|
|
|
let g:vimwiki_list = [wiki1]
|
|
|
|
|
|
2017-02-08 11:54:30 -06:00
|
|
|
|
Plug 'scrooloose/syntastic' " syntax checker
|
|
|
|
|
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
|
2017-02-08 11:54:30 -06:00
|
|
|
|
Plug 'tpope/vim-commentary' " toggle comments in code easily
|
2017-03-03 11:08:09 -06:00
|
|
|
|
Plug 'tpope/vim-repeat' " toggle comments in code easily
|
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
|
|
|
|
|
Plug 'godlygeek/tabular' " align text lines together
|
|
|
|
|
Plug 'dhruvasagar/vim-table-mode' " for creating and editing character tables
|
|
|
|
|
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-11-13 15:55:11 -06:00
|
|
|
|
Plug 'roxma/nvim-cm-tern', { 'do': 'npm install' } " javascript helpful things
|
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
|
|
|
|
|
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
|
2017-03-09 17:52:47 -06:00
|
|
|
|
Plug 'hail2u/vim-css3-syntax', {'for': ['styl', 'stylus', '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-04-25 20:01:39 -05:00
|
|
|
|
Plug 'slashmili/alchemist.vim', {'for': ['elixir', 'ex', 'exs']}
|
2017-02-20 18:31:28 -06:00
|
|
|
|
Plug 'mattn/emmet-vim', {'for': ['html']}
|
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
|
|
|
|
Plug 'vim-scripts/utl.vim'
|
|
|
|
|
let g:utl_cfg_hdl_scm_http_system = "silent !$BROWSER '%u#%f' &"
|
|
|
|
|
|
2017-02-08 11:54:30 -06:00
|
|
|
|
" Plug 'euclio/vim-markdown-composer', { 'do': function('BuildComposer'), 'for': ['md', 'markdown'] }
|
|
|
|
|
Plug 'digitaltoad/vim-jade', {'for': ['pug', 'jade', 'vue']}
|
|
|
|
|
Plug 'leafo/moonscript-vim', {'for': ['moon', 'moonscript']}
|
|
|
|
|
Plug 'evidens/vim-twig'
|
|
|
|
|
Plug 'leafgarland/typescript-vim', {'for': ['ts', 'typescript']}
|
|
|
|
|
Plug 'jwalton512/vim-blade', {'for': ['blade', 'blade.php']}
|
|
|
|
|
|
2017-04-25 07:59:41 -05:00
|
|
|
|
Plug 'carlitux/deoplete-ternjs', { 'do': 'sudo npm install -g tern' }
|
|
|
|
|
|
2017-02-08 11:54:30 -06:00
|
|
|
|
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
|
|
|
|
|
|
2017-02-08 11:54:30 -06:00
|
|
|
|
nnoremap <silent> <Leader>mz :DistractionFreeMode<CR>
|
|
|
|
|
|
|
|
|
|
: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
|
2017-03-08 15:06:56 -06:00
|
|
|
|
|
|
|
|
|
fun! VueModifiedFT()
|
|
|
|
|
set ft=vue
|
|
|
|
|
endfunction
|
|
|
|
|
:command! VueModifiedFT call VueModifiedFT()
|
|
|
|
|
autocmd BufRead,BufNewFile *.vue VueModifiedFT
|