.vim/autoload/vimrc.vim

Mon, 04 Dec 2017 14:43:44 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Mon, 04 Dec 2017 14:43:44 -0500
changeset 658
69ed96c80ed0
parent 641
60b56bbfc143
child 725
6ff8e3f73482
permissions
-rw-r--r--

use the perl compiler plugin, maybe i was confused

func! vimrc#CommandAlias(abbrev, expand) abort
  execute printf('cnoreabbrev <expr> %s (getcmdtype()==":" && getcmdline()=="%s") ? "%s" : "%s"', a:abbrev, a:abbrev, a:expand, a:abbrev)
endfunc

func! vimrc#AutoFmtToggle() abort
  if &formatoptions =~# 'a'
    setl formatoptions-=a | echo '-a'
  else
    setl formatoptions+=a | echo '+a'
  endif
endfunc

func! vimrc#Ltag(term) abort
  exe "ltag " . a:term
  lopen
endfunc

" Make paths when writing, as necessary
func! vimrc#MkNonExDir(file, buf) abort
  if empty(getbufvar(a:buf, '&buftype')) && a:file!~#'\v^\w+\:\/'
    let dir=fnamemodify(a:file, ':h')
    if !isdirectory(dir)
      call mkdir(dir, 'p')
    endif
  endif
endfunc

func! vimrc#AutoSessionConfig() abort
  if strlen(v:servername) > 0 && match(v:servername, 'VIM') == -1
    exec 'UniteSessionLoad ' . tolower(v:servername)
  endif
endfunc

func! vimrc#VundleInstallAndBegin() abort
  let bundlepath = g:myvim . '/bundle'

  if !filereadable(bundlepath . '/vundle/README.md')
    if !executable('git')
      echo "Can't autoinstall Vundle without git"
      return
    endif

    if !isdirectory(bundlepath)
      call mkdir(bundlepath, 'p')
    endif
    exec 'cd ' . bundlepath
    silent !git clone --depth 1 https://github.com/gmarik/vundle
    cd -

    echo "Installed Vundle, run :PluginInstall if desired"
  endif

  let &runtimepath .= ',' . bundlepath . '/vundle'
  call vundle#begin(bundlepath)
endfunc

mercurial