9 ms·
Commanding your text editor
- petepete 14y agoA nice introduction, although I'd be surprised if anyone who wasn't totally new to development didn't know these already. Also, 'Fuzzy file' searching in vim: https://github.com/kien/ctrlp.vim https://github.com/kien/ctrlp.vim
- yummyfajitas 14y agoIn emacs, you'd be better off using anything+eproject for fuzzy file searching. I.e., type C-f foo and it will show you all the files in the current repository that contain foo.
- johncoltrane 14y agoYou would be surprised at how many people, programmers or not, experienced or not, don't know those and other basic shortcuts. No wonder Vim's motions sound like necromancy to so many people.
- account_taken 14y agoIt is true Vim requires commitment but once you get it, the motions and key combination are logical. As others have mentioned for fuzzy finding, use CtrlP. I also use FuzzyFinder for quickly switching between many open files (buffers).
- johncoltrane 14y agoNo need to have two plugins that do the same thing, CtrlP does buffer switching too. While we are at it… I never really used TagList or equivalent widgets in other IDEs/editors as an outline of my code but rather as a navigation tool. :CtrlPBufferTag is great for moving around in a large file. Same thing with :CtrlPTag for navigating a project. I love CtrlP. If the "you" is me you don't need to convince me at all: I'm a diehard Vimmer.
- Destroyer661 14y agoCame here to hopefully post or see ctrlp fuzzy search for vim. When I didn't see it recommended I was shocked. It completely changed the way I interact with my files while I develop.
- eitland 14y agoRegarding the point about autocompletion: If autocompletion is needed don't use vim or emacs, -use Netbeans or eclipse, both excellent, free (both ways) and open source. vim is great and I use it all the time but not for Java and PHP where the IDE support is so good that it really makes a difference.
- emillon 14y agoAutocompletion does not have to be context-aware to be useful. "Dumb" completion of words in the current buffer, or filename, is quite useful IMHO.
- aerique 14y agoDumb autocompletion easily covers 50% of my cases and with Emacs hippie-expand (or one of its modern siblings) up to 75%: http://emacswiki.org/emacs/HippieExpand http://emacswiki.org/emacs/HippieExpand That said, Emacs and Vim also have intelligent autocompletion depending on the language and support for it has only been getting better. disclaimer: numbers have been made up
- confluence 14y agoI concur - Java dev off Eclipse can be a complete nightmare. I used to be a hard core vimmer/command liner - until I realised 2 things: 1. The vast majority of things that I did were repetitive and were already solved in other environments 2. Knowing the minutiae of the stuff that I know now does not improve my skills at all - production matters for shipping, minutiae matters for interviews. Best way to get a job is to produce so much - you don't have to interview :D Now I just use whatever is the most widely deployed, best supported environment for each language (e.g. Visual Studio for C++ and Eclipse for Java). The one thing I have kept is my vim foo by using IDE specific plugins :D. Pick your tools carefully - and don't fall into the "true final solution trap" that people try to sell you. Choose the right tool for the right job.
- emidln 14y agoI feel like the second time I do an action in vim, it tends to get macro'd so subsequent uses aren't repetitive.
- jrajav 14y agoThe "keys instead of notations" idea is neat, but it makes it a little more difficult to visually parse, and more importantly, it ignores other keyboard layouts. For such a small article it's not a big deal, but if this were a larger list, I would definitely go with a more abstract representation.
- tubs 14y agoIf you are deleting a word in order to correct a mistake (ie/ by typing it back in) it's usually best to `cw` or `cb`, which will leave you in insert mode after the delete.
- deleted 14y ago[deleted]
- bvdbijl 14y agoThey show the keys as they are on the keyboard...
- jheriko 14y agoI think its much more important to become good at using whatever text editor is infront of you - i.e. learning the standard Windows/Mac shortcuts, instead of becoming reliant on what I consider the 'old' style of text editor. Yet to meet anyone using vim or emacs who is actually more productive than me... the more productive people use Visual Studio, Xcode, Eclipse or whatever else is infront of them. Maybe I am wrong, but I think typing is probably 30% or less of the time I spend coding... and thinking to make sure I write less code is probably more valuable than typing faster, not just in saving me time, but in improving stability and ease of reading code...
- martinced 14y agoEditor war! You are confusing non-expressive languages like C# and Java which needs lots of "refactoring" and lots of boilerplate code (hence the need for code generators which understand "patterns" and refactoring tools etc.) with "productive languages", for a start. Then your point is moot anyway: since quite some time there are vim programmers using an Eclipse bridge and getting the Eclipse features right from inside vim (it's called "eclim") and there's, of course, a port to Emacs ("emacs-eclim") which, despite only being used by a few people, works quite well (I'm using it and getting the best of both world and for when I do really need to something inside that piece of underperforming bloat that Eclipse is, I can just switch to it in a heartbeat). But anyway, even without these Eclipse bridges, if you do really think that someone using, say, Visual Studio to develop C# code is more productive than a programmer using Emacs to develop Clojure code I'd like to have some of the stuff you're smoking because it looks good ; ) To me the biggest issue with Eclipse / Visual Studio / IntelliJ is that their "text editor" part is really terrible. In addition to that, programmers do craft tools to make their life easier : to me it's only logical that a programmer would want to be able to program his editor. I suggest to take a look at the "Emacs rocks!" series on YouTube to get a feel of what's possible using Emacs. To me a good example of a productive programmer using Emacs would be Rich Hickey. He created the Lisp dialect Clojure and then he went on to create an amazing DB (Datomic) using Clojure. He knows about productivity... Now of course if you're stuck in the C#/NHibernate/SQL hell working on apps full of mutability and where it's close to impossible to reproduce state, I do understand why you feel Visual Studio would be better. But I do really your ability to "move fast" compared to people using more advanced technologies and who are not stuck in the "design pattern" / ORM mindset...
- hmart 14y agoI love Peepcode screencasts, the Vim series is great, They should release a Sublime Text one. Meanwhile this TutsPlus free course about ST2 http://net.tutsplus.com/articles/news/perfect-workflow-in-sublime-text-free-course/ http://net.tutsplus.com/articles/news/perfect-workflow-in-su...
- gits1225 14y agoI have tried watching a couple of peepcode videos, but at some point, sooner or later, I invariably fall to sleep no matter how interesting the topic they present is. Somehow the videos feel lifeless and monotonous. Maybe its just me, but thats been my experience.
- kayoone 14y agoAs long as my programmer idols Carmack and Persson use Visual Studio and Eclipse respectively to produce amazing stuff, i dont really care about changing to vim/emacs...besides i work mostly in statically typed languages anyway, so i would miss alot of the IDE features for refactoring.
- yen223 14y agoNot enough credit is given to Visual Studio's Autocomplete feature. It seriously is unmatched, and to me is one of the reasons why C# is very pleasant to work with.
- Derbasti 14y agoExcept when you're not coding C#. Then it ranges from somewhat usable to utter lunacy.
- octopus 14y agoHave you tried VS2012 ? Give it a try for C++ and you will see that the autocomplete works great.
- Derbasti 14y agoI did try it. It is certainly better than before. That is, it's usable now. Nowhere near Eclipse/Java, XCode/Ocj-C or VS/C#, though. Usually, I tend to ignore it more often than I actually find it useful. Even some simplistic look-for-common-words-in-open-buffers in regular text editors works better in my experience. That said, add Visual Assist X and it's a different ball game.
- tbirdz 14y agoJust use clang_complete with vim
- xradionut 14y agoAlso have you tried the PowerShell 3 ISE?
- welp 14y agoFor some more modern auto-complete functionality in vim, clang_complete is worth a look: https://github.com/Rip-Rip/clang_complete https://github.com/Rip-Rip/clang_complete. It uses clang for intelligently auto-completing C and C++, and I am constantly surprised that more people haven't heard of it.
- michaelfeathers 14y agoI hardly ever use 'delete word' because I use 'change word' so much.
- sejje 14y agoMuch agreed. When I used delete word it's an accident ~70% of the time.
- jlgreco 14y agoI use it fairly often in combination with cw. 'dwcw' is easier for me than '2cw'. One character longer but on QWERTY it is slightly easier, and it has a sort of repetition anyway.
- clarkm 14y agoYeah, I think that both 'change word' and either the 'change inner word' or 'change a word' ('ciw' and 'caw', respectively) should have been included. I find myself using the last two modifiers much more often than 'change word' by itself. I hope that's not a symptom of inefficient vim usage.
- goldfeld 14y agoThe other day I was thinking about how Sublime Text's Ctrl+P's great usability could be extended to more use cases, and I began wondering, 1. Why doesn't it already index on the function names (the ones you get to by pressing @), so that I could find a file not by it's name or path, but by it's function definition (and with less priority, by it's function use)? 2. Why doesn't find in files work with the same usability, even if the match would not be as instant? Having an overhead box and the file auto open in the buffer as it matched would be a great improvement over what seems like a set in stone standard of opening a new dialog/file to display the find in files results. If anyone knows of settings, plugins or even other editors I can get for these features, I'd be in heaven.
- scrumper 14y agoGood article, I feel rather foolish for not knowing the delete whole words stuff; I have the feeling it's going to be a big step up in productivity for me. There's project-wide fuzzy opening in Xcode too: bind "Open Quickly" to whatever you like (I use cmd+O). It has the same fuzzy searching as Sublime Text (for example, gvcm will take you straight to your GridViewController) but builds on it can take you straight to symbols if you want.
- netghost 14y agoI have to say, I really enjoy TextMate's autocomplete word. It's not fancy, but it saves me tons of time. Also, not listed there, but TextMate's autocomplete word can also be used with [Shift - Esc] for the reverse direction.
- iamjs 14y agoFor vim users, Gary Bernhardt's vimrc has a nice little snippet to map the tab key to perform completion if the cursor isn't at the beginning on a line. https://github.com/garybernhardt/dotfiles/blob/master/.vimrc#L126 https://github.com/garybernhardt/dotfiles/blob/master/.vimrc... You use tab for completion in so many other contexts, it's nice not to have to break that habit in your editor.
- cocoflunchy 14y agoA few missing things from Sublime users: Ctrl/Cmd + P is even better than fuzzy search in Sublime; it searches in all the files that are contained in opened folders. Automatic indentation is also available without plugin, though you have to add a key binding: { "keys": ["ctrl+shift+r"], "command": "reindent" , "args": {"single_line": false} } or look for it in Edit > Line > Reindent. Completion works with Tab too on Sublime.
- darkgray 14y agoST2 can also delete entire words: Ctrl+Del (ahead) Ctrl+Backspace (behind) Ctrl+Del even works in Notepad, if that's your thing.