Category Archives: configuration

My New .vimrc

Recently rebuilt my laptop with latest Debian Testing after HDD failure. While I was at it, I redid my .vimrc file to suit new activities better. Remember to have git installed along with vundle from github first, ignore errors, then once vim/gvim loaded run :PluginInstall.

set nocompatible " required
filetype off " required

" set the run time path and initialise vundle
set rtp+=~/.vim/bundle/Vundle.vim

call vundle#begin()

" let Vundle manage itself
Plugin 'VundleVim/Vundle.vim'

" Now do the extras
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-git'
Plugin 'tpope/vim-obsession'
Plugin 'tpope/vim-sleuth'

" Plugin 'vimoutliner'
Plugin 'scrooloose/syntastic'
Plugin 'scrooloose/nerdtree'

" statusbar
Plugin 'vim-airline/vim-airline'
Plugin 'ervandew/supertab'
Plugin 'majutsushi/tagbar'
Plugin 'lervag/vimtex'
Plugin 'airblade/vim-gitgutter'
Plugin 'tpope/vim-surround'
Plugin 'vim-pandoc/vim-pandoc'
Plugin 'vim-pandoc/vim-pandoc-syntax'

" Plugin 'LaTeX-Box-Team/LaTeX-Box'
" Colourscheme stuff
Plugin 'nightsense/night-and-day'
Plugin 'altercation/vim-colors-solarized'
Plugin 'tpope/vim-vividchalk'
Plugin 'gkjgh/cobalt'

" all plugins must be installed before this line

call vundle#end() " required

" now able to turn filetype back on
filetype plugin indent on " required
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
"------------------------------------------------------------
" Other settings
"------------------------------------------------------------
set encoding=utf-8 " handle all characters
set mouse=a " mouse every where
set ff=unix " set file format to unix
set spelllang=en_au " set spellcheck language to english
syntax enable " syntax highlighting with current colour scheme
set termguicolors

"------------------------------------------------------------
" tree view
"------------------------------------------------------------
let g:netrw_liststyle=3

"------------------------------------------------------------
" Console UI and Text Display
"------------------------------------------------------------
set vb t_vb =
set ruler
set noerrorbells
set scrolloff=5
set number " line numbering
set smartindent autoindent " smart indent and autoindenting
set showmatch " show matches

"------------------------------------------------------------
" TAB specific options
"------------------------------------------------------------
set tabstop=4
set expandtab
set softtabstop=4
set shiftwidth=4
set smarttab
set shiftround
set nojoinspaces

"------------------------------------------------------------
" colourscheme settings
"------------------------------------------------------------

let g:nd_themes = [
\ ['07:00', 'solarized', 'light' ],
\ ['18:00', 'cobalt', 'dark' ],
\ ]

"if &t_Co >= 256 || has("gui_running")
" set lines=35 columns=100
" set background=light
" colorscheme solarized
"colorscheme calmar256-dark
"else
" set t_Co=256
" " set background=dark
" colorscheme solorized
"endif

set wildmenu
set wildmode=list:longest

set fileformats=unix,dos,mac
filetype plugin indent on "

"------------------------------------------------------------
" gui font settings
" -----------------------------------------------------------
if has('gui_running')
set guifont=Lucida_Console:h11
endif

"------------------------------------------------------------
" Search settings
"------------------------------------------------------------
set incsearch
set ignorecase
set smartcase

"------------------------------------------------------------
" check for custom .vim.custom in a folder
"------------------------------------------------------------
if filereadable(".vim.custom")
so .vim.custom
endif

"------------------------------------------------------------
" vim-airline
" -----------------------------------------------------
" enable/disable fugitive/lawrencium integration
let g:airline#extensions#branch#enabled = 1
" change the text for when no branch is detected
let g:airline#extensions#branch#empty_message = ''
" enable/disable syntastic integration
let g:airline#extensions#branch#syntastic#enabled = 1
let g:airline#extensions#tabline#enabled = 1

"-----------------------------------------------------------
" syntastic extensions
"------------------------------------------------------------
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*

let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1 " always show error list
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
" to toggle between active/passive type checking
map e :Errors
map s :SyntasticToggleMode

nmap :TagbarToggle

"-----------------------------------------------------
" doxygen settings
"----------------------------------------------------
" nmap :Dox
" nmap :DocLic

"----------------------------------------------------
" statusline
"----------------------------------------------------
set statusline=%-5.3n\ %F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]%=\ [ASCII=\03.3b]\ [HEX=\02.2B]\ [POS=%04l,%04v][%p%%]\ [LEN=%L]
set laststatus=2
set cmdheight=1

"---------------------------------------------------
" hdevtools
" --------------------------------------------------
au FileType haskell nnoremap :HdevtoolsType
au FileType haskell nnoremap :HdevtoolsClear

"-------------------------------------------------------------
" Word processing mode
"
function! WordProcessorMode()
setlocal formatoptions=1
setlocal noexpandtab
map j gj
map k gk
setlocal spell spelllang=en_gb
set thesaurus+=/home/robin/.vimrc/thesaurus/mythesaur.txt
set complete+=s
set formatprg=par
setlocal wrap
setlocal linebreak
endfunction
com! WP call WordProcessorMode()

" ---------------------------------------------------------------------------
" latex stuff
"----------------------------------------------------------------------------

"
" Nerdtree settings
"
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif

autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif

map :NERDTreeToggle

autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif