You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

294 lines
7.4 KiB

9 years ago
set fileencoding=utf-8
5 years ago
" I have no idea how to auto-install vim-plug on Windows
" so you will have to install it manually.
if !(has('win16') || has('win32') || has('win64'))
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 | source %
endif
endif
call plug#begin('~/.config/nvim/plugged')
9 years ago
5 years ago
" Material theme
" Plug 'hzchirs/vim-material'
" Nord Theme
Plug 'arcticicestudio/nord-vim'
9 years ago
" Syntastic
Plug 'scrooloose/syntastic'
" Git
Plug 'tpope/vim-fugitive'
" Easy Commenting
Plug 'scrooloose/nerdcommenter'
9 years ago
" Surround - Easy changing of quotes and stuff
Plug 'tpope/vim-surround'
" Ctrlp full path fuzzy file finder
Plug 'kien/ctrlp.vim'
" Ack from vim
Plug 'mileszs/ack.vim'
" Improved vim status bar
Plug 'bling/vim-airline'
Plug 'vim-airline/vim-airline-themes'
let g:airline_theme='nord'
9 years ago
" Indent guides
Plug 'Yggdroot/indentLine'
" Autocomplete certain pairs (", ], etc)
Plug 'jiangmiao/auto-pairs'
9 years ago
" Language specific syntax highlighting
Plug 'derekwyatt/vim-scala'
7 years ago
Plug 'leafgarland/typescript-vim'
9 years ago
Plug 'kchmck/vim-coffee-script'
Plug 'rust-lang/rust.vim'
Plug 'groenewege/vim-less'
Plug 'cakebaker/scss-syntax.vim'
Plug 'pangloss/vim-javascript'
Plug 'mxw/vim-jsx'
Plug 'digitaltoad/vim-jade'
Plug 'wavded/vim-stylus'
Plug 'raichoo/haskell-vim'
Plug 'OCamlPro/ocp-indent'
Plug 'slim-template/vim-slim'
Plug 'isRuslan/vim-es6'
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
5 years ago
" Flake8 Integration
Plug 'nvie/vim-flake8'
" Clang Formatting
Plug 'rhysd/vim-clang-format'
5 years ago
" SBT integration for vim
Plug 'ktvoelker/sbt-vim'
" Org Mode
Plug 'jceb/vim-orgmode'
9 years ago
" Lisp
Plug 'kovisoft/slimv'
5 years ago
"Code Completion
" Post-update hook for YCM
" Make sure to sudo pip install neovim before running this
function! BuildYCM(info)
if a:info.status == 'installed' || a:info.force
!./install.sh
endif
endfunction
Plug 'Valloric/YouCompleteMe', { 'do': function('BuildYCM') }
Plug 'scrooloose/nerdtree'
" For nerdtree indicators of what has changed
Plug 'Xuyuanp/nerdtree-git-plugin'
" For some modern file icons
Plug 'ryanoasis/vim-devicons'
" Make Vim play nice with tmux
" Use <c-h> <c-j> <c-k> <c-l>
" to move between window panes in tmux or vim
Plug 'christoomey/vim-tmux-navigator'
9 years ago
" Markdown
Plug 'godlygeek/tabular'
Plug 'plasticboy/vim-markdown'
" Database engine support
Plug 'https://github.com/vim-scripts/dbext.vim'
9 years ago
" end plugin list
call plug#end()
" Configure vim for true color display otherwise vim-material won't display
" correctly.
if (has('nvim'))
let $NVIM_TUI_ENABLE_TRUE_COLOR = 1
endif
if (has('termguicolors'))
set termguicolors
endif
9 years ago
" Standard variables
set expandtab " tabs to spaces
set tabstop=2 " spaces entered when tab key is pressed
set shiftwidth=2 " spaces entered for indentation
set number " Line numbering
set clipboard=unnamedplus " Share system clipboard
set eol " End of line at bottom of file
set shiftround
set list
set list listchars=tab:»·,trail
" custom functions
9 years ago
function! NumberToggle()
if(&relativenumber == 1)
set norelativenumber
set number
else
set relativenumber
endif
endfunc
" Always show hidden files in nerdtree
let NERDTreeShowHidden=1
9 years ago
" Autocmds
" Auto Clang Formatting
autocmd FileType c ClangFormatAutoEnable
autocmd FileType cpp ClangFormatAutoEnable
autocmd FileType cxx ClangFormatAutoEnable
autocmd FileType h ClangFormatAutoEnable
autocmd FileType hpp ClangFormatAutoEnable
autocmd FileType hxx ClangFormatAutoEnable
""" Stripping trailing whitespace on save
9 years ago
autocmd BufWritePre * :%s/\s\+$//e
" Fix rust
autocmd FileType rust setlocal shiftwidth=2 tabstop=2
autocmd BufRead,BufNewFile *.rs set filetype=rust
" Set column width to 80 only on python files
autocmd BufNewFile,BufRead *.py setlocal colorcolumn=80
5 years ago
" Set Python syntax checking to Python3
let python_highlight_all=1
" Make tabs display as 4 spaces for Python files (makes them easier to read)
autocmd BufNewFile,BufRead *.py setlocal noexpandtab tabstop=4 shiftwidth=4
" Indent YAML files correctly
au FileType yaml setlocal tabstop=2 expandtab shiftwidth=2 softtabstop=2
9 years ago
" Disable the rust style guide recommended 4 space indentation
let g:rust_recommended_style=0
" Explicitly provide vim-go the goimports command
let g:go_fmt_command = "goimports"
8 years ago
" Enable more highlighting in vim-go
let g:go_highlight_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_operators = 1
let g:go_highlight_extra_types = 1
" Make tabs display as 4 spaces for Go files (makes them easier to read)
autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4
9 years ago
" Hotkeys
" Note noremap is a normal mode non-recursive mapping
" nnoremap and nmap make the bind only work in normal mode
let mapleader=" "
map <silent> <Leader>t :NERDTreeToggle<CR>
nnoremap <silent> <Leader>r :call NumberToggle()<CR>
" This one maps F5 to delete all trailing whitespace
nnoremap <silent> <F5> :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar>:nohl<CR>
" Pressing enter in command mode clears the current search highlighting until
" the next search.
nnoremap <silent> <CR> :noh<CR><CR>
9 years ago
" Move tabs left and right
nnoremap <silent> _ :tabp<CR>
nnoremap <silent> + :tabn<CR>
9 years ago
" ctrlp hotkeys
let g:ctrlp_map='<c-p>'
let g:ctrlp_cmd='CtrlP'
" Rebind Ctrl-P to match the window opening keys of nerd tree
let g:ctrl_p_prompt_mappings = {
\ 'AcceptSelection("h")': ['<c-i>', '<c-cr>', '<c-s>'],
\ 'AcceptSelection("v")': ['<c-s>', '<RightMouse>'],
\ }
9 years ago
" ctrlp configuration
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe " Windows
let g:ctrlp_working_path_mode='ra'
" Highlight any line with ErrorMsg that goes over 120 characters
if exists('+colorcolumn')
set colorcolumn=120
else
au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1)
endif
" Javascript linting on the fly
" npm install -g eslint to get it working
let g:syntastic_javascript_checkers = ['eslint']
let g:syntastic_javascript_jsxhint_exec = 'eslint'
9 years ago
" Python-mode settings
" disable pymode folding
let g:pymode_folding = 0
" set pydoc key
let g:pymode_doc_key = 'K'
" Disable auto python-mode autocomplete documentation window
set completeopt=menu
" Disable markdown automatic section folding
let g:vim_markdown_folding_disabled = 1
" Merlin for OCaml
" TODO: Detect OPAM and install/configure merlin. Until then this is commented out.
" let g:opamshare = substitute(system('opam config var share'),'\n$','','''')
" execute "set rtp+=" . g:opamshare . "/merlin/vim"
9 years ago
" Fugitive bindings
nnoremap <Leader>gs :Gstatus<CR>
nnoremap <Leader>gd :Gdiff<CR>
nnoremap <Leader>gb :Gblame<CR>
nnoremap <Leader>gc :Gcommit<CR>
" F9 is bound to fold and unfold in all modes
inoremap <F9> <C-O>za
nnoremap <F9> za
onoremap <F9> <C-C>za
vnoremap <F9> zf
9 years ago
" Line indent guides are defaulted to off
let g:indentLine_enabled=0
" Leader + i will toggle line indent guides
map <silent> <Leader>i :IndentLinesToggle<CR>
" Color scheme setting is done absolutely last to make sure everything is
" available to vim
set background=dark
colorscheme nord
let g:ycm_language_server =
\ [
\ {
\ 'name': 'ocaml',
\ 'cmdline': ['ocamllsp'],
\ 'filetypes': ['ocaml']
\ }
\]