dotfiles

configuration files
git clone https://pi.duncano.de/git/dotfiles.git

vimrc (4040B)


      1 set nocompatible
      2 filetype off
      3 
      4 sil! if plug#begin('~/.vim/plugged')
      5 
      6 if v:version >= 800 && (has('python') || has('python3'))
      7 	Plug 'maralla/completor.vim'
      8 endif
      9 
     10 Plug 'ctrlpvim/ctrlp.vim', { 'on': '<plug>(ctrlp)' }
     11 Plug 'tpope/vim-surround'
     12 Plug 'tpope/vim-commentary'
     13 
     14 call plug#end()
     15 endif
     16 
     17 " ============================================================================
     18 " Basic settings
     19 " ============================================================================
     20 
     21 set autoread                " automatically read changed files
     22 
     23 " syntax
     24 syntax off                  " no syntax highlighting by default
     25 sil! colorscheme shblah     " default colorscheme
     26 let g:is_kornshell = 1      " ksh syntax by default
     27 
     28 " interface
     29 set cursorline              " highlight current line
     30 sil! set colorcolumn=80     " show line after 80 chars
     31 set list                    " show tabs, whitespaces etc
     32 set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+
     33 set vb t_vb=                " disable beep
     34 set timeoutlen=500          " time to wait for key code, mapped key sequence
     35 
     36 " search
     37 set incsearch               " match search while typing
     38 set hlsearch                " hightligt search results
     39 set smartcase               " search casesensitive if pattern contains uppercase chars
     40 set ignorecase              " overwritten by smartcase if it contains uppercase chars
     41 
     42 " compelete
     43 set complete-=i
     44 set completeopt=longest,menuone
     45 
     46 " ignore
     47 set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.db
     48 
     49 " directories
     50 set undodir=~/.vim/undo//
     51 set backupdir=~/.vim/backup//
     52 set directory=~/.vim/swp//
     53 
     54 " histroy/undo
     55 set history=1000            " store a ton of history (default is 20)
     56 set undofile                " So is persistent undo ...
     57 set undolevels=1000         " Maximum number of changes that can be undone
     58 
     59 " Formating
     60 set backspace=indent,eol,start
     61 filetype plugin indent on
     62 set autoindent
     63 set smartindent
     64 set smarttab
     65 set foldlevelstart=99
     66 
     67 " ============================================================================
     68 " MAPPINGS
     69 " ============================================================================
     70 
     71 let mapleader      = ','
     72 let maplocalleader = ','
     73 
     74 " w!! to write with doas/sudo
     75 if executable('doas')
     76 	cmap w!! w !doas tee % >/dev/null
     77 else
     78 	cmap w!! w !sudo tee % >/dev/null
     79 endif
     80 
     81 command! W w    " too often i type W instead of w
     82 nnoremap Y y$   " Make Y behave like other capitals
     83 nnoremap Q @q   " qq to record, Q to replay
     84 
     85 " Reselect visual block after indent/outdent
     86 vnoremap < <gv
     87 vnoremap > >gv
     88 vnoremap = =gv
     89 
     90 " ,s - reload vim rc
     91 nmap <leader>s :source $MYVIMRC<cr>
     92 
     93 " ,c - toggle comment
     94 nmap <leader>c <plug>Commentary
     95 vmap <leader>c <plug>Commentary
     96 
     97 " ctrlp plugin on-demand loading
     98 map <c-p> <plug>(ctrlp)
     99 let g:ctrlp_map = ''
    100 
    101 " ----------------------------------------------------------------------------
    102 " co? : Toggle options (inspired by unimpaired.vim) from: https://github.com/junegunn/dotfiles
    103 " ----------------------------------------------------------------------------
    104 fu! s:map_change_option(...)
    105 	let [key, opt] = a:000[0:1]
    106 	let op = get(a:, 3, 'set '.opt.'!')
    107 	execute printf("nnoremap <silent> co%s :%s<bar>echo '%s: '. &%s<cr>", key, op, opt, opt)
    108 endf
    109 
    110 call s:map_change_option('c', 'spell', 'setlocal spell!')
    111 call s:map_change_option('n', 'number', 'setlocal number!')
    112 call s:map_change_option('h', 'hlsearch', 'setlocal hlsearch!')
    113 call s:map_change_option('l', 'list', 'setlocal list!')
    114 call s:map_change_option('p', 'paste')
    115 call s:map_change_option('s', 'syntax',
    116 	\ 'if exists("g:syntax_on")<bar>syntax off<bar>else<bar>syntax enable<bar>endif<bar>redraw')
    117 call s:map_change_option('t', 'textwidth',
    118 	\ 'let &l:textwidth = input("textwidth (". &l:textwidth ."): ")<bar>redraw')
    119 call s:map_change_option('w', 'wrap', 'setlocal wrap!')
    120 
    121 " ============================================================================
    122 " FILETYPES
    123 " ============================================================================
    124 
    125 " void-packages template file
    126 autocmd BufNewFile,BufRead template set ft=sh sts=0 sw=0 noet