aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bash/.bash_aliases2
-rw-r--r--bash/.bashrc3
-rw-r--r--nvim/.config/nvim/ftplugin/haskell.vim29
3 files changed, 33 insertions, 1 deletions
diff --git a/bash/.bash_aliases b/bash/.bash_aliases
index fa78f7b..da283b5 100644
--- a/bash/.bash_aliases
+++ b/bash/.bash_aliases
@@ -12,7 +12,7 @@ alias spdtst='curl -o /dev/null http://speedtest.wdc01.softlayer.com/downloads/t
12alias tmux='tmux -u' 12alias tmux='tmux -u'
13alias tree='tree -C' 13alias tree='tree -C'
14alias vim='nvim' 14alias vim='nvim'
15alias vime='nvim ~/.vim/vimrc' 15alias vime='nvim ~/.config/nvim/init.vim'
16 16
17# git aliases 17# git aliases
18alias gb='git branch -v' 18alias gb='git branch -v'
diff --git a/bash/.bashrc b/bash/.bashrc
index c61dc42..abd37e7 100644
--- a/bash/.bashrc
+++ b/bash/.bashrc
@@ -78,6 +78,8 @@ export NVM_DIR="$HOME/.nvm"
78[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm 78[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
79[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion 79[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
80 80
81eval "$(stack --bash-completion-script stack)"
82
81# pfetch 83# pfetch
82export PF_INFO="ascii title os kernel uptime pkgs shell " 84export PF_INFO="ascii title os kernel uptime pkgs shell "
83export PF_SEP=" " 85export PF_SEP=" "
@@ -142,3 +144,4 @@ export BRANCH_COLOR="bright black"
142 144
143# if HEAD ref peels to a commit (detached state) 145# if HEAD ref peels to a commit (detached state)
144export COMMIT_COLOR="green" 146export COMMIT_COLOR="green"
147
diff --git a/nvim/.config/nvim/ftplugin/haskell.vim b/nvim/.config/nvim/ftplugin/haskell.vim
new file mode 100644
index 0000000..c389121
--- /dev/null
+++ b/nvim/.config/nvim/ftplugin/haskell.vim
@@ -0,0 +1,29 @@
1function! s:OverwriteBuffer(output)
2 let winview = winsaveview()
3 silent! undojoin
4 normal! gg"_dG
5 call append(0, split(a:output, '\v\n'))
6 normal! G"_dd
7 call winrestview(winview)
8endfunction
9
10function! s:RunStylishHaskell()
11 let output = system("stylish-haskell" . " " . bufname("%"))
12 let errors = matchstr(output, '\(Language\.Haskell\.Stylish\.Parse\.parseModule:[^\x0]*\)')
13 if v:shell_error != 0
14 echom output
15 elseif empty(errors)
16 call s:OverwriteBuffer(output)
17 write
18 else
19 echom errors
20 endif
21endfunction
22
23augroup haskell-formatting
24 autocmd!
25 autocmd BufWritePost *.hs call s:RunStylishHaskell()
26augroup END
27
28
29set formatprg=stylish-haskell