I saw this notice on Reddit early yesterday morning and ended up using Intero for most of the day. Love it! There are a lot of improvements over and above the Emacs Haskell mode. I really like how fast it is to control-c-l and be put n the correct module and be running in seconds. I also like the realtime syntax error hints, type information, etc.
There should be a warning that on first start of intero-mode, this will initiate a rather long stack operation, which I suppose is extra long if you hadn't used stack before. Also, it seems to insist on a stack'ised project. But I suppose one could say that should be obvious. I use cabal because stack misses some features and is a little weird and use stack when I have to. And even though I have intero installed and in $PATH, when opening an actual project with a stack file, it start building intero. Weird automatism.
This was a trade-off I went with. One thing that I learned from years of hacking on haskell-mode is that adding an option for every little decision adds up to a brittle user-experience. If you want this, enable that. If you want to enable that, install this. And so on. A survey showed that most people used about 20% of the features available in haskell-mode.
In the case of Intero I made every decision for the user; there are no customization options in the mode, and it leads to long (first-time) start-ups like this. But in the end I'd rather wait a minute and have every project always work reliably (and this isn't unheard-of for IDEs). It does build a version of intero for each project environment, because the GHC version and package set may differ. This is in contrast to e.g. ghc-mod or hdevtools which is locked to a specific GHC version, so switching between projects is not smooth.
You are correct about the initial first time build delay, and it is done for each separate project. After playing with Intero on one of my stack based projects, I took the background time effort to pre-build all of my projects while exercising. Then, there is no delay (until I start a new project).
Stack has changed my development workflow, in a very positive way, and I love Intero (at least in the first 24 hours of use).
This looks great! My only complaint is that sometimes I do want to work on a quick script outside of a stack environment, and this seems like an all-or-nothing proposition. (I use haskell for pandoc filters quite a bit, for example, and setting up stack for that seems like overkill.) I'm sure a bit of elisp could make it fall back to haskell mode if it can't find a local .stack dir.
If there's no stack.yaml it uses the global ~/.stack/global/stack.yaml.
So you should be able to open any random file and it'll work out. E.g. if I open ~/X.hs and import Lucid, I can just run stack build lucid in my ~/ and now M-x intero-restart and it has access to that package.
I've been waiting for this release before finally trying to switch from Vim (MacVim) to Spacemacs. Anybody have any tips for somebody who's never really used Emacs?
I'm not using Spacemacs, but rather Evil mode in Emacs. I think the biggest thing I would caution is to expect small things to be different. For example underscores are word boundaries in Emacs. File selection is different. Some modes do not have vi key bindings set up by default. Escape doesn't always work to abort (you need to get used to pressing ctl-g). Omni complete is absent and completion in Emacs works quite differently. Searching through files and sorting through compilation errors works quite differently. I think that's most of the issues I've run into.
It took me about a month to get everything set up the way I wanted it and to get used to it. With Spacemacs, I imagine that things will generally be set up, but that it will take longer to get used to because it is pretty opinionated about things like leader keys. Right now my set up is good enough that if I accidentally run vim instead of emacs, it takes me about 15-20 minutes before I realise it (normally when I try to update an org mode file ;-) ).
My biggest advice is to take the transition slowly. Use Emacs/Spacemacs until you get annoyed with it and then put it away for a while. Eventually you will start to get used to Emacs-isms (like ctl-g) and Vim will start to annoy you. At that point cut over entirely.
One thing that's really annoying is that when you are modifying your .emacs/init.d file, it's easy to get it into a bad state. At that point Evil and also probably your theme won't be set up properly. So you have to fix everything using emacs keystrokes. I used emacs for 20 years before I switched to vim and even still it seems I am no longer able to use vanilla emacs ;-)
One you get it set up and are used to it, though, it works surprisingly well. For me the absolute biggest advantage to emacs is Org mode and I basically can't give it up now. Good luck on your switch!
My experience was very straightforward. It's easy to configure for most scenarios if you follow the documentation and use any of its layers (see https://github.com/syl20bnr/spacemacs/tree/master/layers). Most Vim key bindings work beautifully. For be its best feature is how discoverable it is.
Every command has a name, and you can do M-x and type in that name, with tab completion, if you forget the keyboard shortcut. Even better, you can enable ido-mode and install ido-vertical-mode, and see a list of possible command completions without pressing tab.
I also highly recommend remapping your caps lock key to control.
Turn on god-mode. It turns off e.g. the arrow keys and the delete key, forcing you to use the movement keys and keybindings for deleting word, character, etc. It'll yell at you in the minibuffer with the command you SHOULD have hit, so you'll know. It builds the muscle memory super quickly.
Keyboard macros are dope. My keys are bound to f3 and f4 but I don't remember if that's standard. Basically you hit f3 to open a macro, do some stuff, and then hit f4 to close it. Then you hit C-x e to execute it from the point, and hit e repeatedly to keep executing it. Super convenient. As an example, you might make a macro where you move the point to the beginning of the line, deletes 2 characters of whitespace, then moves to the next line. But you gotta be careful it's actually gonna do what you want; you'll get better at this over time. You generally have to imagine the point exists at a random point in a line, and find how to get it to where it needs to go, before you're able to do the real work of the macro.
Get Projectile. It's fantastic for navigating projects. It binds its key prefix to C-c p, and binding ANYTHING to C-c whatever is frowned upon heavily, so be aware of that. Doing things like project wide searches (C-c p s s) is super fast, and makes navigating codebases manageable.
I LOVE Helm. It's a huge departure from vanilla emacs, so know that going into it. That said, I love what it does. Basically you have a minibuffer chilling at the bottom of the screen above the normal minibuffer, and it is usually hidden until activated. Then when you activate it (e.g. in the projectile search) it shows the results of the operation in the helm minibuffer. http://tuhdo.github.io/helm-intro.html is a good intro to it.
But really, pay attention to what you like and don't like about everything. Then find things that scratch your itches. I really encourage you to start from vanilla emacs, bringing in packages as you find you need them, so you fall onto your own unique, special editor, built just for you. That said, I sort of understand the appeal of starting with a config that's curated for you already. Though if you decide to make your own configs, use-package is fantastic for managing the complexity of it all. Emacs is a wonderful editor, and you're in for a wonderful experience. You just have to be willing to put up with some annoyance before you make it your own. As a datapoint, it took about a month and a half when I started using it to get it behaving the way I wanted. It's still a thing I tinker with occasionally, especially when I venture into a new language, but I leave it alone most of the time.
I had used IDE's, windows based text editors like UltraEdit, and vi/vim for the longest time before I decided it was time to go back to Emacs. I dedicated two weeks to using it almost exclusively to pick up the muscle memory of major keybindings. I haven't looked back since.
The keys I really needed out of the gate:
* F3/F4 - building macros, then C-x e to execute (after that, just plain e)
* C-s - search
* M-s o - occur (you define a regular expression, it lists all the lines that match it, so something like `def (` for python functions
C-v/M-v - page up/page down
* C-f/C-b - forward and back character
* M-f/M-b - forward and back word
* C-/ - undo
* M-w - copy
* C-y - paste
* C-o - open new line
* M-z - zap-to-character (try it, it's awesome)
* C-M-e / C-M-h - beginning/end of function
* C-a / C-e - beginning/end of line
* C-l - center window on cursor
* C-[space] - mark cursor / unmark cursor
* C-d/M-D - delete char/word
* C-k - kill line
* M-/ - autocomplete word (works in any file, any language, and cycles through suggestions on repeated calls)
...
Those and then getting yasnippet installed and working was probably the most important plugin. It's real simple templates for any language and there are a lot of decent default ones. (so for instance, you type html, then tab and it'll build a basic html file for you and put your cursor in the <head> tag, or def, then tab and you have a structured function definition and your cursor stops where the name goes, tab again it puts it in the parameters, tab again, docstring, tab again, coding area).
If you dedicate two weeks to it, you'll begin to see the power that everyone talks about. The first day or two will be frustrating because even the basics I just listed are a pain to remember out of the gate, let alone have the muscle memory to do without thinking.
I wish I could get a similar utility for Python and Javascript as this seems to show off some cool FP auto complete.
I'm basically looking for a way to remove my dependency on my 5-7 IDEs and I don't know how. I wish someone could show me a very good, simple, alternative to all of them. I work in C, Java, JavaScript, Python, PHP, and C# and I'd like to be able to use a single IDE solution for all of them. Sadly I cant find anything with good auto completion and nice features (like things offered by Eclipse).
This has some really promising features, I've got to say I'm amazed.
For javascript, I use js2-mode for syntax highlighting. I haven't ever tried js3-mode, but I understand it does better indentation. ac-js2 does autocomplete for js2-mode. You can throw in web-beautify as well - https://github.com/yasuyk/web-beautify
For many languages, I use yasnippet as well. Yasnippet rocks.
Languages like C# and Java (especially) are painful to use without code completion. The modern style of explicit imports in Java in particular simply can't be reasonably maintained without IDE support.
For everything else, emacs works fairly well. I find myself requiring code completion in languages like C and C++ a lot less, because I edit slower and more carefully, but also C and C++ codebases tend to have fewer random dependencies than Java and C# make it easy to add.
As far as python is concerned, if you mostly care about code navigation and autocompletion, try jedi-mode, it's fast, leightweight and works pretty well (I've used it successfully with virtualenv and conda, although the later required me to manually pip install epc-server and jedi and maybe one or two other deps). If you want refactorings, you're out of luck (rope is not even alpha quality, and I don't know of anything else). But firing up your IDE every few days or weeks for a bigger refactoring might be acceptable.
Javascript has js2-refactor, but I haven't tried that.
Lastly, instead of having 5-7 IDEs you could just get an Intellij license – it can basically do all that more specialized offerings like Webstorm and Pycharm can, and it's unlikely you'll ever have similar semantic support in a plain editor. I'm currently using emacs exclusively myself, but have also used products of the intellij family extensively, and might do so again depending on the project. The javascript livecoding and mixed-language-fragment support is pretty neat for example.
For C++, I use https://github.com/abingham/emacs-ycmd which gives completion (uses company-mode) and code navigation. It can also do C, C#, js, go, python etc. Requires a little setup (you have to install the ycmd daemon and, depending on language, a per-project conf file), but worth it.
An alternative to ycmd is https://github.com/Andersbakken/rtags which I think can list all usages of a symbol – ycmd only lets you go from usage to definition. I like how ycmd.el runs the ycmd daemon for me though.
> I wish I could get a similar utility for Python and Javascript as this seems to show off some cool FP auto complete.
Since neither Python not Javascript is "as typed" as Haskell there are limits to what you can expect.
That said, I'm mostly happy with "elpy" in Emacs. Just make sure you configure it for the same version of Python you are targetting, and the rest should work out of the box.
as an emacs distro, spacemacs has everything I need for every language I've tried to work with (usually with auto-completion e.t.c.). sometimes requires a tiny bit of setup (usually no more a than a line or two) first time you use a new langauge, but that should is usually documented in the layer/README.org file.
I'm a emacs convert from vim (big reason is because module support is just leagues ahead of vim, Vundle, Pathogen, or anything else don't come close to emacs package management). A huge reason why I stuck with it is because evil. evil is very mature and is incredibly close to vim, some say it's a better vim than vim.
I tried a lot of "vi modes" in several IDEs but none of them cut it, you can map anything to evil and you can, of course, map commands to different states. Something I found very usefil is that you can even set states for different buffers, for example, for magit buffers (another amazing emacs module and a very good reason to use emacs) I default those to "insert" mode.
I haven't used Intero myself, but I've yet to find any kind of conflict between evil or any other module.
It didn't "just work (TM)" for me, I had to customize the intero-package-version in my .emacs when using it with a project with the latest stack-nightly, to bump it up to "0.1.16".
But other than that, wow! I was already very happy whenever I could get ghc-mod and haskell-mode to work, but this takes the responsiveness to a whole different level.
Very nice! But is there currently no way to get any information about third party code other than the type signature (C-c C-t or C-C C-i)? Ideally I'd like to be able to both navigate to the source code and see the documentation.
It might also be good to mention that you need to apt-get install libcurses5-dev for the haskell code to build.
I confess I have similar thoughts when I look at things that are getting reinvented all over the place. I have come to feel this is actually a counterproductive thought. Exploring in obscure tools is the definition of tinkering exploration. Which is often a big driver in pushing progress. (Same for reinvention.)
[+] [-] mark_l_watson|9 years ago|reply
[+] [-] cm3|9 years ago|reply
[+] [-] chrisdone|9 years ago|reply
In the case of Intero I made every decision for the user; there are no customization options in the mode, and it leads to long (first-time) start-ups like this. But in the end I'd rather wait a minute and have every project always work reliably (and this isn't unheard-of for IDEs). It does build a version of intero for each project environment, because the GHC version and package set may differ. This is in contrast to e.g. ghc-mod or hdevtools which is locked to a specific GHC version, so switching between projects is not smooth.
[+] [-] mark_l_watson|9 years ago|reply
Stack has changed my development workflow, in a very positive way, and I love Intero (at least in the first 24 hours of use).
[+] [-] psibi|9 years ago|reply
[+] [-] jesserosenthal|9 years ago|reply
[+] [-] chrisdone|9 years ago|reply
So you should be able to open any random file and it'll work out. E.g. if I open ~/X.hs and import Lucid, I can just run stack build lucid in my ~/ and now M-x intero-restart and it has access to that package.
[+] [-] avindroth|9 years ago|reply
[+] [-] pash|9 years ago|reply
[+] [-] mikekchar|9 years ago|reply
It took me about a month to get everything set up the way I wanted it and to get used to it. With Spacemacs, I imagine that things will generally be set up, but that it will take longer to get used to because it is pretty opinionated about things like leader keys. Right now my set up is good enough that if I accidentally run vim instead of emacs, it takes me about 15-20 minutes before I realise it (normally when I try to update an org mode file ;-) ).
My biggest advice is to take the transition slowly. Use Emacs/Spacemacs until you get annoyed with it and then put it away for a while. Eventually you will start to get used to Emacs-isms (like ctl-g) and Vim will start to annoy you. At that point cut over entirely.
One thing that's really annoying is that when you are modifying your .emacs/init.d file, it's easy to get it into a bad state. At that point Evil and also probably your theme won't be set up properly. So you have to fix everything using emacs keystrokes. I used emacs for 20 years before I switched to vim and even still it seems I am no longer able to use vanilla emacs ;-)
One you get it set up and are used to it, though, it works surprisingly well. For me the absolute biggest advantage to emacs is Org mode and I basically can't give it up now. Good luck on your switch!
[+] [-] kiliancs|9 years ago|reply
[+] [-] twblalock|9 years ago|reply
I also highly recommend remapping your caps lock key to control.
[+] [-] _asummers|9 years ago|reply
Turn on god-mode. It turns off e.g. the arrow keys and the delete key, forcing you to use the movement keys and keybindings for deleting word, character, etc. It'll yell at you in the minibuffer with the command you SHOULD have hit, so you'll know. It builds the muscle memory super quickly.
Keyboard macros are dope. My keys are bound to f3 and f4 but I don't remember if that's standard. Basically you hit f3 to open a macro, do some stuff, and then hit f4 to close it. Then you hit C-x e to execute it from the point, and hit e repeatedly to keep executing it. Super convenient. As an example, you might make a macro where you move the point to the beginning of the line, deletes 2 characters of whitespace, then moves to the next line. But you gotta be careful it's actually gonna do what you want; you'll get better at this over time. You generally have to imagine the point exists at a random point in a line, and find how to get it to where it needs to go, before you're able to do the real work of the macro.
Get Projectile. It's fantastic for navigating projects. It binds its key prefix to C-c p, and binding ANYTHING to C-c whatever is frowned upon heavily, so be aware of that. Doing things like project wide searches (C-c p s s) is super fast, and makes navigating codebases manageable.
I LOVE Helm. It's a huge departure from vanilla emacs, so know that going into it. That said, I love what it does. Basically you have a minibuffer chilling at the bottom of the screen above the normal minibuffer, and it is usually hidden until activated. Then when you activate it (e.g. in the projectile search) it shows the results of the operation in the helm minibuffer. http://tuhdo.github.io/helm-intro.html is a good intro to it.
But really, pay attention to what you like and don't like about everything. Then find things that scratch your itches. I really encourage you to start from vanilla emacs, bringing in packages as you find you need them, so you fall onto your own unique, special editor, built just for you. That said, I sort of understand the appeal of starting with a config that's curated for you already. Though if you decide to make your own configs, use-package is fantastic for managing the complexity of it all. Emacs is a wonderful editor, and you're in for a wonderful experience. You just have to be willing to put up with some annoyance before you make it your own. As a datapoint, it took about a month and a half when I started using it to get it behaving the way I wanted. It's still a thing I tinker with occasionally, especially when I venture into a new language, but I leave it alone most of the time.
[+] [-] Steeeve|9 years ago|reply
The keys I really needed out of the gate:
* F3/F4 - building macros, then C-x e to execute (after that, just plain e)
* C-s - search
* M-s o - occur (you define a regular expression, it lists all the lines that match it, so something like `def (` for python functions
C-v/M-v - page up/page down
* C-f/C-b - forward and back character
* M-f/M-b - forward and back word
* C-/ - undo
* M-w - copy
* C-y - paste
* C-o - open new line
* M-z - zap-to-character (try it, it's awesome)
* C-M-e / C-M-h - beginning/end of function
* C-a / C-e - beginning/end of line
* C-l - center window on cursor
* C-[space] - mark cursor / unmark cursor
* C-d/M-D - delete char/word
* C-k - kill line
* M-/ - autocomplete word (works in any file, any language, and cycles through suggestions on repeated calls) ... Those and then getting yasnippet installed and working was probably the most important plugin. It's real simple templates for any language and there are a lot of decent default ones. (so for instance, you type html, then tab and it'll build a basic html file for you and put your cursor in the <head> tag, or def, then tab and you have a structured function definition and your cursor stops where the name goes, tab again it puts it in the parameters, tab again, docstring, tab again, coding area).
If you dedicate two weeks to it, you'll begin to see the power that everyone talks about. The first day or two will be frustrating because even the basics I just listed are a pain to remember out of the gate, let alone have the muscle memory to do without thinking.
[+] [-] optimali|9 years ago|reply
(global-set-key (kbd "M-P") 'scroll-down-line)
(global-set-key (kbd "M-N") 'scroll-up-line)
Has also been indispensable for scrolling (though you may choose to do so differently, coming from vim).
[+] [-] gravypod|9 years ago|reply
I'm basically looking for a way to remove my dependency on my 5-7 IDEs and I don't know how. I wish someone could show me a very good, simple, alternative to all of them. I work in C, Java, JavaScript, Python, PHP, and C# and I'd like to be able to use a single IDE solution for all of them. Sadly I cant find anything with good auto completion and nice features (like things offered by Eclipse).
This has some really promising features, I've got to say I'm amazed.
[+] [-] Steeeve|9 years ago|reply
Flycheck handles syntax issues for many languages, including Python. https://github.com/flycheck/flycheck
For javascript, I use js2-mode for syntax highlighting. I haven't ever tried js3-mode, but I understand it does better indentation. ac-js2 does autocomplete for js2-mode. You can throw in web-beautify as well - https://github.com/yasuyk/web-beautify
For many languages, I use yasnippet as well. Yasnippet rocks.
[+] [-] barrkel|9 years ago|reply
For everything else, emacs works fairly well. I find myself requiring code completion in languages like C and C++ a lot less, because I edit slower and more carefully, but also C and C++ codebases tend to have fewer random dependencies than Java and C# make it easy to add.
[+] [-] patrec|9 years ago|reply
Javascript has js2-refactor, but I haven't tried that.
Lastly, instead of having 5-7 IDEs you could just get an Intellij license – it can basically do all that more specialized offerings like Webstorm and Pycharm can, and it's unlikely you'll ever have similar semantic support in a plain editor. I'm currently using emacs exclusively myself, but have also used products of the intellij family extensively, and might do so again depending on the project. The javascript livecoding and mixed-language-fragment support is pretty neat for example.
[+] [-] mdadm|9 years ago|reply
Out of curiosity, have you tried the relevant JetBrains IDE(s)?
[+] [-] unhammer|9 years ago|reply
An alternative to ycmd is https://github.com/Andersbakken/rtags which I think can list all usages of a symbol – ycmd only lets you go from usage to definition. I like how ycmd.el runs the ycmd daemon for me though.
[+] [-] josteink|9 years ago|reply
Since neither Python not Javascript is "as typed" as Haskell there are limits to what you can expect.
That said, I'm mostly happy with "elpy" in Emacs. Just make sure you configure it for the same version of Python you are targetting, and the rest should work out of the box.
[+] [-] _asummers|9 years ago|reply
[+] [-] mijoharas|9 years ago|reply
[0] https://github.com/syl20bnr/spacemacs
[+] [-] seagreen|9 years ago|reply
+ Stick with NeoVim and hope one of the Intero ports to that editor takes off (as I understand it there are a couple right now)
+ Switch to Emacs+Evil+Intero. I've never used Emacs before (even with Evil) so it would be a little work.
If someone more up-to-date on the situation has advice that would be awesome:)
[+] [-] xdc55|9 years ago|reply
I tried a lot of "vi modes" in several IDEs but none of them cut it, you can map anything to evil and you can, of course, map commands to different states. Something I found very usefil is that you can even set states for different buffers, for example, for magit buffers (another amazing emacs module and a very good reason to use emacs) I default those to "insert" mode.
I haven't used Intero myself, but I've yet to find any kind of conflict between evil or any other module.
[+] [-] endgame|9 years ago|reply
http://blog.aaronbieber.com/2015/05/24/from-vim-to-emacs-in-... https://www.youtube.com/watch?v=JWD1Fpdd4Pc
One of my vim-using coworkers found it. He, along with another colleague, have since found emacs compelling enough to use as their main text editor.
[+] [-] jonahx|9 years ago|reply
[+] [-] oggy|9 years ago|reply
But other than that, wow! I was already very happy whenever I could get ghc-mod and haskell-mode to work, but this takes the responsiveness to a whole different level.
[+] [-] patrec|9 years ago|reply
It might also be good to mention that you need to apt-get install libcurses5-dev for the haskell code to build.
[+] [-] icc97|9 years ago|reply
[+] [-] pjmlp|9 years ago|reply
[+] [-] miguelrochefort|9 years ago|reply
[deleted]
[+] [-] taeric|9 years ago|reply
I confess I have similar thoughts when I look at things that are getting reinvented all over the place. I have come to feel this is actually a counterproductive thought. Exploring in obscure tools is the definition of tinkering exploration. Which is often a big driver in pushing progress. (Same for reinvention.)
[+] [-] ams6110|9 years ago|reply
[+] [-] iand675|9 years ago|reply