5 ms·
I guess I have to give it a shot again. I keep on getting frustrated with VIM. Perhaps this is the proper way to learn it.
by xutopia 17y ago
I guess I have to give it a shot again. I keep on getting frustrated with VIM. Perhaps this is the proper way to learn it.
- gte910h 17y agoMake sure you get function completion, etc for your language integrated in. I know that function is one of the one's non-vimmers seem to miss most when coding, and I'd miss it too, if it wasn't one of the first things I setup for every language. http://www.vim.org/scripts/script.php?script_id=1879 http://www.vim.org/scripts/script.php?script_id=1879 http://vim.wikia.com/wiki/Omni_completion http://vim.wikia.com/wiki/Omni_completion C++ http://vim.wikia.com/wiki/C%2B%2B_code_completion http://vim.wikia.com/wiki/C%2B%2B_code_completion Python http://www.vim.org/scripts/script.php?script_id=1542 http://www.vim.org/scripts/script.php?script_id=1542 Objc http://www.vim.org/scripts/script.php?script_id=2674 http://www.vim.org/scripts/script.php?script_id=2674 Most people who use vim don't use it as an exercise in minimalism we're often caricatured as constantly undergoing. I mean, we don't chock it up to Visual Studio/Emacs level of plug-ins, but we definitely use some in our day to day on average.
- anatoly 17y agoMost people who use vim don't use it as an exercise in minimalism we're often caricatured as constantly undergoing. How do you know that?
- gte910h 17y agoI talk with other vim users? Even in unix shops, lots of the people end up trying to use stuff like kDevelop and stuff. Those of us who instead vim, we talk.
- anatoly 17y agoI use vim in a minimalistic fashion; I've never talked to you about it. My guess is that you haven't talked to other than a minuscule portion of vim-using developers around the globe, and are presenting your prejudice as fact.
- novas0x2a 17y agoAlso, a gem that most people don't seem to know about: a standard vim install comes with a program called `vimtutor`. Running it will put you inside vim with an excellent first tutorial, suitable for beginner vimmers. Good luck! The muscle memory you learn now will pay off in the future! :D
- sophacles 17y agoYes, vi related muscle memory is particularly useful when using non-vi text entry.:wq
- koenigdavidmj 17y agoGrr. Why can't ^W be something less harmful in most programs?
- jrockway 17y agoWhat programs is it not backward-kill-word in?
- sophacles 17y agoIn vim it is the first part of a sequence for manipulating windows. This mindset can conflict with e.g. firefox, in which ctrl-w closes a window. (particularly if there are multiple firefoxes/tabs open) Edit: That should be close tab, not close window, c-shift-w is window.
- jrockway 17y agoAh. In Emacs, bash, and conkeror, it does something useful. (I've never really understood why there are keyboard shortcuts for things like "quit program" and "print". How often, if ever, do you want to do those things? Do they really need to be one keystroke away!?)
- 17y ago
- nailer 17y ago[code folding section deleted, I stand corrected] Vim's indentation changes still require a mode change three obscure keys and an enter, and vim's discoverability still sucks.
- novas0x2a 17y agoWhat do you mean "yet"? vim has had code folding for years: :help fold.txt If you want to indent code, < and > are your friends. (Really? Indenting code with search/replace? What are we, barbarians?)
- gfodor 17y agoDepending on the area you want to indent, you can use visual mode with % to select the block and then >> it over, or, for more specific regions, use visual block mode with ctrl-V to highlight the first column of the text you want to indent, hit I, indent the line by hitting space, and hit escape. When you move the cursor the other lines will indent.
- Avshalom 17y agoAt least for curly bracket languages. >iB indents the block <iB deindents dunno which languages it works for otherwise http://vim.wikia.com/wiki/Category:Indenting http://vim.wikia.com/wiki/Category:Indenting
- philwelch 17y ago">" is the indent command. Repeat it ">>" to indent the current line. Use any other vim ranging construct (e.g. ">2j") to indent wider ranges--i.e. the current line plus two lines below. "=" is the autoindent command. Vim recognizes many languages and you can give it plugins to understand more. Use "==" to autoindent the current line. My personal favorite, "gg=G", jumps to the top of the document and autoindents the entire thing. One time at work I was gently reminded how many spaces I was supposed to indent per the company's coding standard. I quickly set the relevant editor parameters and with four keystrokes my code was compliant. I think there's a code-folding ability but I've never used it.
- billybob 17y agoIndenting? Heck yes. '=' will indent for you. You just have to give it a movement. =j means 'indent this line and the next' =% means 'indent to the matching brace' =/foo mean 'indent to the next occurrence of foo' 1G=G means 'go to the first line and indent until the last one' If you want specific rules for indenting file types, you can put stuff in your .vim/indent/ folder to define them