More Vim tricks with Python


Well using Python quite a bit more and while my Vi was well tuned for Javascript there are some things to know with Python. First somethings that are reminders of features of Vi that I don’t use enough:

  1. gqq which means reformat the current like, this let’s you do rewrapping properly particularly in files
  2. Defeating auto indent. You need to do a CTRL-D to so back a shift width.
  3. I can never really remember the windowing stuff and normally just create a new window, but the basic command is :sp for split and then CTRL-W move you to the next window and CTRL-W moves you back. Finally if you want to get rid of windows, the :q works and :only gets rid of all the other windows.
  4. This works well with the various buffers, you can see them with :ls and then jump to buffer say 3 with b3

Then there are Python specific improvements:

  1. There are many Plugins and nearly too many
  2. You want to add these with vim-plug into your .vimrc and then you need to do a :PlugInstall to actually get it
  3. I do think this ALE is pretty useful, although I use an existing linter, but it is nice that it runs async.

Related Posts