App-vidir
view release on metacpan or search on metacpan
ftplugin/vidir.vim view on Meta::CPAN
" Don't load another filetype plugin for this buffer
let b:did_ftplugin = 1
" Allow use of line continuation.
let s:save_cpo = &cpo
set cpo&vim
" Restore things when changing filetype.
let b:undo_ftplugin = "setl ofu< | augroup vidir_ls | exec 'au! CursorMoved,CursorMovedI <buffer>'|augroup END"
" do not allow the cursor to move back into the line numbers
function! s:on_cursor_moved()
let fname_pos = match(getline('.'), '^ *\d\+ \zs\S') + 1
let cur_pos = col('.')
if fname_pos < 1 || cur_pos >= fname_pos
" nothing to do
return
endif
" move cursor back to a sensible place
call cursor(line('.'), fname_pos)
endfunction
" do not allow non-numeric changes to the file index column
function! s:on_text_changed()
let broken_lines = []
silent vglobal/^ *\d\+ / call add(broken_lines, line('.'))
if empty(broken_lines)
" nothing to do
return
endif
ftplugin/vidir.vim view on Meta::CPAN
echohl Normal
return
endif
" found the right magic!
undojoin
call setline(1, lines[1:])
endfunction
augroup vidir_ls
autocmd!
autocmd CursorMoved,CursorMovedI <buffer> call s:on_cursor_moved()
autocmd TextChanged,TextChangedI <buffer> call s:on_text_changed()
augroup END
"reset &cpo back to users setting
let &cpo = s:save_cpo
" vim: set sw=2 sts=2 et fdm=marker:
( run in 0.244 second using v1.01-cache-2.11-cpan-4d50c553e7e )