2

I have a long .csv log file that I regularly append data to. I am usually interested in editing last 10 entries or so. I suppose vim modelines do not support Ex commands due to security reasons. Is there a workaround to make this Ex command a modeline in vim so that whenever the specific .csv file is opened, it shows only last 10 entries (like head but in vim).

:1,$-10fold
1
  • 2
    not possible via modelines. However should be possible using a Buf(Win)Enter autocommand Sep 20 at 11:09

1 Answer 1

0

Suppose your file is /usr/bar/foo.csv I would do:

augroup FoldSpecificLog
  autocmd!
  autocmd BufRead /usr/bar/foo.csv 1,$-10fold
augroup END
1
  • 1
    Maybe an augroup instead of autocmd! ?
    – D. Ben Knoble
    Sep 20 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.