Reputation: 43
I am using "Bird" style literate haskell, which requires all code to be like the following:
> 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 a space and hit tab it tabs over only two spaces!
I have done the following to try to fix the problem:
set tabexpand
set tabstop=4
set softtabstop=4
set noautoindent
set shiftwidth=4
Any help would be much appreciated I thought the above would essentially just make it insert 4 spaces rather than any tabs.
Upvotes: 4
Views: 888
Reputation: 139840
I don't know any easy way to solve this, but here are some workarounds you can try (in rough order of complexity).
Set your indentation to two spaces and live with having to press tab twice.
Make tab indiscriminately insert 4 spaces in insert mode, ignoring all tab stop and indentation rules/options.
:imap <Tab> <Space><Space><Space><Space>
Use a patched Vim which allows you to set arbitrary tabstops. There's a variable tabstops patch at the Vim patches page.
Write your own indentation algorithm. See :help indentexpr
for details on how to do this.
Upvotes: 1
Reputation: 1
Sure, Vim moves the cursor to col 4 where the next tabstop is located. Don't know if there is a way to set the first tabstop to col 6 (or 2) instead.
Upvotes: 0
Reputation: 17350
set shiftwidth=4
'shiftwidth' 'sw' number (default 8)
local to buffer
Number of spaces to use for each step of (auto)indent.
Upvotes: 1