Created
April 8, 2018 12:22
-
-
Save isovector/9db983fd0f66621c6828d8c86ecd7d1d to your computer and use it in GitHub Desktop.
haskell vim pragmas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Plug 'junegunn/vim-easy-align' | |
| function! AddHsPragma() | |
| " Add a new HS pragma, and sort the list so it's pretty | |
| let pragma = input("LANGUAGE ") | |
| normal! ms | |
| if match(getline(1), "module") == 0 | |
| execute "normal! ggO\<ESC>" | |
| endif | |
| if pragma != "" | |
| execute "normal! ggO{-# LANGUAGE " . pragma . " #-}\<ESC>" | |
| endif | |
| execute "normal! ggvip:sort\<CR>gv:EasyAlign -#\<CR>" | |
| normal `s | |
| endfunction | |
| let g:easy_align_delimiters = { | |
| \ '#': { 'pattern': '#', 'left_margin': 1, 'right_margin': 0, 'stick_to_left': 0 }, | |
| \ } | |
| nnoremap <leader>l :call AddHsPragma()<CR> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment