tips/vimhroy.euhttps://hroy.eu/tips/vim/hroy.euikiwiki2014-10-21T15:55:06Zhttps://hroy.eu/tips/vim/itsalltext/2014-10-21T15:44:11Z2013-10-01T16:04:34Z
<p>When you get used to a text editor that you like, you start to
get annoyed by all the times you have to enter some text and
you're using a shitty editor. This is so true on the web when you
try to write something in more than 140 characters.</p>
<p><a href="https://fsfe.org/about/kirschner/kirschner.html">Matthias</a> showed
me a nice firefox extension: <a href="https://addons.mozilla.org/en-US/firefox/addon/its-all-text/">“it's all
text”</a>
(you can also install it from debian repos). For each text box,
you just click a small “edit” button and it will fire up vim[^1] and
let you edit the text there, then send it back to the web
interface.</p>
<p>[^1]: Actually, I had to configure it to start GVim instead of
vim. I suppose there's a way to launch a terminal and then vim…</p>
https://hroy.eu/tips/vim/email-delete-til-signature/2014-10-21T15:55:06Z2013-09-13T17:23:15Z
<h1>Reply to an email, easily delete the parts below line</h1>
<p>When I reply to emails, Mutt fires up vim. Then
I can quickly navigate until I reach the parts I want to reply to
specifically. Sometimes it’s just a portion of the whole email,
so I want to leave out the rest. <a href="https://blogs.fsfe.org/mk">Matthias</a> shared a
nice tip that allowed him to do that quickly. </p>
<p>Unfortunately, it wasn’t working properly for me. I figured out
it’s because in <a href="https://github.com/plasticboy/vim-markdown">markdown
mode</a>, I use folding.
By default, my own signature is folded. So I modified the rule a
little bit, and here it goes, just add in your <a
href="https://github.com/hugoroy/.vim/blob/master/vimrc">~/.vimrc</a>:</p>
<script src="https://gist.github.com/hugoroy/6553429.js"></script>
<noscript><pre>
" for email: unfold and delete to your signature
noremap ,dd zi:.;/^-- $/d<CR>O-- <UP><End><CR><CR
</pre>
<a
href="https://gist.github.com/hugoroy/6553429/raw/0828d0a604398fac8523c3d65907ed635b682b20/email-delete-til-signature.vimrc">most
updated version on github</a>
</noscript>
<p>So when you're below the part you’re replying to, just press
<code>,dd</code> and it will delete the rest of the email between
the line and your signature. </p>
<p>It only works if your signature is well delimited by <code>--
</code> and if folding is on. If you do not use folding, then use
<a href="https://joindiaspora.com/posts/3167663">the original config provided by
Matthias</a>:</p>
<pre>
noremap ,dd :.;/^-- $/dO--
</pre>
https://hroy.eu/tips/vim/arrow-keys/2014-10-21T15:55:06Z2013-09-12T11:41:00Z
<h1>Make arrows behave in VIM like in a GUI text editor</h1>
<p>This is wholly heretic to VIM purists, but I find it very useful for
people who do use ↑ and ↓ keys and do not intend to use them as a
replacement for k and j. Just add in your <a
href="https://github.com/hugoroy/.vim/blob/master/vimrc">~/.vimrc</a>:</p>
<script src="https://gist.github.com/hugoroy/5822226.js"></script>
<noscript><pre>
" make arrows behave like gui text editor
nnoremap <up> gk
nnoremap <down> gj
inoremap <up> <C-O>gk
inoremap <down> <C-O>gj
vnoremap <up> gk
vnoremap <down> gj
</pre>
<a
href="https://gist.github.com/hugoroy/5822226/raw/4e947e54558ad416cd9abc3290ee651d07a80a12/arrows.vimrc">most
updated version on github</a>
</noscript>