• Stars
    star
    987
  • Rank 46,382 (Top 1.0 %)
  • Language
    Shell
  • License
    MIT License
  • Created almost 11 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

One-line Haskell Vim install

Build Status

Haskell Vim IDE


In less than ten minutes your Vim will transform into a beautiful Haskell paradise. (Don't worry, it backs up your original configuration to ~/.config/haskell-vim-now/backup/.vimrc.yearmonthdate_time.) It also builds all necessary support binaries including ghcide, hlint, hoogle and more.

No more wading through plugins trying to make them all work together. In ten minutes you will have a fully functional Vim that looks great and lets you

  • inspect types
  • evaluate Haskell
  • lint and check
  • manipulate tags
  • hoogle lookup
  • pointfree refactor
  • tab complete
  • unicode symbols
  • highlight DSLs
  • work with git

Installation

Just download and run the installer:

curl -L https://git.io/haskell-vim-now > /tmp/haskell-vim-now.sh
bash /tmp/haskell-vim-now.sh

WARNING: this command, once successful, will make backups and remove your existing VIM configurations (.vim, plugins etc). You can later customize HVN configurations.

Keybindings and commands

The commands are organized into logical groups to help you remember them.

Types, autocomplete, refactoring, and linting

<Tab>Autocomplete with words in file
<C-space>Autocomplete with symbols in your Cabal sandbox
,hrApply one refactoring hint at cursor position
,hRApply all refactoring suggestions in the file
,hlRun Haskell linter on file
,hcRun Haskell compile check on file
,<cr>Clear type selection

Hoogle

,hhRun Hoogle on the word under the cursor
,hHRun Hoogle and prompt for input
,hiRun Hoogle for detailed information on word under cursor
,hIRun Hoogle for detailed information and prompt for input
,hzClose the Hoogle search window

GHCI repl

If you open a tmux terminal alongside MacVim then you can send Vim selections to it. This works well for evaluating things in GHCI.

,rsSend selected text to tmux
,rvChange tmux session, window, and pane attachment

Git

,g?Last-committed files (Monday morning key)
,gsGit status (fugitive)
,ggGit grep
,glGit log (extradition)
,gdGit diff
,gbGit blame

Commenting

gcComment / Uncomment selection

Aligning

,a=Align on equal signs
,a,Align on commas
,a|Align on vertical bar
,apAlign on character of your choice

Splits and find file

,<space>Fuzzy file find (CtrlP)
,fToggle file browser, find file
,FToggle file browser
,sjOpen split below
,skOpen split above
,shOpen split leftward
,slOpen split rightward

Buffers

,bpPrevious buffer
,bnNext buffer
,b<space>Buffer fuzzy finder
,bdDelete buffer, keep window open (bbye)
,boClose all buffers except the current one

Misc

,maEnable mouse mode (default)
,moDisable mouse mode
,igToggle indentation guides
,uInteractive undo tree
,ssEnable spell checking
,eOpen file prompt with current path
,<cr>Clear search highlights
,rRedraw screen
C-hMove cursor to leftward pane
C-kMove cursor to upward pane
C-jMove cursor to downward pane
C-lMove cursor to rightward pane (redraw is `,r` instead)
gqFormat selection using `hindent` for haskell buffers (`par` for others)
,yYank to OS clipboard
,dDelete to OS clipboard
,pPaste from OS clipboard

(If you prefer to restore the default screen redraw action of C-l then add unmap <c-l> to your vimrc.local)

Customizing

After installing this configuration, your .vimrc and .vim will be under version control. Don't alter these files. Instead, add your own settings to ~/.config/haskell-vim-now/vimrc.local.pre, ~/.config/haskell-vim-now/vimrc.local.

Adding Vim Plugins

Haskell-Vim-Now uses vim-plug to install plugins. It uses the following vim configuration structure to determine what to install:

call plug#begin('~/.vim/plugged')

" The plugins are named in github short form, for example:
Plug 'junegunn/vim-easy-align'

" All plug statements must be between plug#begin and plug#end
call plug#end()

However the .vimrc file in Haskell-Vim-Now is under version control so you shouldn't edit it directly. To add a plugin what you should do is add Plug statements to ~/.config/haskell-vim-now/plugins.vim. When ready reload .vimrc and run :PlugInstall to install plugins.

Neovim support

The .vimrc configuration is fully compatible with Neovim, and adds a few Neovim specific mappings for the terminal mode (terminal emulation is activated with :terminal). The mappings make Esc and c-[hjkl] function as one would expect them to from normal mode.

The Neovim configuration is found at .config/nvim, and is symlinked just like regular vim, which means you should only add your own settings to ~/.config/haskell-vim-now/vimrc.local.pre, ~/.config/haskell-vim-now/vimrc.local and ~/.config/haskell-vim-now/plugins.vim.

You can quickly backup and replace your Neovim setup by running the scripts/neovim.sh script.

Docker image

If you are into developing with Docker, you can use the image.

docker pull haskell:7.8
docker build -t haskell-vim .
docker run --rm -i -t haskell-vim /bin/bash

If instead you want to extract the vim setup from the image that is easy enough

docker build -t haskell-vim .
mkdir ~/.haskell-vim-now
cd ~/.haskell-vim-now
docker run --rm haskell-vim tar -cz -C /root/.haskell-vim-now . > haskell-vim-now.tgz
tar -xzf haskell-vim-now.tgz

However, some things (for example the hoogle database) use absolute paths and don't work correctly.

Advanced install methods

Basic install

In case you want to skip the haskell specific components and want to install just the common vim config you can use:

bash <(curl -sL https://git.io/haskell-vim-now) --basic

Installing from a fork or clone

If you have a modified fork you can use the --repo option to tell the install script the location of your repository:

bash <(curl -sL INSTALL-SCRIPT-URL) --repo FORK-URL

For example:

bash <(curl -sL https://raw.githubusercontent.com/begriffs/haskell-vim-now/master/install.sh) --repo https://github.com/begriffs/haskell-vim-now.git

Additionally the --branch argument can override the default of master used when cloning the repo.

If you have a local git clone you can use install.sh directly to install from your clone:

install.sh --repo CLONE-PATH

Installing in Nix build environment

Use --nix parameter, in case you want to execute stack installation in nix-shell

bash <(curl -sL https://git.io/haskell-vim-now) --nix

Troubleshooting

See this wiki page for tips on fixing installation problems.

Thank you!

Big thanks to contributors. I'd especially like to thank @SX91 for rewriting the installer and for other major improvements.

More Repositories

1

css-ratiocinator

because your CSS is garbage
JavaScript
1,027
star
2

angular-paginate-anything

Γ€ la carte server-side pagination
JavaScript
517
star
3

lucre

Let people pay you for any or no reason.
Ruby
506
star
4

heroku-buildpack-ghc

Deploy Haskell apps to Heroku
Shell
272
star
5

pg_rational

Precise fractional arithmetic for PostgreSQL
PLpgSQL
229
star
6

objgrep

Find strings inside complicated javascript objects
JavaScript
160
star
7

immutube

Youtube + functors, a most unlikely combo
JavaScript
141
star
8

pg_listen

Trigger shell command from NOTIFY
C
83
star
9

gitftp

Browse git over anonymous FTP
C
82
star
10

mimedown

markdown to multipart mime
C
79
star
11

c-mix

Demo of C project with Haskell functions
C
77
star
12

microservice-template

Basic architecture for running and monitoring workers
Shell
70
star
13

postgrest-example

Migrations for an example conference API
PLpgSQL
70
star
14

styleguide_rails

generate a living styleguide with one command
JavaScript
69
star
15

libderp

C collections. Easy to build, boring algorithms. Dumb is good.
C
45
star
16

haskell-pair

Haskell pair programming server via Vagrant
Shell
41
star
17

react-showpiece

Eminently styleable markup
CSS
37
star
18

obsd

Redacted config files
Vim Script
36
star
19

clean_pagination

API pagination the way RFC7233 intended it
Ruby
33
star
20

vimrc

An old plugin-heavy vim config (I do things differently nowadays)
Vim Script
31
star
21

algorithm-freezer

Know your algorithms cold!
Haskell
29
star
22

utofu

Unicode Trust on First Use (TOFU)
C
28
star
23

haskell-circle-example

Exemplary Stack-based template for Circle CI
Haskell
16
star
24

groupthink

obey the masses with realtime voting
JavaScript
15
star
25

autolytics

An embarrassment of analytics riches
12
star
26

wc

Beating haskell with C
C
11
star
27

haskell-postgres-examples

A cookbook for Postgres in Haskell
Haskell
10
star
28

picobounce

Experiment to build an IRC bouncer out of independent programs connected by named pipes. Only half done.
C
8
star
29

mother-structures

Programming via abstract math
CoffeeScript
8
star
30

randln

Fast, flexible, portable way to get random lines out of files
C
6
star
31

lexyacc

Learning to parse
Lex
6
star
32

dumbus

🚌 Hyperefficient bus planning for dumbphones
Haskell
6
star
33

aeson-t

Transform JSON
Haskell
6
star
34

libc

Implementing the C standard library
C
5
star
35

posix-man

Man pages for POSIX (sections 0,1,3; issues 6 and 7)
Roff
5
star
36

clache

Run Lazy K programs in the cloud
Ruby
5
star
37

aws_pipes

AWS queues Γ  la Unix
Ruby
5
star
38

libscorm

Create SCORM 2004 courses in Flash or HTML
JavaScript
5
star
39

findrss

Search (un)common paths to find the Atom or RSS feed of a site
Shell
5
star
40

lancelot

Your knight in shining ASCII armor
Haskell
4
star
41

sinatra-sql

Easy PostgreSQL access with migrations in Sinatra
Ruby
4
star
42

generator-omni-module

Write JS modules that run everywhere
JavaScript
4
star
43

micro-scraper

Microservice to download pages
Haskell
4
star
44

wchar-conformance

Test ISO 10646 conformance of wchar_t
C
4
star
45

ordinary

Transfinite arithmetic in Ruby
Ruby
4
star
46

kr

Quick 'n dirty K&R exercises
C
3
star
47

incl

Preprocessor to include files into output stream
C
3
star
48

philosoraptor

Logic programming in JavaScript
3
star
49

qwertywords

Words that are fun to type like figment ajangle
C
3
star
50

jsobject

Nicer JavaScript objects through ExternalInterface in ActionScript 3
ActionScript
3
star
51

itertools

Python itertools for Ruby
Ruby
3
star
52

turing

There are many like it, but this one is mine
C
2
star
53

float

Experiments in number representations, a collaboration with Eric Bavier
C
2
star
54

endoxa-graph

everything's connected, man
JavaScript
2
star
55

doublekill

Weird experiments with signals
C
2
star
56

twittective

Some screen scraping in Haskell
Haskell
2
star
57

quickcheck-simple

Project template for doing Haskell exercises
Haskell
2
star
58

angular-http-batch

Leap multiple $http requests in a single bound
JavaScript
2
star
59

retags

Keep ctags up to date with minimal overhead
Shell
2
star
60

pthread-test

Exercises from Butenhof's book
C
2
star
61

semln

Filter to add semantic line breaks in many languages
C
2
star
62

hasql-stress

Trying to reproduce deadlock
Haskell
2
star
63

git-zophrenic

Finds the secret government messages in your Git hashes
Shell
1
star
64

stalk27

When will route 27 actually arrive? No more lies.
Shell
1
star
65

jvscrpt

Drop the function arguments and write less code
JavaScript
1
star
66

multiparse

Drafts for my parsing article
Yacc
1
star
67

ringfifo

Nonblocking multi-use named pipes
C
1
star
68

begriffs.com

my site
CSS
1
star
69

CopernicusJS

A revolution in CSS positioning
JavaScript
1
star
70

angular-patience

Efficiently wait for long server processing
JavaScript
1
star
71

flexicode

Tools scanning Unicode in Flex
C
1
star
72

stm32f411

STM32F4 (STM32F411CEU6) "black pill" development with non-proprietary tools
C
1
star
73

scheme48hrs

Write yourself a Scheme in 48 hours exercises
Haskell
1
star
74

getclojure-ui

A front-end for devn/getclojure
Ruby
1
star
75

apue

Advanced Programming in the UNIX Environment
C
1
star
76

1up

Project page for my one-year challenge
Ruby
1
star
77

warp-async-test

Can warp handle multiple requests at once?
Haskell
1
star
78

rustybank

Concurrency project created by "mob programming" at a meetup
Rust
1
star
79

crapyesod

Haskell
1
star
80

semiquandle

Experiments in classification
Python
1
star
81

mathnotes

Graduate mathematics notes in TeX
1
star
82

cmsis_nucleo

Experiments with CMSIS (+device family pack) and RTOS with static allocation
C
1
star
83

enigma

Totally random dynamic CSS
JavaScript
1
star
84

preview-ics

Preview iCal invitations from the command line (or mutt)
1
star
85

heroku-buildpack-ghc-test-yesod

Test yesod server deployment
CSS
1
star
86

motif

Trying examples from "Motif Programming" by Marshall Brain
C
1
star
87

heroku-buildpack-ghc-test-snap

Test snap server deployment
Haskell
1
star
88

slow-warp

Why isn't warp responding concurrently?
Haskell
1
star
89

decaying-accumulator

A number that tends toward zero but can be nudged
JavaScript
1
star
90

githhub-care-package

Daily list of repos that need your help
1
star