Emacs as an editor (as opposed to VIM) [closed] - vim

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I recently started using emacs as an everyday environment, half because I always wanted to gain the perspective of "the other side," and half because I'm forced to at work :P. Its been a week and I can definitely see the advantages of using emacs and what it means to "live inside emacs." The buffers are very convenient and just the ability to search through the buffer as if it is an editor is amazing. Emacs has been my "shell" since the day I started it last week.
However, when it comes to editing code, I am still not convinced that I should use emacs as opposed to vim. I don't know if it is because I am too used to vim, but with emacs to move around text I always need an extra key, such as 'M-f' instead of 'w,' or 'C-f' instead of 'l'. Is this just a learning curve that I have to overcome?
I am not trying to start a flame war, I would just like some perspective. Thanks!

I started with vim but left it many years ago for emacs. I can say that it took me much longer to be converted to the baseline editing interaction (key combinations, non-modal, etc.) than it did to recognize the value of "living inside emacs," as you say. So my advice would be to actually do the emacs tutorial (C-h t, yes it's worth it) to be sure you're really using the full power of emacs' baseline editing interactions, and give it a month to see if you're converted organically. If not, then give each vim-mode and viper a try. If you're still not converted then do your code editing in vim. :-)
But the most salient point here is do not jump to vim-mode or viper, give it a good long while to see if you can enjoy emacs editing interaction without introducing more emacs add-ons which might have weird interactions with other emacs add-ons.

One thing that distinguishes vi (and gvim and nvi and all the other vi clones) is that it's modal. That means that when you're not in edit mode, you can use single letters as commands. Other editors, like emacs, don't have modes, so a single letter with no modifier is usually just inserted into the buffer. That's why commands in emacs need to have modifiers.

Related

Is vim already good enough for programming clojure? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I've used vim for a pretty long time and I'm still happy with it.
I started to learn clojure 6 months ago. It seems that emacs is the first choice for lispy language programming.
But I would rather learn something else than spend a lot time on learning how to use an editor which is not obviously superior to vim.
So I struggled to make my vim setup more suitable for clojure programming.
What I'm now using is:
vim-clojure-static, which provides basic syntax highlighting
paredit, which provides structural edit on s-expression
vim-fireplace, which can talk to a remote repl within vim
I also use vim-redl, redl to get a debug repl, but IMO the three above can already provide quite pleasant coding experience.
My question is, am I still missing some killer features of the emacs working flow?
Is emacs better for clojure/lisp development? Yes, it is. Can you do without it, of course. I used vim for Clojure development but I switched to emacs a couple of months ago and I'm very glad I did. Personally I find it a much better experience. The vim plugins probably have matured a bit in the meantime but vim has some serious limitations with regard to external processes and so on. I had some general vim plugins I really loved but luckily they all had alternatives for emacs.
Couple of things worth mentioning:
I use Evil mode. Like Tom mentioned it's a vim emulation layer. It's extremely good. I don't miss anything from vim. Text objects, all the vim modes etc are supported. Personally I can't remember all the strange emacs keybindings, they drive me nuts. Without Evil I wouldn't be using emacs. I created evil keybindings for paredit and some other plugins and you basically have vim on steroids. I only use vim for quick edits now.
Customizing Emacs was the hard part. I love Emacs now but I wouldn't know what to do without my customized Emacs config. Once you tweak everything to your liking it's very hard to go back to anything else. It took me a long time to get to that point though. Check https://github.com/otijhuis/emacs for my personal emacs config if you want to try it. It still needs a little work and I'm no Emacs guru but it works really well for Clojure development. It might be a good starting point.
I'd like to point to the upcoming vim-sexp, by the maintainer of vim-clojure-static:
vim-sexp
Precision Editing for Symbolic Expressions
This plugin provides mappings, operators, and text objects for Lisps including Clojure.
I don't use Clojure myself, so I can't tell for sure, but the plugin looks very promising and is under active development.
The reason Lispers tend to like Emacs is that Emacs is a lisp machine. If you're already familiar with the language family and its tendencies, it's really convenient to be able to use it for extending your editor.
From my own (admittedly Common Lisp, rather than Clojure) workflow, I like having autocomplete, argument hints, and the SLIME macroexpander. I'm pretty sure you can get each of these for vim, so don't stress too much about what everyone else is using.
As a note, if you haven't already, look into slimv and this article on setting it up with Clojure. I haven't used it myself, not being a vim user, but it seems close enough.

Do I save time using the h, j, k, l keys? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I've tried using the h, j, k and l keys for a while in Vim, but did not get used to it and fell back to using the arrow keys. My question is: from your experience, is it worth switching to these keys? Did you achieve faster typing/navigating?
When I first used Vim, it seemed very difficult to stick to hjkl after years of maintining a habit of navigating with arrow keys.
Then I learned actual touch typing.
After that, not only did hjkl feel more natural than the arrow keys. Everything computer-related became faster. It's really worth the investment timewise (I'm assuming you're not a touch typer, otherwise you wouldn't have asked this question).
By the way, Vim is incredibly useful when learning to touch type. Just keep a keyboard diagram closer to the screen than to the actual keyboard when learning, ideally a keybord diagram with vim usage on it.
IMHO, no, it's not worth the trouble. I've tried it, and I couldn't get used to it either.
The whole point of those using those keys was that most keyboards, at the time of Vi's creation, did not have arrow keys. I've yet to run across a modern keyboard without those keys.
I could be wrong.
I like it. Having discovered visual mode used with f/F and t/T could cut and replace so quickly, easy access to ; became necessary. And you can go straight to . with the 3rd finger too.

Why don't more people use emacs with viper-mode? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 12 years ago.
I've started to use emacs, and I've found out that while the editor-specific features of emacs are better than those of vi, the text-manipulation methods of vi are better than those of emacs (and easier on your control-pinky!).
It seems that viper-mode, a marriage of the two best parts of each editor, is the ideal solution for someone that wants a complete editor.
But before I start investing my time learning the vi commands in the emacs environment, I'd like to know why it doesn't seem like many people use viper-mode. Is there something I'll find out after using it a while that will cause me to switch to plain emacs or vi?
Because you are either a vi person or an emacs person. The same way you're either a dog person or a cat person.
On a more serious note, why would I change? vi offers me all the power I need and I'm pretty certain the emacs people would feel the same way about their editor of choice.
I've used vi for over twenty years and some of its features still surprise me (admittedly, it's usually vim rather than vi nowadays). I don't want to dedicate the next twenty years of my life at becoming adept with emacs. There's no benefit and plenty of cost, and pretty much all of my non-minor decisions are subject to cost/benefit analyses.
Mostly, it comes down to what you're comfortable with. It took years for me to stop trying to use the WordStar 3.3 CTRL-K CTRL-X key sequence to exit from most editors. It had burnt itself into my spinal cord so that all the brain had to do was issue an exit command and the lowest levels of the nervous system would take over.
And, anyway, emacs with its strange command sequence like
CTRL META LEFTSHIFT RIGHTSHIFT WINDOWS OPENAPPLE ALT K
is better suited to aliens with 87 fingers, or elite pianists :-)
People who want vi-like usage use vi, people who want Emacs-like usage use Emacs.
I think you get some vi people moving to Emacs to get functionality like org-mode (or some other "killer" functionality that doesn't exist in vi). And those people probably use viper-mode to ease the transition.
Regarding the actual question of "is there something I'll find out..." - everybody is different. Maybe viper's lack of C-o command (do one command and go back to insert mode (or something like that)) is just too painful to not have. Or, maybe you'll find that the allure of not having to switch between command and insert modes is attractive and go for straight Emacs.
I think the benefit of viper-mode or vimpulse is that it makes the learning curve for vi-users is negligible for 95% of what you'll do. But you have the possibility of using the other parts of Emacs that you can't get in vim (whatever those things are that you find attractive).
I "get" vim, that is a massive investment. I get vimscript, that is another massive investment. I have no desire to learn the wildly complex internals of another editor and the intricacies of emacs-lisp, especially since the only thing I would really want there that I can't have here is better repl support.
Also, viper is nowhere near enough. vimperator comes close, but nothing beats vim.
Because I don't want vi, I want vim with syntax highlighting.

Good guide on VIM Scripting? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I've used VIM for 10+ years, but never really into VIM scripting (always subjectively beliving that this was one area where VIM was weaker than Emacs).
Recently, the realization "in a VIM script, I can execute normal mode commands" made my mind go "a-ha" and suddenly start realizing why parts of VIM script is the way it is.
normal ma10jd'a20kp
is much more elegant than
Marker m = currentLocation();
advanceLines(10);
Buffer b = delete(currentLocation(), m);
advanceLines(-20);
insertBuffer(b);
Now question is -- what's a good resource to learn vim scripting from?
Thanks!
The best advice I can give is that you read:
:help usr_41.txt
which will give you a good overview of the basics. Then find some things that you want to do and create functions for them. While you're doing this, make heavy use of:
:help function-list
to get an idea of what all the built in functions are. Most of it is fairly similar to other scripting languages (albeit a harsher syntax), so any experience you have of text manipulation in python or whatever will be useful.
Also, look on the vim scripts page and Google to get examples of existing scripts to help expand your knowledge.
Finally (and probably most importantly), don't be afraid to ask on stackoverflow or the Vim mailing list and there'll be plenty of support for any problems you may have.
Learn Vimscript the Hard Way is worth checking out too.
http://learnvimscriptthehardway.stevelosh.com/
Al gave you a good answer. I'd also add vim.wikia that has a few tips related to your question.
On a side note.
I wouldn't say that ma10jd'a20kp is more elegant. I see the following problems:
it's quite difficult to maintain (what if the number of lines shall become a parameter?),
people like to override keys they never learned to use (this could be fixed with a banged :normal!),
some normal-mode commands have strange behaviour on side-case (like <esc> when the cursor is on the first column),
it messes the mark a, and the unnamed register -- other scripts, or even the user may expect their values to not be altered by your script.
I'm in a similar situation. It's still on my "to read" list, but I just found Scripting the Vim editor today. The articles from IBM's DeveloperWorks are usually very good, so probably worth checking out.

VimL Script language: are there any implementations in other languages? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
Problem: One of my favorite aspects of Vim is its flexibility. One of my least favorite is the VimL script language itself. I know everyone has his or her own preference for languages and editors, so I take it for granted that not everyone agrees with me.
Question: If you are a Vim user, and if you have had a similar disaffection for using VimL to extend vim, what alternatives have you used in order to extend Vim while avoiding the default language? I am looking for ideas that may help beyond what I've already tried, including, but not limited to:
recompiling vim with the add-on support for python, ruby, and perl (nice, but it does not help when I am running vim on someone else's machine without that support added in)
never writing a line of VimL script and simply download preexisting add-ons (great, if and only if the existing stuff does exactly what you want it to, not so great if you have to make a change and end up having to look at more VimL script)
Disclaimer: Note, this is not a slam against VimL script or anyone's preferences. If it works great for you, that's great! I'm just asking those who have found a need for an alternative, and a way to fulfill that need to their satisfaction.
Update: This question was updated with a request for specific references to specific tools. No discussion, debate, polling or extended discussion is needed. If there exists a specific tool, please feel free to reference it.
see e.g., https://github.com/luke-gru/riml
I love vim but hate VimL. So I have been trying emacs with the evil plugin. It's a vim-like mode, but with all the benefits of emacs plugins and emacs-lisp as a scripting language. Mostly a win. (It's not 100% like vim — for example, $ isn't a special line column like it is in vim — but close enough.)
Most likely whatever fits your development ecosystem. ie a language you're likely to use outside just vim itself as it has helpful support libraries
I personally used +python in this trac plugin
http://www.vim.org/scripts/script.php?script_id=2147
after extensively using and learning from this awesome debugger script...
http://www.vim.org/scripts/script.php?script_id=1929
As far as working on other machines usually you just live without stuff for small jobs. but you can always use netrw for scp etc if needed..
but really it's whatever you want to learn and can use
There are no alternatives, if we disregard the ones you mentioned.
While in Vim you can use VimL
If you wish to program in Python/Perl/Ruby you can find yourself a pre-made binary, or build Vim to include support for it, and then use one of those, as many people do
you can download plugins, as you said, but more and more of them require support for one of the above (which are often found on *nix boxes, so it's really not that much of a problem)
you can use either one of the above, or other *nix tools outside Vim, but that has no longer anything to do with Vim
I think that covers it.

Resources