Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Movement is an important part of vim, but so is auto-competing. Probably the biggest thing that helped me greatly improve speed in vim was learning the C-x keys and that they are context aware. Having to repeat an entire or similar line/s becomes quick without having to go back to that place. Why move in the file when vim can find the text for you?


Pretty funny. I found myself asking "What does C-x do when autocompleting?" I took the 'x' literally, instead of realizing you meant C-n, C-p.

xD


In insert mode, C-x actually lists the different completion methods, so it's actually accurate.

^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)

I really like having C-x C-f, which autocompletes file names.


yeah, see my reply to the parent below. :D


x is literal. For context aware auto complete of a word try C-x C-n/p. For a line try C-x C-l. For a directory do C-x C-f. And remember that this is context aware, you can hammer C-x C-n C-x C-n or C-x C-l C-x C-l. Stuff is really powerful. Changed the way I program and I never see enough articles mention it.


Ah, this should really be easier to find in the vim docs. I did ":help ^x" and only came up with:

CTRL-X Subtract [count] from the number or alphabetic character at or after the cursor. {not in Vi}

After trying again today, I could not find any thing on context-aware completion no matter what help commands I tried. And I can usually find what I'm looking for there.

When I tried C-x in insert mode a couple of days ago, I'm not sure how I missed the: "-- ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" string that appears in the mode line. Perhaps I saw it and didn't grasp what it was.

I'm always amazed after so many years of using vim how many new things there are to learn about it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: