dotfiles

<-- duh.
git clone https://hhvn.uk/dotfiles
git clone git://hhvn.uk/dotfiles
Log | Files | Refs | Submodules | LICENSE

filetype.vim (2026B)


      1 function Shconfig()
      2 	nnoremap <buffer> <localleader>x :w<CR>:!chmod +x %<CR>
      3 endfunction
      4 
      5 function Gphconfig()
      6 	nnoremap <buffer> <localleader>c :call GphCitation()<CR>
      7 	nnoremap <buffer> <localleader>t :%s/\t/        /g<CR>
      8 	nnoremap <buffer> <localleader>l :call GphZettel("")<left><left>
      9 	inoremap <buffer> <localleader><localleader>l <esc>:call GphZettel("")<left><left>
     10 	call EnableLineWrap()
     11 endfunction
     12 
     13 function GphZettel(srch)
     14 	redir! >/tmp/vim.zettel | silent! echo 'When positioned over a line, use <localleader>z to select and name it' | silent! echo 'Use <localleader>Z to finish' | silent! silent! execute ':!alcl find "' . a:srch . '"' | redir END
     15 	vsplit /tmp/vim.zettel
     16 endfunction
     17 
     18 function GphZettelFin()
     19 	mark `
     20 	read !sed -n 's/[[:space:]]*\[/\t[/;s/][[:space:]]*/]\t/;/^\!/p' < /tmp/vim.zettel | awk -F'\t' '{print $2}'
     21 	normal G
     22 	read !sed -n 's/[[:space:]]*\[/\t[/;s/][[:space:]]*/]\t/;/^\!/p' < /tmp/vim.zettel | awk -F'\t' '{print "[<++>|"$2"|"$3"|server|port]"}'
     23 	normal ``kJ$
     24 endfunction
     25 
     26 function GphCitation()
     27 	redir! >/tmp/vim-cite | silent! %s/\[[0-9]*\]//gn | redir END
     28 	let count=system("tail -n 1 < /tmp/vim-cite | awk '{print $1}'")
     29 	let void=system("printf '' > /tmp/vim-cite")
     30 	let done=1
     31 	normal G
     32 	while done <= count
     33 		redir! >> /tmp/vim-cite | silent! echo "[<++>|[". done ."]|<++>|<++>|<++>]" | redir END
     34 		let done+=1
     35 	endwhile
     36 	read /tmp/vim-cite
     37 endfunction
     38 
     39 function Txtconfig()
     40 	call EnableLineWrap()
     41 	setlocal syntax=markdown
     42 endfunction
     43 
     44 function EnableLineWrap()
     45 	setlocal colorcolumn=80
     46 	setlocal tw=80
     47 	setlocal fo+=t
     48 endfunction
     49 
     50 augroup filetypes
     51 	autocmd FileType,WinEnter,BufEnter netrw call Configurenetrw()
     52 	autocmd FileType html :setlocal nowrap
     53 	autocmd FileType c :noremap <buffer> <localleader>e $a;<esc>
     54 	autocmd FileType c :inoremap <buffer> <localleader><localleader>e <esc>$a;<esc>
     55 	autocmd FileType sh :call Shconfig()
     56 	autocmd FileType gph :call Gphconfig()
     57 	autocmd FileType text :call Txtconfig()
     58 	autocmd FileType mail :call EnableLineWrap()
     59 augroup END