summaryrefslogtreecommitdiffstats
path: root/ftplugin
diff options
context:
space:
mode:
Diffstat (limited to 'ftplugin')
-rw-r--r--ftplugin/csv.vim194
-rw-r--r--ftplugin/go/fmt.vim12
-rw-r--r--ftplugin/jade.vim2
-rw-r--r--ftplugin/latex-box/complete.vim2
-rw-r--r--ftplugin/latex-box/latexmk.vim67
-rw-r--r--ftplugin/scala.vim13
6 files changed, 199 insertions, 91 deletions
diff --git a/ftplugin/csv.vim b/ftplugin/csv.vim
index 1ba27722..596012a3 100644
--- a/ftplugin/csv.vim
+++ b/ftplugin/csv.vim
@@ -136,7 +136,7 @@ fu! <sid>Init(startline, endline) "{{{3
\ . "| unlet! b:csv_fixed_width b:csv_list b:col_width"
\ . "| unlet! b:csv_SplitWindow b:csv_headerline"
\ . "| unlet! b:csv_thousands_sep b:csv_decimal_sep"
- \. " | unlet! b:browsefilter b:csv_start b:csv_end"
+ \. " | unlet! b:browsefilter b:csv_cmt"
" Delete all functions
" disabled currently, because otherwise when switching ft
@@ -168,6 +168,7 @@ fu! <sid>Init(startline, endline) "{{{3
" \ delf <sid>SaveOptions | delf <sid>CheckDuplicates |
" \ delf <sid>CompleteColumnNr | delf <sid>CSVPat | delf <sid>Transpose |
" \ delf <sid>LocalSettings() | delf <sid>AddColumn | delf <sid>SubstituteInColumn
+ " \ delf <sid>SetupQuitPre() | delf CSV_CloseBuffer
endfu
fu! <sid>LocalSettings(type) "{{{3
@@ -275,7 +276,9 @@ fu! <sid>DoAutoCommands() "{{{3
au BufNewFile,BufNew * call <sid>Menu(0)
augroup END
"let b:undo_ftplugin .= '| sil! amenu disable CSV'
- let b:undo_ftplugin .= '| sil! call <sid>Menu(0)'
+ "
+ " b:undo_ftplugin does not support calling <sid> Functions
+ "let b:undo_ftplugin .= '| sil! call <sid>Menu(0)'
endif
endfu
@@ -658,7 +661,7 @@ fu! <sid>ArrangeCol(first, last, bang) range "{{{3
else
let ro = 0
endif
- exe a:first . ',' . a:last .'s/' . (b:col) .
+ exe "sil". a:first . ',' . a:last .'s/' . (b:col) .
\ '/\=<SID>Columnize(submatch(0))/' . (&gd ? '' : 'g')
" Clean up variables, that were only needed for <sid>Columnize() function
unlet! s:columnize_count s:max_cols s:prev_line
@@ -795,16 +798,13 @@ fu! <sid>GetColPat(colnr, zs_flag) "{{{3
return pat . (a:zs_flag ? '\zs' : '')
endfu
-fu! <sid>SetupQuitPre() "{{{3
+fu! <sid>SetupQuitPre(window) "{{{3
" Setup QuitPre autocommand to quit cleanly
if exists("##QuitPre")
- let bufnr=bufnr('')
- noa wincmd p
augroup CSV_QuitPre
au!
- exe "au QuitPre * ". bufnr. "bw"
+ exe "au QuitPre * call CSV_CloseBuffer(".winbufnr(a:window).")"
augroup end
- noa wincmd p
endif
endfu
@@ -839,7 +839,7 @@ fu! <sid>SplitHeaderLine(lines, bang, hor) "{{{3
"let b:col=b
"setl syntax=csv
sil! doautocmd FileType csv
- 1
+ noa 1
exe "resize" . lines
setl scrollopt=hor winfixheight nowrap
"let &l:stl=repeat(' ', winwidth(0))
@@ -848,31 +848,31 @@ fu! <sid>SplitHeaderLine(lines, bang, hor) "{{{3
let &l:fdc = _fdc
else
setl scrollopt=ver scrollbind
- 0
- let a=<sid>CopyCol('',1)
- " Force recalculating columns width
- unlet! b:csv_list
- try
- let width = <sid>ColWidth(1)
- catch /ColWidth/
- call <sid>Warn("Error: getting Column Width, using default!")
- endtry
+ noa 0
+ let a=<sid>CopyCol('',1,a:lines)
" Does it make sense to use the preview window?
"vert sil! pedit |wincmd w | enew!
above vsp +enew
call append(0, a)
$d _
- sil %s/.*/\=printf("%.*s", width, submatch(0))/eg
- 0
- exe "vert res" width
- let b:col=b
+ let b:col = b
+ sil! doautocmd FileType csv
+ " remove leading delimiter
+ exe "sil :%s/^". b:delimiter. "//e"
+ " remove trailing delimiter
+ exe "sil :%s/". b:delimiter. "\s*$//e"
+ syn clear
+ noa 0
+ let b:csv_SplitWindow = winnr()
+ sil :call <sid>ArrangeCol(1,line('$'), 1)
+ exe "vert res" . len(split(getline(1), '\zs'))
call matchadd("CSVHeaderLine", b:col)
setl scrollopt=ver winfixwidth
endif
- call <sid>SetupQuitPre()
+ call <sid>SetupQuitPre(winnr())
let win = winnr()
setl scrollbind buftype=nowrite bufhidden=wipe noswapfile nobuflisted
- wincmd p
+ noa wincmd p
let b:csv_SplitWindow = win
aug CSV_Preview
au!
@@ -891,7 +891,12 @@ fu! <sid>SplitHeaderLine(lines, bang, hor) "{{{3
let &sbo = _sbo
endif
setl noscrollbind
- wincmd c
+ try
+ wincmd c
+ catch /^Vim\%((\a\+)\)\=:E444/ " cannot close last window
+ catch /^Vim\%((\a\+)\)\=:E517/ " buffer already wiped
+ " no-op
+ endtry
"pclose!
unlet! b:csv_SplitWindow
aug CSV_Preview
@@ -910,8 +915,11 @@ fu! <sid>SplitHeaderToggle(hor) "{{{3
endfu
" TODO: from here on add logic for fixed-width csv files!
-fu! <sid>MoveCol(forward, line) "{{{3
+fu! <sid>MoveCol(forward, line, ...) "{{{3
" Move cursor position upwards/downwards left/right
+ " a:1 is there to have some mappings move in the same
+ " direction but still stop at a different position
+ " see :h csv-mapping-H
let colnr=<SID>WColumn()
let maxcol=<SID>MaxColumns()
let cpos=getpos('.')[2]
@@ -982,6 +990,17 @@ fu! <sid>MoveCol(forward, line) "{{{3
norm! 0
endif
endw
+ if (exists("a:1") && a:1)
+ " H also stops at the beginning of the content
+ " of a field.
+ let epos = getpos('.')
+ if getline('.')[col('.')-1] == ' '
+ call search('\S', 'W', line('.'))
+ if getpos('.')[2] > spos
+ call setpos('.', epos)
+ endif
+ endif
+ endif
else
norm! 0
endif
@@ -1043,13 +1062,19 @@ fu! <sid>Sort(bang, line1, line2, colnr) range "{{{3
call winrestview(wsv)
endfun
-fu! <sid>CopyCol(reg, col) "{{{3
+fu! <sid>CopyCol(reg, col, cnt) "{{{3
" Return Specified Column into register reg
let col = a:col == "0" ? <sid>WColumn() : a:col+0
let mcol = <sid>MaxColumns()
if col == '$' || col > mcol
let col = mcol
endif
+ " The number of columns to return
+ " by default (value of zero, will only return that specific column)
+ let cnt_cols = col - 1
+ if !empty(a:cnt) && a:cnt > 0 && col + a:cnt <= mcol
+ let cnt_cols = col + a:cnt - 1
+ endif
let a = []
" Don't get lines, that are currently filtered away
if !exists("b:csv_filter") || empty(b:csv_filter)
@@ -1068,9 +1093,12 @@ fu! <sid>CopyCol(reg, col) "{{{3
call filter(a, 'v:val !~ pat')
if !exists("b:csv_fixed_width_cols")
- call map(a, 'split(v:val, ''^'' . b:col . ''\zs'')[col-1]')
+ call map(a, 'split(v:val, ''^'' . b:col . ''\zs'')[col-1:cnt_cols]')
else
- call map(a, 'matchstr(v:val, <sid>GetColPat(col, 0))')
+ call map(a, 'matchstr(v:val, <sid>GetColPat(col, 0)).*<sid>GetColPat(col+cnt_cols, 0)')
+ endif
+ if type(a[0]) == type([])
+ call map(a, 'join(v:val, "")')
endif
if a:reg =~ '[-"0-9a-zA-Z*+]'
"exe ':let @' . a:reg . ' = "' . join(a, "\n") . '"'
@@ -1574,7 +1602,7 @@ fu! <sid>AnalyzeColumn(...) "{{{3
" Initialize s:fold_headerline
call <sid>CheckHeaderLine()
- let data = <sid>CopyCol('', colnr)[s:csv_fold_headerline : -1]
+ let data = <sid>CopyCol('', colnr, '')[s:csv_fold_headerline : -1]
let qty = len(data)
let res = {}
for item in data
@@ -1665,59 +1693,56 @@ fu! <sid>InitCSVFixedWidth() "{{{3
endif
" Turn off syntax highlighting
syn clear
+ let max_len = len(split(getline(1), '\zs'))
let _cc = &l:cc
let &l:cc = 1
redraw!
- let list = []
+ let Dict = {'1': 1} " first column is always the start of a new column
let tcc = &l:cc
+ let &l:cc = 1
echo "<Cursor>, <Space>, <ESC>, <BS>, <CR>..."
let char=getchar()
while 1
if char == "\<Left>" || char == "\<Right>"
let tcc = eval('tcc'.(char=="\<Left>" ? '-' : '+').'1')
+ if tcc < 0
+ let tcc=0
+ elseif tcc > max_len
+ let tcc = max_len
+ endif
elseif char == "\<Space>" || char == 32 " Space
- call add(list, tcc)
+ let Dict[tcc] = 1
elseif char == "\<BS>" || char == 127
- call remove(list, -1)
+ try
+ call remove(Dict, reverse(sort(keys(Dict)))[0])
+ catch /^Vim\%((\a\+)\)\=:E\(\%(716\)\|\%(684\)\)/ " Dict or List empty
+ break
+ endtry
elseif char == "\<ESC>" || char == 27
let &l:cc=_cc
redraw!
return
+ elseif char == "\<CR>" || char == "\n" || char == "\r" " Enter
+ let Dict[tcc] = 1
+ break
else
break
endif
- let &l:cc=tcc . (!empty(list)? ',' . join(list, ','):'')
+ let &l:cc=tcc . (!empty(keys(Dict))? ',' . join(keys(Dict), ','):'')
redraw!
echo "<Cursor>, <Space>, <ESC>, <BS>, <CR>..."
let char=getchar()
endw
- if tcc > 0
- call add(list,tcc)
- endif
let b:csv_fixed_width_cols=[]
let tcc=0
- if !empty(list)
- call Break()
- " Remove duplicate entries
- for val in sort(list, "<sid>SortList")
- if val==tcc
- continue
- endif
- call add(b:csv_fixed_width_cols, val)
- let tcc=val
- endfor
- let b:csv_fixed_width=join(sort(b:csv_fixed_width_cols,
- \ "<sid>SortList"), ',')
- call <sid>Init(1, line('$'))
- endif
+ let b:csv_fixed_width_cols = sort(keys(Dict), "<sid>SortList")
+ let b:csv_fixed_width = join(sort(keys(Dict), "<sid>SortList"), ',')
+ call <sid>Init(1, line('$'))
+
let &l:cc=_cc
redraw!
endfu
-fu! Break()
- return
-endfu
-
fu! <sid>NewRecord(line1, line2, count) "{{{3
if a:count =~ "\D"
call <sid>WarningMsg("Invalid count specified")
@@ -1757,22 +1782,35 @@ fu! <sid>MoveOver(outer) "{{{3
" Move over a field
" a:outer means include the delimiter
let last = 0
- let mode = a:outer
+ let outer_field = a:outer
+ let cur_field = <sid>WColumn()
+ let _wsv = winsaveview()
- if <sid>WColumn() == <sid>MaxColumns()
+ if cur_field == <sid>MaxColumns()
let last = 1
- if !mode && getline('.')[-1:] != b:delimiter
+ if !outer_field && getline('.')[-1:] != b:delimiter
" No trailing delimiter, so inner == outer
- let mode = 1
+ let outer_field = 1
endif
endif
- call <sid>MoveCol(-1, line("."))
+ " Move 1 column backwards, unless the cursor is in the first column
+ " or in front of a delimiter
+ if matchstr(getline('.'), '.\%'.virtcol('.').'v') != b:delimiter && virtcol('.') > 1
+ call <sid>MoveCol(-1, line('.'))
+ endif
+" if cur_field != <sid>WColumn()
+ " cursor was at the beginning of the field, and moved back to the
+ " previous field, move back to original position
+" call cursor(_wsv.lnum, _wsv.col)
+" endif
let _s = @/
if last
- exe "sil! norm! /" . b:col . "\<cr>v$h" . (mode ? "" : "\<Left>")
+ exe "sil! norm! v$h" . (outer_field ? "" : "h") . (&sel ==# 'exclusive' ? "l" : '')
else
- exe "sil! norm! /" . b:col . "\<cr>vn\<Left>" . (mode ? "" : "\<Left>")
+ exe "sil! norm! v/." . b:col . "\<cr>h" . (outer_field ? "" : "h") . (&sel ==# 'exclusive' ? "l" : '')
endif
+ let _wsv.col = col('.')-1
+ call winrestview(_wsv)
let @/ = _s
endfu
@@ -1782,7 +1820,7 @@ fu! <sid>CSVMappings() "{{{3
call <sid>Map('noremap', 'L', ':<C-U>call <SID>MoveCol(1, line("."))<CR>')
call <sid>Map('noremap', 'E', ':<C-U>call <SID>MoveCol(-1, line("."))<CR>')
call <sid>Map('noremap', '<C-Left>', ':<C-U>call <SID>MoveCol(-1, line("."))<CR>')
- call <sid>Map('noremap', 'H', ':<C-U>call <SID>MoveCol(-1, line("."))<CR>')
+ call <sid>Map('noremap', 'H', ':<C-U>call <SID>MoveCol(-1, line("."), 1)<CR>')
call <sid>Map('noremap', 'K', ':<C-U>call <SID>MoveCol(0,
\ line(".")-v:count1)<CR>')
call <sid>Map('noremap', '<Up>', ':<C-U>call <SID>MoveCol(0,
@@ -1846,8 +1884,8 @@ fu! <sid>CommandDefinitions() "{{{3
\ ':call <sid>Sort(<bang>0, <line1>,<line2>,<q-args>)',
\ '-nargs=* -bang -range=% -complete=custom,<sid>SortComplete')
call <sid>LocalCmd("Column",
- \ ':call <sid>CopyCol(empty(<q-reg>)?''"'':<q-reg>,<q-count>)',
- \ '-count -register')
+ \ ':call <sid>CopyCol(empty(<q-reg>)?''"'':<q-reg>,<q-count>,<q-args>)',
+ \ '-count -register -nargs=?')
call <sid>LocalCmd("MoveColumn",
\ ':call <sid>MoveColumn(<line1>,<line2>,<f-args>)',
\ '-range=% -nargs=* -complete=custom,<sid>SortComplete')
@@ -2328,6 +2366,11 @@ endfu
" Global functions "{{{2
fu! csv#EvalColumn(nr, func, first, last) range "{{{3
+ " Make sure, the function is called for the correct filetype.
+ if match(split(&ft, '\.'), 'csv') == -1
+ call <sid>Warn("File is no CSV file!")
+ return
+ endif
let save = winsaveview()
call <sid>CheckHeaderLine()
let nr = matchstr(a:nr, '^\d\+')
@@ -2336,7 +2379,7 @@ fu! csv#EvalColumn(nr, func, first, last) range "{{{3
let start = a:first - 1 + s:csv_fold_headerline
let stop = a:last - 1 + s:csv_fold_headerline
- let column = <sid>CopyCol('', col)[start : stop]
+ let column = <sid>CopyCol('', col, '')[start : stop]
" Delete delimiter
call map(column, 'substitute(v:val, b:delimiter . "$", "", "g")')
" Revmoe trailing whitespace
@@ -2396,7 +2439,7 @@ fu! CSVField(x, y, ...) "{{{3
let orig = !empty(a:0)
let y = (y < 0 ? 0 : y)
let x = (x > (<sid>MaxColumns()) ? (<sid>MaxColumns()) : x)
- let col = <sid>CopyCol('',x)
+ let col = <sid>CopyCol('',x,'')
if !orig
" remove leading and trainling whitespace and the delimiter
return matchstr(col[y], '^\s*\zs.\{-}\ze\s*'.b:delimiter.'\?$')
@@ -2435,6 +2478,23 @@ fu! CSV_WCol(...) "{{{3
endtry
endfun
+fu! CSV_CloseBuffer(buffer) "{{{3
+ " Setup by SetupQuitPre autocommand
+ try
+ if bufnr((a:buffer)+0) > -1
+ exe a:buffer. "bw"
+ endif
+ catch /^Vim\%((\a\+)\)\=:E517/ " buffer already wiped
+ " no-op
+ finally
+ augroup CSV_QuitPre
+ au!
+ augroup END
+ augroup! CSV_QuitPre
+ endtry
+endfu
+
+
" Initialize Plugin "{{{2
let b:csv_start = exists("b:csv_start") ? b:csv_start : 1
let b:csv_end = exists("b:csv_end") ? b:csv_end : line('$')
diff --git a/ftplugin/go/fmt.vim b/ftplugin/go/fmt.vim
index 5447d457..359545bd 100644
--- a/ftplugin/go/fmt.vim
+++ b/ftplugin/go/fmt.vim
@@ -18,15 +18,21 @@
"
" Flag to indicate whether to enable the commands listed above.
"
+" g:gofmt_command [default="gofmt"]
+"
+" Flag naming the gofmt executable to use.
+"
if exists("b:did_ftplugin_go_fmt")
finish
endif
-
if !exists("g:go_fmt_commands")
let g:go_fmt_commands = 1
endif
+if !exists("g:gofmt_command")
+ let g:gofmt_command = "gofmt"
+endif
if g:go_fmt_commands
command! -buffer Fmt call s:GoFormat()
@@ -34,7 +40,7 @@ endif
function! s:GoFormat()
let view = winsaveview()
- silent %!gofmt
+ silent execute "%!" . g:gofmt_command
if v:shell_error
let errors = []
for line in getline(1, line('$'))
@@ -51,7 +57,7 @@ function! s:GoFormat()
endif
undo
if !empty(errors)
- call setloclist(0, errors, 'r')
+ call setqflist(errors, 'r')
endif
echohl Error | echomsg "Gofmt returned error" | echohl None
endif
diff --git a/ftplugin/jade.vim b/ftplugin/jade.vim
index a6ff9b9a..235770d0 100644
--- a/ftplugin/jade.vim
+++ b/ftplugin/jade.vim
@@ -45,7 +45,7 @@ endif
setlocal comments=://-,:// commentstring=//\ %s
-setlocal suffixesadd=.jade
+setlocal suffixesadd+=.jade
let b:undo_ftplugin = "setl cms< com< "
\ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin
diff --git a/ftplugin/latex-box/complete.vim b/ftplugin/latex-box/complete.vim
index af894777..9f4f55d5 100644
--- a/ftplugin/latex-box/complete.vim
+++ b/ftplugin/latex-box/complete.vim
@@ -291,7 +291,7 @@ function! LatexBox_BibSearch(regexp)
" Find data from 'thebibliography' environments
let lines = readfile(LatexBox_GetMainTexFile())
- if match(lines, '\C\\begin{thebibliography}')
+ if match(lines, '\C\\begin{thebibliography}') >= 0
for line in filter(filter(lines, 'v:val =~ ''\C\\bibitem'''),
\ 'v:val =~ a:regexp')
let match = matchlist(line, '\\bibitem{\([^}]*\)')[1]
diff --git a/ftplugin/latex-box/latexmk.vim b/ftplugin/latex-box/latexmk.vim
index 87ac2a99..2ce16d26 100644
--- a/ftplugin/latex-box/latexmk.vim
+++ b/ftplugin/latex-box/latexmk.vim
@@ -92,8 +92,8 @@ function! s:LatexmkCallback(basename, status)
" Only remove the pid if not in continuous mode
if !g:LatexBox_latexmk_preview_continuously
call remove(g:latexmk_running_pids, a:basename)
- call LatexBox_LatexErrors(a:status, a:basename)
endif
+ call LatexBox_LatexErrors(a:status, a:basename)
endfunction
function! s:setup_vim_server()
@@ -104,7 +104,7 @@ function! s:setup_vim_server()
if has('win32')
" Just drop through to the default for windows
else
- if match(&shell, '/\(bash\|zsh\)$') >= 0
+ if match(&shell, '\(bash\|zsh\)$') >= 0
let ppid = '$PPID'
else
let ppid = '$$'
@@ -188,6 +188,10 @@ function! LatexBox_Latexmk(force)
endif
let cmd .= ' -e ' . shellescape('$pdflatex =~ s/ / -file-line-error /')
let cmd .= ' -e ' . shellescape('$latex =~ s/ / -file-line-error /')
+ if g:LatexBox_latexmk_preview_continuously
+ let cmd .= ' -e ' . shellescape('$success_cmd = $ENV{SUCCESSCMD}')
+ let cmd .= ' -e ' . shellescape('$failure_cmd = $ENV{FAILURECMD}')
+ endif
let cmd .= ' ' . mainfile
" Redirect output to null
@@ -223,19 +227,39 @@ function! LatexBox_Latexmk(force)
let callback = callbackfunc . '(''' . basepath . ''', %LATEXERR%)'
let vimcmd = vim_program . ' --servername ' . v:servername
\ . ' --remote-expr ' . shellescape(callback)
+ let scallback = callbackfunc . '(''' . basepath . ''', 0)'
+ let svimcmd = vim_program . ' --servername ' . v:servername
+ \ . ' --remote-expr ' . shellescape(scallback)
+ let fcallback = callbackfunc . '(''' . basepath . ''', 1)'
+ let fvimcmd = vim_program . ' --servername ' . v:servername
+ \ . ' --remote-expr ' . shellescape(fcallback)
let asyncbat = tempname() . '.bat'
- call writefile(['setlocal',
- \ 'set T=%TEMP%\sthUnique.tmp',
- \ 'wmic process where (Name="WMIC.exe" AND CommandLine LIKE "%%%TIME%%%") '
- \ . 'get ParentProcessId /value | find "ParentProcessId" >%T%',
- \ 'set /P A=<%T%',
- \ 'set CMDPID=%A:~16% & del %T%',
- \ vimsetpid,
- \ cmd,
- \ 'set LATEXERR=%ERRORLEVEL%',
- \ vimcmd,
- \ 'endlocal'], asyncbat)
+ if g:LatexBox_latexmk_preview_continuously
+ call writefile(['setlocal',
+ \ 'set T=%TEMP%\sthUnique.tmp',
+ \ 'wmic process where (Name="WMIC.exe" AND CommandLine LIKE "%%%TIME%%%") '
+ \ . 'get ParentProcessId /value | find "ParentProcessId" >%T%',
+ \ 'set /P A=<%T%',
+ \ 'set CMDPID=%A:~16% & del %T%',
+ \ vimsetpid,
+ \ 'set SUCCESSCMD='.svimcmd,
+ \ 'set FAILURECMD='.fvimcmd,
+ \ cmd,
+ \ 'endlocal'], asyncbat)
+ else
+ call writefile(['setlocal',
+ \ 'set T=%TEMP%\sthUnique.tmp',
+ \ 'wmic process where (Name="WMIC.exe" AND CommandLine LIKE "%%%TIME%%%") '
+ \ . 'get ParentProcessId /value | find "ParentProcessId" >%T%',
+ \ 'set /P A=<%T%',
+ \ 'set CMDPID=%A:~16% & del %T%',
+ \ vimsetpid,
+ \ cmd,
+ \ 'set LATEXERR=%ERRORLEVEL%',
+ \ vimcmd,
+ \ 'endlocal'], asyncbat)
+ endif
" Define command
let cmd = '!start /b ' . asyncbat . ' & del ' . asyncbat
@@ -248,13 +272,26 @@ function! LatexBox_Latexmk(force)
" Define callback after latexmk is finished
let callback = shellescape(callbackfunc).'"(\"'.basepath.'\",$?)"'
let vimcmd = g:vim_program . ' --servername ' . v:servername
- \ . ' --remote-expr ' . callback
+ \ . ' --remote-expr ' . callback
+ let scallback = shellescape(callbackfunc).'"(\"'.basepath.'\",0)"'
+ let svimcmd = g:vim_program . ' --servername ' . v:servername
+ \ . ' --remote-expr ' . scallback
+ let fcallback = shellescape(callbackfunc).'"(\"'.basepath.'\",1)"'
+ let fvimcmd = g:vim_program . ' --servername ' . v:servername
+ \ . ' --remote-expr ' . fcallback
" Define command
" Note: Here we escape '%' because it may be given as a user option
" through g:LatexBox_latexmk_options, for instance with
" g:Latex..._options = "-pdflatex='pdflatex -synctex=1 \%O \%S'"
- let cmd = vimsetpid . ' ; ' . escape(cmd, '%') . ' ; ' . vimcmd
+ if g:LatexBox_latexmk_preview_continuously
+ let cmd = vimsetpid . ' ; '
+ \ . 'export SUCCESSCMD=' . shellescape(svimcmd) . ' '
+ \ . ' FAILURECMD=' . shellescape(fvimcmd) . ' ; '
+ \ . escape(cmd, '%')
+ else
+ let cmd = vimsetpid . ' ; ' . escape(cmd, '%') . ' ; ' . vimcmd
+ endif
let cmd = '! (' . cmd . ') >/dev/null &'
endif
diff --git a/ftplugin/scala.vim b/ftplugin/scala.vim
index cdd1a74d..6db56d04 100644
--- a/ftplugin/scala.vim
+++ b/ftplugin/scala.vim
@@ -117,16 +117,21 @@ if globpath(&rtp, 'plugin/fuf.vim') != ''
return scala#GetDirForFuzzyFinder(a:from, 'src/../')
endfunction
- nnoremap <buffer> <silent> ,ft :FufFile <c-r>=scala#GetTestDirForFuzzyFinder('%:p:h')<cr><cr>
- nnoremap <buffer> <silent> ,fs :FufFile <c-r>=scala#GetMainDirForFuzzyFinder('%:p:h')<cr><cr>
- nnoremap <buffer> <silent> ,fr :FufFile <c-r>=scala#GetRootDirForFuzzyFinder('%:p:h')<cr><cr>
+ " If you want to disable the default key mappings, write the following line in
+ " your ~/.vimrc
+ " let g:scala_use_default_keymappings = 0
+ if get(g:, 'scala_use_default_keymappings', 1)
+ nnoremap <buffer> <silent> <Leader>ft :FufFile <c-r>=scala#GetTestDirForFuzzyFinder('%:p:h')<cr><cr>
+ nnoremap <buffer> <silent> <Leader>fs :FufFile <c-r>=scala#GetMainDirForFuzzyFinder('%:p:h')<cr><cr>
+ nnoremap <buffer> <silent> <Leader>fr :FufFile <c-r>=scala#GetRootDirForFuzzyFinder('%:p:h')<cr><cr>
+ endif
endif
" If you want to disable the default key mappings, write the following line in
" your ~/.vimrc
" let g:scala_use_default_keymappings = 0
if get(g:, 'scala_use_default_keymappings', 1)
- nnoremap <buffer> ,jt :call JustifyCurrentLine()<cr>
+ nnoremap <buffer> <Leader>jt :call JustifyCurrentLine()<cr>
endif
"