""" General settings set autoindent set backspace=indent,eol,start set complete-=i " Set the matches for insert mode completion set encoding=utf-8 " Set encoding set expandtab " Use spaces instead of tabs set formatoptions+=j " Delete comment character when joining commented lines set hlsearch " Highlight all search results set laststatus=2 " Always status line set ignorecase " Ignore cases when searching set incsearch " Incremental search set linebreak " Break lines at word (requires Wrap lines) set nowrap " Don't add an actual linebreak when wrapping set ruler " Show line & col number of cursor position set shiftwidth=4 " Number of auto-indent spaces set showmatch " Highlight matching brace set smartcase " Better searching btw cases set smartindent " Autoindent when starting a new line set smarttab " Tab insertion & deletion set tabstop=4 " One tab = 4 spaces set textwidth=80 " Line wrap (number of cols) set visualbell " Use visual bell (no beeping) set wildmenu " Helpful completion menu " Strings to use in 'list' mode and for the :list command set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+ """ Enable syntax "if has('syntax') && !exists('g:syntax_on') " syntax enable "endif """ Make , the leader key let mapleader = "," " easy escape imap fd " send to ix.io noremap i :w !ix " edit files and buffers, relative to local nmap ,e :edit nmap ;e :edit =expand("%:h") . "/" nmap ,o :buffer nmap ;o :buffer =expand("%:h") . "/" " list buffers nmap ,l :ls " kill buffer nmap ,k :bdelete " insert current date nmap ,d :r !date +\%Y.\%m.\%d nmap ,D :r !date +\%Y.\%m.\%d..\%H.\%M.\%S " grep (ripgrep) nmap ,g :Rg " format haskell code nmap ,f :!ormolu -m inplace % " clear out trailing whitespace and lines ending in whitespace nmap ,w :%s/[\t ]\+$//e " Use to clear the highlighting of :set hlsearch. if maparg('', 'n') ==# '' nnoremap :nohlsearch=has('diff')?'diffupdate':'' endif " trailing spaces are always bad syntax match Warning display "\s\+$" " mixed tabs and spaces syntax match Warning display " \+\t" syntax match Warning display "\t\+ " """ Easily find cursor with crosshair (,c) ":hi CursorLine cterm=NONE term=reverse ctermbg=7 guibg=Grey90 ":hi CursorColumn cterm=NONE term=reverse ctermbg=7 guibg=Grey90 :nnoremap c :set cursorline! cursorcolumn! """ File browser let g:netrw_banner=0 " Disable file browser banner let g:netrw_liststyle=3 " Tree view """ CTAGS shortcuts " open definition in a new tab: map :tab split:exec("tag ".expand("")) " open definition in a vertical split: map :vsp :exec("tag ".expand("")) """ Colors! set termguicolors let &t_8f = "\[38;2;%lu;%lu;%lum" let &t_8b = "\[48;2;%lu;%lu;%lum" """ Show highlighting groups for current word nmap :call SynStack() function! SynStack() if !exists("*synstack") return endif echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")') endfunc colorscheme basic-dark " A function for setting colors, if I want it... function! s:hi(...) let group = a:1 let fg = get(a:, 2, s:default_fg) let bg = get(a:, 3, s:default_bg) let attr = get(a:, 4, s:default_str) let cmd = ['hi', group] if fg != s:default_lst call add(cmd, 'guifg='.fg[0]) call add(cmd, 'ctermfg='.fg[1]) endif if bg != s:default_lst && bg != s:default_bg call add(cmd, 'guibg='.bg[0]) call add(cmd, 'ctermbg='.bg[1]) endif if attr != s:default_str call add(cmd, 'gui='.attr) call add(cmd, 'cterm='.attr) endif exec join(cmd, ' ') endfunction