Best of Vim

Tips

  • When starting with vim, use an app that forces you to learn and practice all the keys. Particularly I have found “Vim Master” - https://play.google.com/store/apps/details?id=develop.example.beta1139.vimmaster to be very helpful.
  • To get better with vim, try to perform any coding task with the fewest possible keystrokes. This will be slower at first, but over time you will become much faster, surpassing your original performance when you did not use a diverse selection of vim commands.

Integrations

Conque-GDB (or, with CUDA enabled: MilesCranmer/Conque-GDB)

Use the <leader> key (which could be \, but for me is ,) to go through your code and interactively toggle break points, print values, and step around.

E.g., in normal mode: ,b triggers a break point on the current line, ,r runs cuda-gdb up to that point, then ,p prints the value under the cursor.

One useful command for CUDA: use p ((@global float*)array)[0]@50 in the cuda-gdb terminal to print 50 elements of the CUDA allocation array.

Essential yet Esoteric Commands

<shift>-K - Look up a man page for a function under the cursor

<ctl>-] - View the definition of a function (requires you to run ctags in the directory beforehand)

Other

Advanced vim ranges: https://nikodoko.com/posts/vim-ranges/

Leave a comment