Skip to content

Commit

Permalink
Merge pull request #88 from alx741/disable_indentation
Browse files Browse the repository at this point in the history
Disable indentation - configuration variable
  • Loading branch information
raichoo authored Nov 29, 2016
2 parents e6f3093 + 99f9b1a commit 8c1fac4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ Disabling Template Haskell and Quasiquoting syntax is possible by setting

To configure indentation in `haskell-vim` you can use the following variables to change indentation depth, just add the according line to your `.vimrc`.

If you dislike how indentation works you can disable it by setting `g:haskell_indent_disable` to
`1`.

Additionally you can use the
[vim-hindent](https://github.com/alx741/vim-hindent) plugin to achieve automatic
indentation using *hindent*.

#### Haskell

* `let g:haskell_indent_if = 3`
Expand Down
2 changes: 2 additions & 0 deletions doc/haskell-vim.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ INDENTATION *haskell-vim-indentation
To configure indentation in `haskell-vim` you can use the following variables to
change indentation depth, just add the according line to your `.vimrc`.

You can disable the indentation by setting `g:haskell_indent_disable` to `1`.

Haskell~

* |haskell-vim-indent-if|
Expand Down
14 changes: 12 additions & 2 deletions indent/haskell.vim
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ endif

let b:did_indent = 1

if !exists('g:haskell_indent_disable')
let g:haskell_indent_disable = 0
endif

if !exists('g:haskell_indent_if')
" if x
" >>>then ...
Expand Down Expand Up @@ -57,8 +61,14 @@ if !exists('g:haskell_indent_guard')
let g:haskell_indent_guard = 2
endif

setlocal indentexpr=GetHaskellIndent()
setlocal indentkeys=0{,0},0(,0),0[,0],!^F,o,O,0\=,0=where,0=let,0=deriving,<space>
if exists("g:haskell_indent_disable") && g:haskell_indent_disable == 0
setlocal indentexpr=GetHaskellIndent()
setlocal indentkeys=0{,0},0(,0),0[,0],!^F,o,O,0\=,0=where,0=let,0=deriving,<space>
else
setlocal nocindent
setlocal nosmartindent
setlocal autoindent
endif

function! s:isInBlock(hlstack)
return index(a:hlstack, 'haskellParens') > -1 || index(a:hlstack, 'haskellBrackets') > -1 || index(a:hlstack, 'haskellBlock') > -1 || index(a:hlstack, 'haskellBlockComment') > -1 || index(a:hlstack, 'haskellPragma') > -1
Expand Down

0 comments on commit 8c1fac4

Please sign in to comment.