Permalink
Browse files

Setup QuitPre autocmd to quit cleanly on (V)Header command

  • Loading branch information...
1 parent 4806772 commit 8f980723ae1239c6f73379e5c99340671a88afd7 @chrisbra committed Mar 10, 2013
Showing with 11 additions and 0 deletions.
  1. +11 −0 ftplugin/csv.vim
View
@@ -770,6 +770,16 @@ fu! <sid>GetColPat(colnr, zs_flag) "{{{3
return pat . (a:zs_flag ? '\zs' : '')
endfu
+fu! <sid>SetupQuitPre() "{{{3
+ " Setup QuitPre autocommand to quit cleanly
+ if exists("##QuitPre")
+ let bufnr=bufnr('')
+ noa wincmd p
+ exe "au QuitPre * ". bufnr. "bw"
+ noa wincmd p
+ endif
+endfu
+
fu! <sid>SplitHeaderLine(lines, bang, hor) "{{{3
if exists("b:csv_fixed_width_cols")
call <sid>Warn("Header does not work with fixed width column!")
@@ -828,6 +838,7 @@ fu! <sid>SplitHeaderLine(lines, bang, hor) "{{{3
call matchadd("CSVHeaderLine", b:col)
setl scrollopt=ver winfixwidth
endif
+ call <sid>SetupQuitPre()
let win = winnr()
setl scrollbind buftype=nowrite bufhidden=wipe noswapfile nobuflisted
wincmd p

0 comments on commit 8f98072

Please sign in to comment.