My vim configuration
git clone https://mcol.xyz/code/vim-misc
Log | Files | Refs | README

vimrc (6647B)


      1 "------------------------------------------------------------------"
      2 "                          _                                       "
      3 "                         (_)                                      "
      4 "                   __   ___ _ __ ___  _ __ ___                    "
      5 "                   \ \ / / | '_ ` _ \| '__/ __|                   "
      6 "                    \ V /| | | | | | | | | (__                    "
      7 "                     \_/ |_|_| |_| |_|_|  \___|                   "
      8 "                                                                  "
      9 "------------------------------------------------------------------"
     10 
     11 
     12 "------------------------------------------------------------------"
     13 " Plugins                                                          "
     14 "------------------------------------------------------------------"
     15 
     16 set nocompatible			    " be iMproved, required
     17 filetype off				    " required
     18 set rtp+=~/.vim/bundle/Vundle.vim	    " required
     19 call vundle#begin()
     20 
     21 Plugin 'VundleVim/Vundle.vim'		    " required
     22 
     23 if stridx(hostname(), "book") != -1
     24     "Plugin 'vimwiki/vimwiki'		    " vimwiki
     25     "Plugin 'gu-fan/riv.vim'
     26     Plugin 'https://mcol.xyz/code/vimlab'   " vimlab
     27     Plugin 'lervag/vimtex'		    " vimtex
     28     Plugin 'dense-analysis/ale'             " ALE
     29     Plugin 'neovimhaskell/haskell-vim'      " better haskell syntax highlighting
     30 endif
     31 
     32 Plugin 'https://gitlab.com/gi1242/vim-emoji-ab.git' " emoji input support
     33 Plugin 'vmchale/dhall-vim'              " dhall highlighting
     34 Plugin 'tpope/vim-fugitive'             " git plugin
     35 Plugin 'https://mcol.xyz/code/vim-misc'	    " my vimrc and misc functions 
     36 Plugin 'https://mcol.xyz/code/tide'	    " tmux ide 
     37 "Plugin 'airblade/vim-gitgutter'		    " gitgutter
     38 Plugin 'Yggdroot/indentLine'                "Show indentation lines
     39 Plugin 'masukomi/vim-markdown-folding'      "markdown folding
     40 
     41 
     42 call vundle#end()			    " required
     43 filetype plugin indent on		    " required
     44 " Brief help
     45 " :PluginList       - lists configured plugins
     46 " :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
     47 " :PluginSearch foo - searches for foo; append `!` to refresh local cache
     48 " :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
     49 " see :h vundle for more details or wiki for FAQ
     50 
     51 
     52 "------------------------------------------------------------------"
     53 " General settings                                                 "
     54 "------------------------------------------------------------------"
     55 
     56 set autoread			" update when file is modified outside of vim
     57 set autowrite			" update file when changing buffers, opening new files, etc
     58 au BufLeave * :silent! update	" save automatically when leaving buffer
     59 set lazyredraw			" dont update screen during macros/scripts
     60 set hlsearch			" Highlight all search results - toggled by <Leader>h
     61 set smartcase			" searches ignore case only if all lower case
     62 set incsearch			" Searches for strings while typing search term
     63 set gdefault			" use global by default for substitutions
     64 
     65 set shiftwidth=4		" Default number of auto-indent spaces
     66 set autoindent			" Auto-indent new lines
     67 set smartindent			" Enable smart-indent
     68 set smarttab			" shiftwidth tab at start of line, otherwise softtabstop width tab
     69 set softtabstop=4		" Number of spaces per tab
     70 set linebreak			" Allow backspacing over indention, line breaks and insertion start
     71 set backspace=indent,eol,start	" Backspace behaviour
     72 set formatoptions+=j	        " Delete comment characters when joining lines.
     73 "autocmd FileType * setlocal formatoptions-=cro    " disable autocommenting
     74 set matchtime=2
     75 set conceallevel=0              " disable all concealing
     76 set nojoinspaces                " don't put 2 spaces after periods when joining lines
     77 
     78 set undolevels=200		" Number of undo levels
     79 set undodir=~/.vim/undo//	" undo files
     80 set backupdir=~/.vim/backups//	" backups
     81 set directory=~/.vim/swap//	" swap files
     82 set noswapfile
     83 
     84 set splitbelow			" default new sp window goes below
     85 set splitright			" default new vsp window goes right
     86 set scrolloff=4			" keep x lines at top and bottom visible when scrollingkeep x lines at top and bottom visible when scrolling
     87 autocmd VimResized * wincmd =	" keep splits equal size when resizing window
     88 
     89 syntax on			" enable syntax highlighting
     90 set mouse=a			" enable mouse
     91 set t_Co=16			" use the 16 terminal colours
     92 
     93 set sessionoptions=buffers,folds,tabpages
     94 set viewoptions=folds,cursor
     95 
     96 set wildmenu			" enable wildmenu for tab completion of commands
     97 set wildignorecase		" disable wildmenu case sensitivity
     98 set wildmode=full:list		" format wildmenu to expand and scroll with tab
     99 
    100 set autochdir			" cwd to current file
    101 
    102 let g:netrw_liststyle=3		" Set netrw style to tree
    103 
    104 " Misc ------------------------------------------------------------"
    105 
    106 " restore last line in opened file
    107 au BufReadPost *
    108 	    \ if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit'
    109 	    \ |   exe "normal! g`\""
    110 	    \ | endif
    111 
    112 " machine specific settings
    113 if stridx(hostname(), "book") != -1
    114 
    115     packadd! matchit		" needed for matlab indentation functionality
    116     let g:vimlab_session = "~/.vim/sessions/matlab-session.vim"
    117 
    118     let g:vimtex_view_general_viewer = 'qpdfview'
    119     let g:vimtex_view_general_options = '--unique @pdf\#src:@tex:@line:@col'
    120     let g:vimtex_view_qpdfview_hook_callback = 'ViewerCallback'
    121     let g:vimtex_compiler_latexmk = {'build_dir' : '.latex_build'}
    122     let g:vimtex_syntax_conceal_disable = 1
    123     function! ViewerCallback() dict
    124         VimtexView
    125     endfunction
    126 
    127     "let g:riv_projects = [{ 'path': '~/git/phd', }]
    128     "let g:riv_disable_folding = 1
    129     "set mmp=2000
    130 endif
    131 
    132 " Intelligently navigate tmux panes and Vim splits using the same keys.
    133 " See https://sunaku.github.io/tmux-select-pane.html for documentation.
    134 let progname = substitute($VIM, '.*[/\\]', '', '')
    135 if empty(v:servername)
    136     set title titlestring=%{progname}\ [%n]\ %F
    137 else
    138     set title titlestring=%{progname}\ [%{v:servername}]\ [%n]\ %F
    139 endif
    140 if &term =~ '^screen' && !has('nvim') | exe "set t_ts=\e]2; t_fs=\7" | endif
    141 
    142 
    143 if exists("$WAYLAND_DISPLAY")
    144     set ttym=sgr
    145 endif
    146 
    147 let g:indentLine_defaultGroup = 'LineNr'
    148 let g:indentLine_char_list = ['|', '¦', '┆', '┊']
    149 let g:vim_json_concel = 0
    150 let g:markdown_syntax_conceal = 0
    151 
    152 runtime macros/emoji-ab.vim
    153 
    154 let g:ale_linters = {
    155 \   'haskell': ['hlint'],
    156 \   'python': ['flake8', 'mypy'],
    157 \}
    158 let g:ale_linters_explicit = 1
    159 let g:ale_lint_on_text_changed = 'never'
    160 let g:ale_lint_on_insert_leave = 0
    161 "let g:ale_command_wrapper = 'nice -n5'
    162 let g:ale_fixers = {
    163 \   'haskell': ['ormolu'],
    164 \   'python': ['black', 'isort'],
    165 \}
    166 "\   'markdown': ['prettier'],