2
votes

I'm using vim 7.3 with slimv to edit *.lisp files.

Unfortunately, slimv pretty much ignores my vim indentation settings which causes a mess from time to time. I want to use tabs for indenting and have following lines in vimrc:

set tabstop=4 shiftwidth=4 softtabstop=4 noexpandtab
let g:paredit_mode = 0

Slimv ignores those settings and insist on using spaces for indentation, 2 spaces per indent. I managed to fix "tab" behavior (so it no longer inserts 2 spaces instead of tab) by commenting out

setlocal expandtab

in Vim\vimfiles\indent\lisp.vim, however, I'm not quite sure how to fix autoindentation when I insert new line in the middle of lisp form. In this scenario slimv again ignores my settings and aligns new line using spaces instead of tabs, 2 spaces per indentation level.

As far as I can tell, indentation is handled in function! SlimvIndent( lnum ) which is located in `Vim/vimfiles/ftplugin/slimv.vim", but I'm not quite sure how to fix this function (and it doesn't seem to have any configurable settings anywhere).

How can I fix tab behavior in slimv? It has useful shortcuts (,e to evaluate form, etc), but the tab problem is quite annoying.

Ideas?

1
Do you have a (github) link to the plugin? - FDinoff
@FDinoff: I got it here It looks like it is hosted on bitbucket, most recent development version is here. - SigTerm
I can not replicate the 2 spaces per indent. I do however see the plugin using a mix of tabs and spaces (when you press enter in the middle of an expression). But it uses as many tabs as it can and fills the rest with spaces to align the statement - FDinoff
Slimv author here. Tab expansion is done on purpose, using tabs is not supported by the plugin. The lisp indentation logic is quite different from many other languages, like C, Java, etc. It is not based on predefined tabstop columns. See this or this for example. - Tamas Kovacs
@FDinoff: Create *.lisp file, write (defun test (a b) (+ a b)), put cursor at the first(() parenthesis of (a b), insert newline. slimv will align (a b) (+ a b)) using spaces. - SigTerm

1 Answers

2
votes

I have fixed slimv so that it inserts tabs (plus spaces for the remaining columns) when indenting, if noexpandtab is set after the file is loaded. Slimv still defines expandtab by default, so it is not enough to just add :set noexpandtab to your .vimrc, but you can override this by a 'post' or 'after' command, for example:

au BufReadPost *.lisp set noexpandtab

Or just simply enter :set noexpandtab in the editor any time you wish.

Please fetch the most recent version from the Slimv repository. I still advise against using tabs in lisp source files, see my comments below the original post on why.