My dotfiles for local environments. See for how I setup my servers!
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.

176 lines
5.4 KiB

set nocompatible
filetype plugin on
" Vundle
"set rtp+=~/.vim/bundle/Vundle.vim
"call vundle#begin()
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
" PlugVim
call plug#begin("~/.vim/plugged")
" Default Indentation related
set tabstop=4 " How many spaces for a tab
set expandtab " Expand tab to spaces
set shiftwidth=4
set softtabstop=4
set autoindent
set smartindent
" View related
"set cursorline " Highlight cursor line
set showmatch " Match brackets
set number " Line Numbers
set relativenumber " Shows the distance around cursor line
set cpoptions+=n "Allow number gutter to be used for long lines
syntax enable
" Search related
set incsearch " Incremental search
set hlsearch " Highlight search
" Remap <C-L> (redraw screen) to turn off highlight until next search
nnoremap <C-L> :nohl<CR><C-L>
set ignorecase
set smartcase " Ignore ignorecase when uppercase characters are present
" Navigation related
set scrolloff=3 " Minimum number of lines to show below/above the cursor
" Shortcuts
set pastetoggle=<F2>
map <F7> :w !xclip<CR><CR>
vmap <F7> "*y
map <S-F7> :r!xclip -o<CR>
" Persistent undo
if isdirectory($HOME . '/.vim/undo') == 0
:silent !mkdir -p ~/.vim/undo > /dev/null 2>&1
set undodir-=.
set undodir+=~/.vim/undo//
set undofile
set undolevels=1000
set undoreload=1000
" Set Backup
if isdirectory($HOME . '/.vim/backup') == 0
:silent !mkdir -p ~/.vim/backup >/dev/null 2>&1
set backupdir-=.
set backupdir+=.
set backupdir-=~/
set backupdir^=~/.vim/backup//
set backup
" Set Swapfile
if isdirectory($HOME . '/.vim/swap') == 0
:silent !mkdir -p ~/.vim/swap >/dev/null 2>&1
set directory-=.
set directory^=~/.vim/swap//
set directory+=.
" viminfo stores the the state of your previous editing session
set viminfo+=n~/.vim/viminfo
" Plugins
"Plug 'nvie/vim-flake8' " Python PEP8
Plug 'davidhalter/jedi-vim'
Plug 'scrooloose/nerdtree' " File browser
Plug 'jistr/vim-nerdtree-tabs' " Utalise tabs
"Plug 'Valloric/YouCompleteMe', { 'do': './' } " YouCompleteMe
Plug 'zxqfl/tabnine-vim'
Plug 'PProvost/vim-ps1' " Windows PowerShell
Plug 'airblade/vim-gitgutter'
Plug 'scrooloose/syntastic' " Syntastic
if empty(glob("~/.zsh/work-aliases.zsh"))
" Load Powerline on non-work due to tmux/vim/WSL powerline wrapping issue
Plug 'vim-airline/vim-airline' " Powerline Alternative
Plug 'vim-airline/vim-airline-themes'
Plug 'tpope/vim-fugitive' " Git Branches Extension for airline
Plug 'tpope/vim-surround' " Surround your visually selected word with ''
Plug 'jiangmiao/auto-pairs' " multiple () and ''
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'majutsushi/tagbar'
Plug 'junegunn/gv.vim' "Git commit browser
Plug 'pearofducks/ansible-vim' " Ansible YAML
Plug 'Glench/Vim-Jinja2-Syntax' " Jinja2 Syntax
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' } " go der
Plug 'PProvost/vim-markdown-jekyll' " Jekyll Markdown Syntax
Plug 'inkarkat/vim-SpellCheck' "Spellchecking
Plug 'inkarkat/vim-ingo-library' "Spellcheck Deps
call plug#end() "plugVim
" Load NERDTree
" AutoOpen NERDTree if you open vim without a file
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" AutoClose Vim if NERDTree is the only window open
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" Plugin Config Options
let g:NERDTreeDirArrows=0
let g:NERDTreeMinimalUI=0
" Extra Configuration / Autocommands
filetype plugin indent on
" The following line sets the smartindent mode for *.py files. It means that
" after typing lines which start with any of the keywords in the list (ie.
" def, class, if, etc) the next line will automatically indent itself to the
" next level of indentation:
autocmd BufRead,BufNewFile *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
" Remove any extra whitespace from the ends of lines when saving a file
autocmd BufWritePre *.py normal m`:%s/\s\+$//e``
autocmd BufWritePre *.md normal m`:%s/\s\+$//e``
autocmd BufWritePre *.yml normal m`:%s/\s\+$//e``
" Only have indent of 2 for yml
autocmd BufRead,BufNewFile *.yml set shiftwidth=2
autocmd BufRead,BufNewFile *.yml set softtabstop=2
autocmd BufNewFile *.md 0r ~/.vim/templates/
" Call spellcheck on write for markdown
autocmd BufWritePre *.md :SpellCheck
autocmd FileType markdown setlocal complete+=kspell
autocmd FileType markdown setlocal spell
" awe
autocmd FileType gitcommit setlocal complete+=kspell
autocmd FileType gitcommit setlocal spell
"set spell spelllang=en_au
" Theming
"colorscheme atom-dark-256
colorscheme moody
set t_Co=256
" Flake8 Customisation
" Show warnings and errors in gutter
let g:flake8_show_in_gutter=1
" Flake8 parse file on write
" Synatsitic stuff
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_ebuild_checkers = ['pkgcheck']
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 0
let g:syntastic_check_on_wq = 0
" AirLine
set laststatus=2
let g:airline_extensions = ['branch', 'quickfix', 'syntastic', 'hunks']
let g:airline_powerline_fonts = 1
" Ansible
let g:ansible_attribute_highlight = 'ob'
let g:ansible_name_highlight = 'd'
" fuck you go
let g:go_version_warning = 0