changeset 216:d216f4d5508e

Setup latex compiler for dispatch
author zegervdv <zegervdv@me.com>
date Tue, 09 Dec 2014 19:51:07 +0100
parents ffe47a1b75f8
children 9332fdb1ff4d
files vim/autoload/plug.vim vimrc zsh/exports.zsh
diffstat 3 files changed, 37 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/vim/autoload/plug.vim	Fri Dec 05 23:06:30 2014 +0100
+++ b/vim/autoload/plug.vim	Tue Dec 09 19:51:07 2014 +0100
@@ -83,6 +83,7 @@
 \   'funcref': type(function('call'))
 \ }
 let s:loaded = get(s:, 'loaded', {})
+let s:triggers = get(s:, 'triggers', {})
 
 function! plug#begin(...)
   if a:0 > 0
@@ -99,6 +100,7 @@
   let g:plug_home = home
   let g:plugs = {}
   let g:plugs_order = []
+  let s:triggers = {}
 
   call s:define_commands()
   return 1
@@ -156,6 +158,7 @@
     endif
 
     if has_key(plug, 'on')
+      let s:triggers[name] = { 'map': [], 'cmd': [] }
       for cmd in s:to_a(plug.on)
         if cmd =~ '^<Plug>.\+'
           if empty(mapcheck(cmd)) && empty(mapcheck(cmd, 'i'))
@@ -166,10 +169,14 @@
               \ mode, cmd, map_prefix, string(cmd), string(name), key_prefix)
             endfor
           endif
-        elseif !exists(':'.cmd)
-          execute printf(
-          \ 'command! -nargs=* -range -bang %s call s:lod_cmd(%s, "<bang>", <line1>, <line2>, <q-args>, %s)',
-          \ cmd, string(cmd), string(name))
+          call add(s:triggers[name].map, cmd)
+        elseif cmd =~ '^[A-Z]'
+          if exists(':'.cmd) != 2
+            execute printf(
+            \ 'command! -nargs=* -range -bang %s call s:lod_cmd(%s, "<bang>", <line1>, <line2>, <q-args>, %s)',
+            \ cmd, string(cmd), string(name))
+          endif
+          call add(s:triggers[name].cmd, cmd)
         endif
       endfor
     endif
@@ -324,8 +331,23 @@
   return 1
 endfunction
 
+function! s:remove_triggers(name)
+  if !has_key(s:triggers, a:name)
+    return
+  endif
+  for cmd in s:triggers[a:name].cmd
+    execute 'delc' cmd
+  endfor
+  for map in s:triggers[a:name].map
+    execute 'unmap' map
+    execute 'iunmap' map
+  endfor
+  call remove(s:triggers, a:name)
+endfunction
+
 function! s:lod(names, types)
   for name in a:names
+    call s:remove_triggers(name)
     let s:loaded[name] = 1
   endfor
   call s:reorg_rtp()
@@ -346,14 +368,11 @@
 endfunction
 
 function! s:lod_cmd(cmd, bang, l1, l2, args, name)
-  execute 'delc' a:cmd
   call s:lod([a:name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
   execute printf('%s%s%s %s', (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args)
 endfunction
 
 function! s:lod_map(map, name, prefix)
-  execute 'unmap' a:map
-  execute 'iunmap' a:map
   call s:lod([a:name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
   let extra = ''
   while 1
@@ -676,7 +695,7 @@
     try
       call mkdir(g:plug_home, 'p')
     catch
-      return s:err(printf('Invalid plug directory: %s.'
+      return s:err(printf('Invalid plug directory: %s. '.
               \ 'Try to call plug#begin with a valid directory', g:plug_home))
     endtry
   endif
@@ -1247,7 +1266,7 @@
     call append(line('$'), 'Already clean.')
   else
     call inputsave()
-    let yes = a:force || (input('Proceed? (Y/N) ') =~? '^y')
+    let yes = a:force || (input('Proceed? (y/N) ') =~? '^y')
     call inputrestore()
     if yes
       for dir in todo
@@ -1464,7 +1483,7 @@
 function! s:revert()
   let name = s:find_name(line('.'))
   if empty(name) || !has_key(g:plugs, name) ||
-    \ input(printf('Revert the update of %s? (Y/N) ', name)) !~? '^y'
+    \ input(printf('Revert the update of %s? (y/N) ', name)) !~? '^y'
     return
   endif
 
--- a/vimrc	Fri Dec 05 23:06:30 2014 +0100
+++ b/vimrc	Tue Dec 09 19:51:07 2014 +0100
@@ -24,7 +24,6 @@
 Plug 'sjl/gundo.vim', { 'on': 'GundoToggle' }
 
 " Tmux
-Plug 'benmills/vimux', { 'on': 'VimuxRunCommand' }
 Plug 'christoomey/vim-tmux-navigator'
 Plug 'tpope/vim-dispatch'
 
@@ -201,6 +200,7 @@
 
 highlight SpellBad ctermbg=256 ctermfg=210
 highlight SpellLocal ctermbg=240 ctermfg=010
+highlight SpellCap ctermbg=256 ctermfg=211
 
 " When editing a file, always jump to the last known cursor position.
 " Don't do it for commit messages, when the position is invalid, or when
@@ -362,11 +362,10 @@
 let g:tlist_vhdl_settings   = 'vhdl;d:package declarations;b:package bodies;e:entities;a:architecture specifications;t:type declarations;p:processes;f:functions;r:procedures'
 " }}}
 " Latex {{{
-" Compile using rubber
-nnoremap <leader>m :w<CR>:VimProcBang rubber --pdf --warn all %<CR>
 " Open pdf
-nnoremap <silent> <leader>v :silent !open %:r.pdf<CR><CR>
-autocmd FileType tex set makeprg=rubber\ --pdf\ %
+nnoremap <leader>v :!open -a /Applications/TeX/TeXShop.app %:r.pdf<CR><CR>
+" Set compiler to rubber
+autocmd FileType tex setlocal makeprg=rubber\ --pdf\ %
 " }}}
 " Unite {{{
 call unite#filters#matcher_default#use(['matcher_fuzzy'])
@@ -533,15 +532,8 @@
 " Vim Sessions {{{
 let g:session_autosave = 'no'
 " }}}
-" Vimux {{{
-let g:VimuxUseNearest = 1
-nnoremap <buffer> <silent><leader>s :w<CR>
-autocmd FileType python nnoremap <buffer> <silent><leader>s :w<CR>:VimuxRunCommand('%run -i ' . expand('%'))<CR>
-autocmd FileType ruby nnoremap <buffer> <silent><leader>s :w<CR>:VimuxRunCommand('rake spec')<CR>
-autocmd FileType  c nnoremap <buffer> <silent><leader>s :w<CR>:VimuxRunCommand('make')<CR>
-" }}}
-" Vim-tmux-navigator {{{
-" nnoremap <silent> <C-h> :TmuxNavigateLeft<CR>
+" Dispatch {{{
+nnoremap <leader>s :Make<CR>
 " }}}
 
 " Load local vimrc
--- a/zsh/exports.zsh	Fri Dec 05 23:06:30 2014 +0100
+++ b/zsh/exports.zsh	Tue Dec 09 19:51:07 2014 +0100
@@ -27,8 +27,6 @@
 export LESS='--ignore-case --raw-control-chars'
 export PAGER='less'
 export EDITOR='vim'
-# CTAGS Sorting in VIM/Emacs is better behaved with this in place
-export LC_COLLATE=C
 
 # Color Man Pages
 export LESS_TERMCAP_mb=$(printf "\e[1;31m")
@@ -40,4 +38,6 @@
 export LESS_TERMCAP_us=$(printf "\e[1;32m")
 
 export LANGUAGE=$LANG
+export LC_CTYPE=$LANG
+export LC_ALL=$LANG