The problem of Infinite tabs in Wime, in literate Haskell

I use the "Bird" style literate haskell, which requires all the code to look like this:

> module Main (main) where 

and if I have a block, it should look something like this:

 > main = do > args = getArgs > file = args!![0] 

etc .. However, when I enter the gt sign, then the space and tab will only appear in two spaces!

I tried to solve this problem as follows:

 set tabexpand set tabstop=4 set softtabstop=4 set noautoindent set shiftwidth=4 

Any help would be greatly appreciated. I thought that the above would just make it insert 4 spaces, not any tabs.

+4
source share
3 answers

I don’t know what an easy way to solve this problem, but here are some workarounds that you can try (in a rough order of difficulty).

  • Indent two spaces and live with the need to double-click a tab.

  • Insert tab indiscriminately insert 4 spaces in insert mode, ignoring all tab rules and indents / parameters.

     :imap <Tab> <Space><Space><Space><Space> 
  • Use a fixed Vim that allows you to set arbitrary tabstops. There's a variable tabstops patch on the Vim patches page .

  • Write your own indentation algorithm. For more information on how to do this, see :help indentexpr .

+1
source

set shiftwidth=4

 'shiftwidth' 'sw' number (default 8) local to buffer Number of spaces to use for each step of (auto)indent. 
+1
source

Of course, Vim moves the cursor to column 4, where the next tabstop is located. I don't know if there is a way to set the first tabstop instead of col 6 (or 2).

0
source

All Articles