Out-of-the-box features/packages I like:
- Default powerline is cool
- "guide-key" package: as you may know, Emacs is based on successions of key bindings to call a function, guide-key tells you what key binding you can do next. Example: "SPC p" is the prefix for most "projectile" (project explorer package) commands, so guide-key shows you what keys you can press and its associated function/subgroup. I think it's the best way to learn your key bindings!
- (from vanilla Emacs, enhanced with Helm) M-x: call a function. While it doesn't seem impressive, EVERY ACTION is a function in Emacs! You can call "evil-next-line" (even if it's now really useful) or "set-default-font", and with Helm you can search in real time what you want. If I want to create a table in org-mode: "M-x org cre" brings "org-create-table". No need to remember the function full name!
- org-mode: Think of it as an editor for all non-code tasks. I personally do my graded homeworks in it and then exporting these in latex/pdf. "C-c C-e l o" <- export file in latex, generate pdf and open. Really quick to do!
Final words: happy to have switched to Emacs, I don't really miss my Vim environment because there are a lot of alternatives out of the box in Spacemacs (thanks to the good integration of Evil).
BTW, I still use Vim to do quick edits in the terminal, solely because Emacs takes more time to boot :)
Now, you can do `emacsclient -nw <file>` to boot up with almost no startup time. I have vi aliased to this, and `emacs -nw --daemon` opened by launchctl.
A gotcha: If you change your emacs config and need to restart, be sure to `pkill emacs` to get rid of the daemon.
alias e="emacsclient -t -a ''"
alias ec="emacsclient -c -n -a ''"
alias emacsbare="emacs -nw -Q --eval \"(load-theme 'misterioso)\""
e/vim/vi launches a terminal-mode client for the Emacs daemon, which only takes a split-second if the daemon is already running. If the daemon isn't running, it gets started automatically by virtue of the empty string being passed with the -a flag, per the man page for emacsclient.
ec launches a "gui-mode" (X/quartz) client for the daemon, which is started automatically if isn't running, same as before.
A note: I' be careful though, because depending on how you create your variables, thing can go wrong, I guess: if you-re going to use eval-buffer on your whole .emacs, I'd better use, for example, add-hook instead to add-to-list:
(add-hook c-mode-hook 'linum'mode)
(add-to-list c-mode-hook 'linum-mode)
(add-hook 'c-mode-hook 'linum-mode)
And in many cases, using just the terminal isn't enough because there are quite a few quirks when using emacs in the terminal, the most recent one I found was that <shift><tab> is interpreted as M-[.
I wish there was some way to fix this. :(
I agree that it would be nice if it could be configured/made to disappear.
I use terminal-mode emacsclient on my Mac all day everyday, and `C-h k` shows <shift+tab> is interpreted as <backtab>. That's the case for Terminal.app and iTerm2, though I only use the latter. I'm not sure why yours interprets it as M-[.
the gtk version crashes the emacs server when X exits, see: https://bugzilla.gnome.org/show_bug.cgi?id=85715
Well, I just tried it literally for a few seconds and just stumbled over the not working text objects.
I really like things like e.g. 'ci(' or 'dat'.
But it always seems like this if I'm trying a vim emulation.
You'll want to add "evil-surround" for dat
I found little or no disfluencies in the keybindings/text objects etc and I use them extensively. Though you'll want to add some of the core emacs keys to your repertoire as many of them have no natural vim alternative.
't' is for html tags so pressing 'cit' anywhere on '<width>280</width>' will do what you're expecting. :)
The Sublime/TM/Notepad++ crowd cares about OS-native integration. I use Sublime frequently because after a solid decade+ living in OSX land, my fingers know how what to do, and neither vim nor emacs respect that without considerable massaging.
Vim fans want to use an elegant command syntax. I watch vim users code and always make a point to learn how to vim, eventually. The only reason I don't, is because I haven't.
Emacs users want/need the programmable, extensible runtime. Emacs is a programming language; particularly in Lisp development, Emacs often contains programs that are basic/standard parts of the toolchain and not found in other editors. I use Emacs because I like it, but more importantly, because I have to.
Combining the elegant syntax of Vim with the extensibility of Emacs, as well as some out-of-the-box support for the basic OS-native commands, is a very good start.
I like the design of Emacs, and I also like Lisps in general, but the Vim editing model is the best for me.
It looks like Neovim is going to address many of the issues with Vim.
That said, growing your editing system by evaluation a small function is still a bliss. Go lisps.
Vim's editing model is much more functional (a la functional programming) than Emacs', whereas the latter's foundation is much more functional.
I keep thinking I should try Emacs with one of the Vim-ulators, but I've got a pretty good flow going in Vim and I've got a lot of other things I'm trying to learn right now, not to mention paying work to do.
vi objects feels a lot like lazy partial application with sane defaults: effect <| (move or stay) <| (count or 1)
Furthermore, neither emacs nor vim are hard to learn. There's a widespread myth perpetuated both by novices and elitists that it's an all or nothing kind of thing. The reality is that even in vim you can use arrow keys and mouse/trackpad scrolling and ignore hjkl if you want. You could, for example, use terminal vim every single day and use only about 5.5 vim-specific commands: i, ctrl-c, :w, :q / :q!, and ZZ. With gvim or macvim, you could reduce that to two: i and ctrl-c.
C-a, C-e, C-n, C-p, C-k, C-y (kill yank not quite the same)
Edit: C-f and C-b too
Edit 2: Just checked and word is not one of these programs :(
Then I found Spacemacs a couple weeks ago and switched. I had an equivalent environment set up in a few days.
Now I'm moving forward with the ability to do almost anything I want, and all of Vim's warts gone.
Vim really is a shitty editor with an awesome UI on top.
Emacs is a completely configurable, actually good editor. Now with Vim's awesome UI.
But this is absolutely perfect (either for transition, or for someone like me that just wants to try a transition but does not know where to start).
Thanks for sharing. Beautiful work. :)
Among the problems and warts:
- The Spacemacs doc is on their repo, not in Emacs! (except if you manually fire a buffer with SPC f f ~/.emacs.d/doc/DOCUMENTATION.md)
- Emacs has an interactive interface for editing configuration variables. You will arrive to this interface from the Emacs doc, but it does not have Spacemacs-like keybindings and I'm not even sure it's supposed to work with Spacemacs
- I could not find the doc for ex/vim commands. I suspect there is no equivalent to ":h :foo"
- In vim, it is possible from any mode to get back to the normal mode by typing 'ESC'. In Emacs, C-g aborts a keybinding. However those two are not unified by Spacemacs.
- I use vim with several buffers. However launching "emacsclient -t foo.txt bar.txt" will open them sequentially, and I can not use :n / :N to go back and forth.
- The fact that there are several interactive interfaces for switching buffers and/or opening files is confusing. Typing a file-name in helm-mini creates a "fundamental" buffer that is not a file. I lost some work because of this.
If there were just one or two of these warts and inconveniences, I would get use to them or fix them, but right now there are a little too much. That said, the premise is really attractive, so I can only hope these problems will get fixed over the years so that I can go back to it someday.
You can explore the doc for each layer by "SPC f e h". You can even jump to source from there.
> - Emacs has an interactive interface for editing configuration variables. You will arrive to this interface from the Emacs doc, but it does not have Spacemacs-like keybindings and I'm not even sure it's supposed to work with Spacemacs
Everything that works in stock Emacs should work in Spacemacs. Stock Emacs key bindings are always there. Spacemacs stuff, as its name implies, is in the SPC key.
> - I could not find the doc for ex/vim commands. I suspect there is no equivalent to ":h :foo"
I think it should exist. Maybe you need to ask the gitter chatroom. Stuffs like s/foo/bar works for me. However, even NeoVim wants to remove it: https://github.com/neovim/neovim/issues/1089
> - In vim, it is possible from any mode to get back to the normal mode by typing 'ESC'. In Emacs, C-g aborts a keybinding. However those two are not unified by Spacemacs.
You do it with evil-escape: https://github.com/syl20bnr/evil-escape, which is built-in Spacemacs by default and press "fd to escape everything. You can change it to anything you want.
> - I use vim with several buffers. However launching "emacsclient -t foo.txt bar.txt" will open them sequentially, and I can not use :n / :N to go back and forth.
The next version you can use "SPC b n" and "SPC b p" to go back and forth. However, you can use "SPC b s" to switch between buffers and press "C-c o" to open another window side by side. To split window, use "SPC b -" to create a window below and "SCP b /" to create a window right. Jump to each window based on the number on its modeline, i.e. "SPC 1" jumps to window 1, "SPC 2" to jump to window 2.
> - The fact that there are several interactive interfaces for switching buffers and/or opening files is confusing. Typing a file-name in helm-mini creates a "fundamental" buffer that is not a file. I lost some work because of this.
It's a feature. It means that when you switch to a non-existent buffer, you can press RET to create it. It's quite handy to create a scartch buffer of a specific major mode. If you want to open a file, don't use a command that open buffer but a command that open files. I believe in Vim I can create empty buffers.
But does it offer an access to the main docs? When I type "spacemacs" in there I get an empty README.md.
> Everything that works in stock Emacs should work in Spacemacs. Stock Emacs key bindings are always there
Yep, but I'm not an Emacs user so I do not know them!
> I think it should exist.
Well, you can try :h for yourself...
> However, even NeoVim wants to remove it: https://github.com/neovim/neovim/issues/1089
They are talking about removing Ex mode, not ex commands!
> I believe in Vim I can create empty buffers.
I don't believe in Vim you get an easy way to create a buffer that has a name that is not a filename...
- It completely takes over emacs. Your modifications now go in ~/.spacemacs. Don't touch ~/.emacs.d/ Want to install something from melpa? Make a spacemacs configuration layer. That aspect feels like a strong step away from the emacs ethos where you're on the same footing as the editor authors. I don't like the inversion of control.
- It's unstable. Fairly often I'll update and something will fail, leaving me helplessly with emacs keybindings. Thankfully, a revert is easy.
- The last one is a problem with evil in general, you'll still occasionally find yourself in emacs mode, where hjlk and more importantly ":q" don't work
What I (and I believe most vim users) like about vim is not the software itself, but the concept and ideas behind it: the modal editing, the movement commands, the composability of them, etc.
But the truth is that Emacs is, for lots of usages, better software. It's more extendable, has more features, it's even better written.
So using Emacs with a vim-friendly UX seems like a great idea.
I switched to Evil and Emacs last year.
The combination of Vim and Emacs is a much better Vim.
org-mode is life changing.
In general I've found that the plugins in the Emacs environment make more sense and simply work better then Vim equivalents.
But for a less selfish reason, our team usually does pair programming and we often pair program, each with our own computer connected through a shared tmux session. Because most people on the team prefer Vim, we have standardized on that which is really hard for new people on the team who have no experience with modal editors. Having a compromise where both people can use the same editor without forcing people to one paradigm or the other would be fantastic.
Having said that, I tried out Evil mode a few years ago and it fell pretty widely from the mark for an advanced vi user (not just Vim). It had basic support, but if you did any of the complicated stuff that makes vi efficient, it didn't really work. Some people in this thread are saying that this has improved substantially so I'm really looking forward to trying it.
That said, vim with neobundle, unite, fireplace, rainbow parens, vim-sexp, vim-repeat, vim-surround, and one of the many tmux integrations makes for a good enough clojure dev experience.
If you want Unite equivalent, check Helm which is created before Unite and is still actively maintained. See one of Helm package demo: http://tuhdo.github.io/helm-projectile.html. The same for rainbow-parentheses. Actually, Emacs got something better than rainbow-parentheses for visual aiding parentheses: https://github.com/syl20bnr/spacemacs/issues/1173
For proper sexp manipulation, check this guide with great animations: http://danmidwood.com/content/2014/11/21/animated-paredit.ht...
For Clojure, in Emacs you got a debugger than can step expression by expression: http://endlessparentheses.com/cider-debug-a-visual-interacti...
If you want to know features for Clojure that already configured in Spacemacs, check its Clojure documentation: https://github.com/syl20bnr/spacemacs/tree/master/contrib/la...
You got all IDE features like refactoring and jump to symbols
Here are some nice features that Emacs and its 3rd packages provide:
- Powerful automatic indentation with aggressive-indent: https://github.com/Malabarba/aggressive-indent-mode(scroll down for demos). It does not only indent the current line, but the whole semantic context around your cursor.
- Live grep:http://tuhdo.github.io/static/live_grep.gif
- C/C++ refactoring with built-in parser: https://github.com/tuhdo/semantic-refactor/blob/master/srefa...
- Lisp Code reformatting: https://github.com/tuhdo/semantic-refactor/blob/master/srefa...). As far as I know, there's none Lisp code reformatting outside of Emacs.
- Access to a list of project with a few key strokes: http://tuhdo.github.io/static/helm-projectile/helm-projectil...
- Quickly access any file in your project, as large as Linux kernel, instantly, regardless of where you are in the project, and within a few keystrokes: http://tuhdo.github.io/static/helm-projectile/helm-projectil...)
- Jump to any file depends on context, even if the file path is in a plain ASCII text file: http://tuhdo.github.io/static/helm-projectile/helm-projectil...
- Copy files from anywhere to anywhere: http://tuhdo.github.io/static/helm-projectile/helm-projectil...)
- Delete files anywhere; files are always at your finger tip to do whatever with them: http://tuhdo.github.io/static/helm-projectile/helm-projectil...
- Switch between other files with same names but different extensions: http://tuhdo.github.io/static/helm-projectile/helm-projectil...). Work not only for C/C++ but other languages, and is customizable. You don't have to configure anything, like adding include paths for the command to search. Everything is automatic. Just use it as it is.
- Jump to tag definition, from its own parser or external parser like GNu Global: http://tuhdo.github.io/static/c-ide/helm-gtags-jump-dwim.gif
- Jump up to parent: http://tuhdo.github.io/static/c-ide/senator-go-to-up-referen...
- Do you like outline tree?: http://tuhdo.github.io/static/c-ide/sr-speedbar.gif
- Interactive outline tree: http://tuhdo.github.io/static/c-ide/helm-semantic-or-imenu-w...
- Easily move back and forth using the interactive outline tree: http://tuhdo.github.io/static/part3/helm-semantic-or-imenu-2...
- References retrieved from its Emacs internal parser: http://tuhdo.github.io/static/c-ide/semantic-symref.gif
- Beautiful compile output: http://tuhdo.github.io/static/c-ide/compilation-compile.gif
- Frontend support for GDB: http://tuhdo.github.io/static/c-ide/gdb-many-windows.gif
- Code completion: http://tuhdo.github.io/static/c-ide/semantic-boost-demo.gif
- Open man page for symbol at cursor: http://tuhdo.github.io/static/part3/helm-man-woman.gif
- Emacs open 39MB C file: http://tuhdo.github.io/static/performance.gif
- Emac opens multi-gigabtye file: http://www.emacswiki.org/emacs/VLF
Note that in the demos you may see me type in the commands. You can think of it like the start menu in Windows, but actually those commands can be executed quickly with a shortcut. I type in the commands for demonstration purpose to Emacs users.
Those demos are just tip of the iceberg.
I actually switched to Spacemacs, for largely the reasons you mentioned (everything is there, but easier to extend and largely better).
I was merely pointing out that vim with some plugins is good enough to get serious work done in Clojure, even though getting access to real refactoring libraries, a debugger, etc in my editor would be welcome.
The one problem I have with Emacs is that vim-sexp is and was much much much much better than paredit. Treating forms as text objects and letting you use regular vim motions to select text objects before slurping/barfing/etc is a move forward. It wasn't exactly obvious to me how to duplicate this with Spacemacs/VIM, but I also had work to do so I just went with the Spacemacs paredit bindings.
So, could you be more specific about how vim-sexp works? If you want to visual select sexp from symbol and expanding outward, uses expand-region: https://github.com/magnars/expand-region.el. Same for string. Then you can use smartparens: https://github.com/Fuco1/smartparens to wrap around by simply pressing "(". It is all in Spacemacs now, and you can explore further with evil-lisp-state commands, bound to ", k".
This is actually an open problem in evil/emacs at the moment.
Would be nice to sort out.
My workflow starts from command-mode and is heavily dependent on it. It's far more crucial than any hjkl stuff and whatever. The first thing I tried was :tabnew. "Uknown command: `tabnew`." Then I tried to use :cd and while it has such a command it works in some weird way which I couldn't figure out how to use on the first attempt. I guess it actually has everything I need, but I probably entered something wrong and suddenly ended up using scp, lol.
While editing some text file without any real purpose I surprisingly didn't find anything that would be working in an unexpected way yet. Maybe it's worth trying it out.
:cd runs the Emacs cd function which behaves differently than Vim's :cd.
To get the equivalent of :tabnew, you'd have to use :buffer [name] and give the new buffer (Emacs's equivalent of tabs) a name.
You can switch between buffers with :switch-to-buffer, :ido-switch-buffer, :b, :bn, and :bp. It's not the same as tabs though.
However, `SPC b s` also doesn't what I was looking for. It opens a buffer, not a tab (which I'm not sure are supported in Spacemacs at all, which would be a critical hit). And it doesn't even look for them in the cwd, but does I-haven't-figured-out-what-yet instead.
If you are wondering why that SPC stuff isn't the equivalent to command-mode with ":" bound to SPC: commands are easy to define even in vim, they can have descriptive names due to their nature and I don't have to remember them, as I can use auto-complete! For example, I have :Rename and :Remove. Actually, I don't even remember if it's :Remove or :Delete, I just use autocompletion every time I need it and find out.
If you are looking for workspaces i.e. organizing buffers into logical group, use Perspective: https://github.com/syl20bnr/spacemacs/tree/master/contrib/pe....
> And it doesn't even look for them in the cwd, but does I-haven't-figured-out-what-yet instead.
As another commenter suggested, you can use :cd. However, you can use a better interactive interface and use "SPC f f" or "SPC f h". Spacemacs is, after all, Vim + Emacs.
Emacs has that kind of visual tabs but Spacemacs does not integrate it since it gets in the way more than being useful.
> If you are wondering why that SPC stuff isn't the equivalent to command-mode with ":" bound to SPC: commands are easy to define even in vim, they can have descriptive names due to their nature and I don't have to remember them, as I can use auto-complete! For example, I have :Rename and :Remove. Actually, I don't even remember if it's :Remove or :Delete, I just use autocompletion every time I need it and find out.
That kind of auto-complete is really bare. If you want something like that, try pressing "SPC :" or "Alt-x" in Spacemacs. You can search in any order you like, not prefix, i.e. if you look for command "list-package", either "list pa" or "pa list" gives you the command.
I mean, in Vim, to get help for a key binding, I have to type something like "Ctrl+W". Really? In Emacs, you get it by pressing "C-h k" then press the key binding you don't know which command is bound to it. You even get a cheatsheet like style in Emacs. For example, if you don't know what the commands in "SPC f" does, simply press "SPC f ?" and you get an interactive cheatsheet that you can easily narrow donw. Press "C-z" to open its description.
Well, I didn't find how to make do without it yet, so I would rather stick with the word "critical" for now.
> "SPC :" or "Alt-x"
Oh, that's pretty neat. Actually, still not the same thing as command mode, because it seems there's some convention to chose the command first, and after pressing Enter passing any arguments interactively. Not that it's bad, but a bit different from how it's generally done in shells.
> I have to type something like "Ctrl+W". Really?
Really? Uhm, no, not really. Actually you have to type :map (as in "key map"), and if you don't know what to type you type in :h whatever.
What is "make do"? Do you mean running make? Btw, Spacemacs can do the same with the feature I listed above. The different is just it doesn't display the tab by default and only show you when you need it. That said, if you want to try, open .spacemacs file, search "dotspacemacs-configuration-layers" and add "perspectives" (without double quotes) below any layer there. Then, use "SPC L s" to switch between "tabs" (the default one is "@spacemacs". Enter a non-existent name and you have a new "tab". The "tabs" are collections of related buffers. If you create any new buffer, it is local in an active "tab" only.
"SPC L n" to go to next "tab".
"SPC L p" to go to previous "tab".
"SPC L k" to close current "tab".
"SPC L a" to add a buffer to current "tab".
> Oh, that's pretty neat. Actually, still not the same thing as command mode, because it seems there's some convention to chose the command first, and after pressing Enter passing any arguments interactively. Not that it's bad, but a bit different from how it's generally done in shells.
Well you need to forgo Vim for awhile and concentrating on Spacemacs way. Then going back and compare.
> Really? Uhm, no, not really. Actually you have to type :map (as in "key map"), and if you don't know what to type you type in :h whatever.
That's not the same thing. Try pressing "Control-h k", then press "SPC b s" you will get a command that is bound to the key binding. If you want similar thing to ":map", then press "C-h b" to show the interactive cheatsheet. If you are in a major mode, it shows all the key bindings belong to that major mode first and foremost, than maps of other modes (such as minor modes) below.
It's an idiom. http://dictionary.cambridge.org/dictionary/british/make-do
I use Vim a lot less now: still have a simple .vimrc laying around for just-in-case.
* Toggling if search results should be highlighted (:set hls, :set nohls)
* Opening the filename under the cursor in a new window (^W f)
Completely emulating an entirely different editor is very, very difficult :-(
I applaud everyone contributing to these projects, and hope they continue to improve! They've already come a very long way from evil, and viper-mode.
After you search, you get persistent highlighting. To turn it off, "SPC s c". All the toggling features are in "SPC t" group.
> * Opening the filename under the cursor in a new window (^W f)
`SPC f h` then press `C-c o`. The key bindings are consistent in other Helm commands as well. It opens a window side by side. Nothing is misisng, sorry. Spacemacs can even do things like [these](http://tuhdo.github.io/helm-projectile.html).
If you have any question, ask it on Spacemacs chatroom: https://gitter.im/syl20bnr/spacemacs
They are keybindings my fingers reach for everyday without thinking about it, similar to how I use j, k, h, l without thinking about it.
Does anyone know any tips or references for total emacs newbies trying to jump into spacemacs head first?
There could be a problem with a new feature (from maybe yesterday?, the day before?) that allows users to pick between emacs and vim keybindings.
Does this support configs in my .vimrc?
Can I use Vim plugins in it?
> Can I use Vim plugins in it?
Evil Mode exposes Emacs using a Vim interface. It's doubtful that it will ever run Vim plugins or read your .vimrc (particularly because it will not support things like autocmd or VimL). There are many ports of Vim plugins to Emacs for use with Evil. For example, evil-leader brings support for leaders (Spacemacs makes heavy use of this with <Space> as the leader, hence the name). There are also many things in the Emacs world that Vim doesn't really have, like flycheck or a decent hex editor (I've used vim + xxd, but Emacs' hex editor is nicer).
EDIT: It's not a drop-in Vim replacement in the way that NeoVim is. It just brings modal editing and your Vim muscle memory to working in Emacs.
Is this one really, ACTUALLY a good vim substitute? Or do I have to relearn a ton of stuff just to get to the same level of knowledge and comfort I have with Vim?