diff options
-rw-r--r-- | bash/.bash_aliases | 2 | ||||
-rw-r--r-- | bash/.bashrc | 3 | ||||
-rw-r--r-- | nvim/.config/nvim/ftplugin/haskell.vim | 29 |
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 | |||
12 | alias tmux='tmux -u' | 12 | alias tmux='tmux -u' |
13 | alias tree='tree -C' | 13 | alias tree='tree -C' |
14 | alias vim='nvim' | 14 | alias vim='nvim' |
15 | alias vime='nvim ~/.vim/vimrc' | 15 | alias vime='nvim ~/.config/nvim/init.vim' |
16 | 16 | ||
17 | # git aliases | 17 | # git aliases |
18 | alias gb='git branch -v' | 18 | alias 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 | ||
81 | eval "$(stack --bash-completion-script stack)" | ||
82 | |||
81 | # pfetch | 83 | # pfetch |
82 | export PF_INFO="ascii title os kernel uptime pkgs shell " | 84 | export PF_INFO="ascii title os kernel uptime pkgs shell " |
83 | export PF_SEP=" " | 85 | export 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) |
144 | export COMMIT_COLOR="green" | 146 | export 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 @@ | |||
1 | function! 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) | ||
8 | endfunction | ||
9 | |||
10 | function! 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 | ||
21 | endfunction | ||
22 | |||
23 | augroup haskell-formatting | ||
24 | autocmd! | ||
25 | autocmd BufWritePost *.hs call s:RunStylishHaskell() | ||
26 | augroup END | ||
27 | |||
28 | |||
29 | set formatprg=stylish-haskell | ||