Reputation: 1814
Pentadactyl allows you to use an external text editor for <textarea>
and <input type="text">
elements on websites. I use GVim for this. This functionality is very useful but drives me to a question. I frequently want to wrap the text after editing, so my workflow is as follows:
:set tw=72
gq
to re-wrap areas that require it:wq
I would like to skip step #2 without affecting other editing in [G]Vim (i.e. I don't want to outright set tw=72
in .[g]vimrc
for all files). What is the best way to :set tw=72
in this specific circumstance on Linux for example, where Pentadactyl always launches $EDITOR
on /tmp/pentadactyl.txt
?
Upvotes: 4
Views: 998
Reputation: 59617
Add an autocmd
for this file to your .vimrc:
autocmd BufRead /tmp/pentadactyl.txt setlocal tw=72
This adds a hook that automatically does setlocal tw=72
whenever you're starting to edit a buffer after reading the given filename.
See :help autocmd
and :help autocmd-events
for more information.
Similarly, if your step #4 is predictable, i.e. you're always reformatting the entire file, you could add an autocmd
for BufWrite
.
Upvotes: 7