dotfiles

My personal dotfiles 💠️

init.vim (4231B)

      1 "  _       _ _         _           
      2 " (_)     (_) |       (_)          
      3 "  _ _ __  _| |___   ___ _ __ ___  
      4 " | | '_ \| | __\ \ / / | '_ ` _ \ 
      5 " | | | | | | |_ \ V /| | | | | | |
      6 " |_|_| |_|_|\__(_)_/ |_|_| |_| |_|
      7 " 
      8 " Pablo (C) 2020
      9 "
     10 
     11 " Turn on syntax highlighting
     12 syntax on
     13 filetype indent plugin on
     14 
     15 " Configure keybindings
     16 let mapleader = " "
     17 "Maps <Leader><Leader> to 'next window'
     18 map <Leader><Leader> <C-W>w
     19 map <Leader><CR>     :NERDTreeToggle<CR>
     20 
     21 " Configure tabs so that tabs are expanded to 2 spaces
     22 set tabstop=2 softtabstop=0 expandtab shiftwidth=2 smarttab
     23 
     24 " Set the column-cap
     25 set colorcolumn=80
     26 set textwidth=79
     27 
     28 " Highlight the cursor line
     29 set cursorline
     30 
     31 " Set up the colorscheme
     32 colo snazzy
     33 let g:SnazzyTransparent = 1
     34 let g:lightline = {'colorscheme': 'snazzy',}
     35 
     36 " Turn on the transparent background
     37 hi Normal ctermbg=NONE guibg=NONE
     38 
     39 " Fix the highlighting of underlined text
     40 hi Underlined cterm=bold,underline gui=bold,underline ctermbg=none guibg=none
     41 
     42 " Highlight tyṕos in red
     43 hi clear SpellBad
     44 hi SpellBad cterm=underline gui=underline guifg=#ff5f5f
     45 
     46 " Set up line numbering
     47 hi LineNr cterm=bold gui=bold
     48 hi CursorLineNr cterm=bold gui=bold ctermfg=White guifg=White
     49 set relativenumber
     50 set number
     51 
     52 " Configure the directory tto store the undo files
     53 set dir=~/.vimswap//,/var/tmp//,/tmp//,.
     54 set undofile                          " Save undos after file closes
     55 set undodir=$XDG_CACHE_HOME/nvim/undo " Where to save undo histories
     56 set undolevels=1000                   " How many undos
     57 set undoreload=10000                  " Number of lines to save for undo
     58 
     59 " Enabling mouse support
     60 set mouse=a
     61 
     62 " Auto-update a file when it changes externally
     63 set autoread
     64 au CursorHold * checktime
     65 
     66 " Configure the status line
     67 set noshowmode
     68 
     69 " Disable the arrow keys
     70 noremap <Up>      <Nop>
     71 noremap <Down>    <Nop>
     72 noremap <Left>    <Nop>
     73 noremap <Right>   <Nop>
     74 noremap <S-Left>  <Nop>
     75 noremap <S-Right> <Nop>
     76 
     77 """ LaTeX-specific stuff
     78 
     79 " Begin a LaTeX block
     80 function! LaTeXBegin(blockname)
     81   execute "normal! o\\begin{" . a:blockname . "}\n\\end{" . a:blockname . "}"
     82   call feedkeys('O')
     83 endfunction
     84 
     85 " Enter insert mode inside the \emph macro
     86 function! LaTeXEmph()
     87   execute "normal! i \\emph{}"
     88   call feedkeys('i')
     89 endfunction
     90 
     91 " Alias the LaTeXBegin function as a command
     92 au BufNewFile,BufRead *.tikz,*.tex command! -nargs=1 Begin call LaTeXBegin(<f-args>)
     93 
     94 " Alias the LaTeXEmph function as a command
     95 au BufNewFile,BufRead *.tikz,*.tex command! -nargs=0 Emph call LaTeXEmph()
     96 
     97 " Map BB to a call to the Begin command
     98 au BufNewFile,BufRead *.tikz,*.tex nnoremap BB :Begin 
     99 
    100 " Map EE to a call to the Emph command
    101 au BufNewFile,BufRead *.tikz,*.tex nnoremap EE :Emph<CR>
    102 
    103 " Highlight TiKz files as LaTeX
    104 au BufNewFile,BufRead *.tikz,*.tex set ft=tex
    105 
    106 " Highlight \mathscr and \mathds as font styles
    107 au BufNewFile,BufRead *.tikz,*.tex syn match texTypeStyle "\\mathscr\>"
    108 au BufNewFile,BufRead *.tikz,*.tex syn match texTypeStyle "\\mathds\>"
    109 
    110 " Highlight \citetitle in the same way as \cite
    111 au BufNewFile,BufRead *.tikz,*.tex syn match texRefZone '\\citetitle\%([tp]\*\=\)\=' nextgroup=texRefOption,texCite
    112 
    113 " Highlight stuff inside a align blocks and TikZ environments as math
    114 au BufNewFile,BufRead *.tikz,*.tex call TexNewMathZone("E","align",1)
    115 au BufNewFile,BufRead *.tikz,*.tex call TexNewMathZone("E","tikzcd",1)
    116 au BufNewFile,BufRead *.tikz,*.tex call TexNewMathZone("E","tikzpicture",1)
    117 
    118 """ Language-specific stuff
    119 
    120 " Highlight .thtml files as HTML
    121 au BufNewFile,BufRead *.thtml             set ft=html
    122 
    123 " Highlight .tcss files as HTML
    124 au BufNewFile,BufRead *.tcss              set ft=css
    125 
    126 " Highlight .wat files as WebAssembly text format
    127 au BufNewFile,BufRead *.wat               set ft=wast
    128 
    129 " Correctly highlight fish scripts
    130 au BufNewFile,BufRead *.fish              set ft=fish
    131 
    132 " Read .pl files as Prolog (not Perl)
    133 au BufNewFile,BufRead *.pl                set ft=prolog
    134 
    135 " Read .m and .mathematica as Mathematica files
    136 au BufNewFile,BufRead *.m,*.mathematica   set ft=mma
    137 
    138 " Read .g and .gap files as GAP source files
    139 au BufRead,BufNewFile *.g,*.gi,*.gd,*.gap set ft=gap 
    140 
    141 " Supress word wrapping when reading Python source files
    142 au BufNewFile,BufRead *.py                set textwidth=0
    143