Live data from Hacker News

Intero for Emacs: complete interactive development program for Haskell

commercialhaskell.github.io

31–40 of 75 posts

Re: Intero for Emacs: complete interactive development program for Haskell

#31
post #5

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?

Follow the tutorial! It's really really good. 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 t…

Macros combine great with another amazing feature: registers. Hit C-x C-k b [0-9] and the macro can be called with C-x C-k [number chosen]. This way you can quickly use multiple macros. You can also C-x C-k n NAME to save the macro as a callable function and if you then decide that it would be useful in the future, just call insert-kbd-macro and emacs will generate the lisp code that defines your macro and you can put that in your init.el.

Re: Intero for Emacs: complete interactive development program for Haskell

#32

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 can…

For python, I use hippie-expand mostly, but https://www.masteringemacs.org/article/jedi-completion-libra... does good auto-completion.

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.

Re: Intero for Emacs: complete interactive development program for Haskell

#33
post #10

Earlier quoted context omitted.

I don't know NixOS, but this blog post and lecture might help you give emacs a fair trial: 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.

Unfortunately those instructions failed out of the gate at this command in .emacs: (require 'package) The error I get is: File error: "Cannot open load file", "package". I installed emacs on OS X using: $ brew install emacs But it looks like version 24.5 on OS X El Capitan doesn't come with something called 'package.el'. Oh well, back to Vim..

Are you sure that you launched the correct emacs? (`M-x version RET` in Emacs to check) This is an extremely common error for people using the built-in version which, as of El Capitan, is still Emacs 22.1 (almost 10 years old).

Re: Intero for Emacs: complete interactive development program for Haskell

#34
post #33

Earlier quoted context omitted.

Unfortunately those instructions failed out of the gate at this command in .emacs: (require 'package) The error I get is: File error: "Cannot open load file", "package". I installed emacs on OS X using: $ brew install emacs But it looks like version 24.5 on OS X El Capitan doesn't come with something called 'package.el'. Oh well, back to Vim..

Are you sure that you launched the correct emacs? (`M-x version RET` in Emacs to check) This is an extremely common error for people using the built-in version which, as of El Capitan, is still Emacs 22.1 (almost 10 years old).

Ack, you're right! I installed it, added a symlink to the head of my path, but forgot to open a new terminal so continued using the old hashed path.

Edit 10 minutes later: Ok, it's installed now. And I've set this up in my .zshrc:

  -alias vi=vim
  +alias vi=emacs
Let's see how this goes.

Re: Intero for Emacs: complete interactive development program for Haskell

#35
post #5

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?

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.

Re: Intero for Emacs: complete interactive development program for Haskell

#36
post #5

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 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 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.

Re: Intero for Emacs: complete interactive development program for Haskell

#37
post #8
post #5

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?

Map command key to caps lock. Setting (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).

I forgot about that. Caps lock is useless 99% of the time and having that control available easily with your left pinky makes emacs (and everything else) work.

I'm so confused when I get on other people's computers and caps lock is actually caps lock.

Re: Intero for Emacs: complete interactive development program for Haskell

#38

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 can…

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.

Re: Intero for Emacs: complete interactive development program for Haskell

#39
post #36
post #5

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 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 - o…

C-s works for text ahead if you want to search backwards it's C-r . This confuses a lot of people so I guess it's worth mentioning.

Re: Intero for Emacs: complete interactive development program for Haskell

#40

Earlier quoted context omitted.

Follow the tutorial! It's really really good. 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 t…

Macros combine great with another amazing feature: registers. Hit C-x C-k b [0-9] and the macro can be called with C-x C-k [number chosen]. This way you can quickly use multiple macros. You can also C-x C-k n NAME to save the macro as a callable function and if you then decide that it would be useful in the future, just call insert-kbd-macro and emacs will generate the lisp code that defines your macro and you can pu…

Third person I see running last macro with C-x e. In my setup, and I think it's standard, repeating f4 is enough.
Post reply on HN