So I was getting a baffling "unexpected remote arg" error from rsync today. Eventually I figured out the problem was that my argument "--executability" had become "-- executablility", I think due to a copy and paste problem where I copied some shell script code from Vim in a Konsole terminal into another Vim in another Konsole terminal. Traps for young players! If you get baffled by this error try putting an 'echo' in front of the command and then resize your terminal window to see if that affects things...
If you press Ctrl+S in Vim (i.e. because that's hard-wired for 'save') your terminal may lockup, depending on how it's configured.
If you want to know why, have a read here. If you just want to get on with life, press Ctrl+Q!
Everything is easy when you know how.
In vim, to search for next '>' use: f>
To delete until next '"' use: df"
To delete an *ML attribute, e.g. use: df".
So I configured Terminal.app to use Option (Alt) as Meta key: Terminal => Preferences => Profiles => Keyboard => Use Option as Meta key
nmap <M-j> mz:m+<cr>`z nmap <M-k> mz:m-2<cr>`z
So I found this article: Fix meta-keys that break out of Insert mode and ended up with the following snippet for my .vimrc which fixed my Meta-key problem:
let c='a' while c <= 'z' exec "set <M-".tolower(c).">=\e".c exec "imap \e".c." <M-".tolower(c).">" let c = nr2char(1+char2nr(c)) endw
Everything is easy when you know how!
In vim to undo is 'u' and to redo (i.e. undo undo) is 'Ctrl+R'...
Reading about Vim: reformat a Python file to have 4 space indentations and came up with this:
In my .vimrc file I set expandtab, which means tab characters are converted to spaces.
Today I had to edit a python file, and I know python is funny about tabs and spaces, so I wanted to temporarily disable the expandtab feature in Vim.
Turns out you can do it with: