summaryrefslogtreecommitdiffhomepage
path: root/README.markdown
diff options
context:
space:
mode:
authorNathan Bouscal <nbouscal@gmail.com>2014-03-13 12:39:32 -0400
committerNathan Bouscal <nbouscal@gmail.com>2014-03-13 12:39:32 -0400
commit1e1440be9da5bef11f7575e1aa7a91e32dd539e8 (patch)
tree43b4305501dc8c83c7fa6f117bb7fdc351d9ac8b /README.markdown
parent0770db2a0a80a3dd08318413faa7ea1116466716 (diff)
downloadstylish-haskell-1e1440be9da5bef11f7575e1aa7a91e32dd539e8.tar.gz
Add better vim integration to readme
Add instructions to integrate into vim such that it runs stylish-haskell automatically whenever you save a .hs file.
Diffstat (limited to 'README.markdown')
-rw-r--r--README.markdown15
1 files changed, 15 insertions, 0 deletions
diff --git a/README.markdown b/README.markdown
index d5af4fe..5cd3272 100644
--- a/README.markdown
+++ b/README.markdown
@@ -100,6 +100,21 @@ Just call
or add a keybinding for it.
+To run stylish-haskell each time you save a .hs file, add this to your .vimrc:
+
+ augroup stylish-haskell
+ autocmd!
+ autocmd BufWritePost *.hs call s:StylishHaskell()
+ augroup END
+
+ function! s:StylishHaskell()
+ let cursor_position = getpos('.')
+ undojoin
+ %!stylish-haskell
+ call setpos('.', cursor_position)
+ endfunction
+
+
Emacs integration
-----------------