mntnoe.com

Tips and tweaks making you more efficient with your favorite Linux tools.

Browsing Posts tagged vim

GMail has a nice keyboard accelerated web interface making it competitive to desktop mail clients as Thunderbird and even Mutt. One reason I stayed with Mutt for a long time was the ability to integrate with Vim. I switched to GMail’s web interface for other reasons, but nevertheless it was delightful to discover ItsAllText; a Firefox add-on that allows you to edit any textarea in an external editor. continue reading…

  • Facebook
  • Twitter
  • Digg
  • Reddit
  • del.icio.us
  • StumbleUpon

I like to be able to find the next occurence of a string without exiting the command line. Here is a hack to do that:

set incsearch
cnoremap <expr> / (getcmdtype() == '/' \|\| getcmdtype() == '?' ? (getcmdline() == '' ? "\<Up>" : "\<Cr>/\<Up>") : "/")
cnoremap <expr> ? (getcmdtype() == '/' \|\| getcmdtype() == '?' ? (getcmdline() == '' ? "\<Up>" : "\<Cr>?\<Up>") : "?")
  • Facebook
  • Twitter
  • Digg
  • Reddit
  • del.icio.us
  • StumbleUpon

I recently switched to the amazing colemak keyboard layout  – well, read the FAQ.

Also, being Danish (and using Vim), I swapped J and Y (qwerty Y and O). Qwerty Y is the only button I have difficulties reaching, and Danish has many “hard to reach” combinations like SKJ. I use AltGr for the Danish characters, Æ, Ø, and Å.

Further, by swapping J and Y, the mappings works well in Vim without any remapping (which breaks the consistency). Instead of HJKL I use HONU (qwerty positions), which are fairly easy to reach. It takes quite some time to get used to (especially for Vimmers), but I think it’s worth it…

  • Facebook
  • Twitter
  • Digg
  • Reddit
  • del.icio.us
  • StumbleUpon

Taking a course in Web Technology, I suddenly found myself editing a lot of XML files, so I hurried to fine-tune VIM to make editing more efficient. Please note that I am by no means an expert in XML, so please correct me, if I have misunderstood something. Configuration in xml.vim. Features:

  • Tag closing with code snippets from xmledit. Press <C-k> once to close the tag, and twice to close it and leave an empty line between.
  • Tag closing using omni-completion: <C-b>. This is used when the cursor is not at the end of the starting tag. Will insert the closing tag for the inner most unclosed starting tag.
  • Cycle between start and end tags with <LocalLeader>5 (typically \5 or ,5)
  • Remove outer tag with <LL>r
  • Goto parent tag with <LL>u (working on it, doesn’t work with <x/> tags. Anybody got a clue how to do this correctly?)
  • Document pretty printing with <LL>xf
  • Wellformedness checking (<LL>xx), DTD validation (<LL>xd) and XML Schema validation (<LL>xs) with XML Catalog support using xmllint (see below)

Have a look at Vim as XML Editor by Tobias Reif to find more tips. continue reading…

  • Facebook
  • Twitter
  • Digg
  • Reddit
  • del.icio.us
  • StumbleUpon