Indenting / tab control?

68 views
Skip to first unread message

ggggg

unread,
Oct 4, 2012, 1:14:56 PM10/4/12
to janus-...@googlegroups.com
Janus is sweet overall, but I can't figure out one thing:
How can I disable all "smart" indentation? I have nosmartindent set.  But for example, when in a php file of mixed html and php, if I do a newline after some html and start a php block the cursor goes to position zero and I need to tab in, sometimes after I start writing my code will end up backwards-indenting etc.

I just want the cursor to always land on the same column every time I hit enter.

Jeroen De Vlieger

unread,
Oct 5, 2012, 7:06:08 AM10/5/12
to janus-...@googlegroups.com
if you have the following :options

autoindent    automatically set the indent of a new line
    (local to buffer)
     set noai    ai
smartindent    do clever autoindenting
    (local to buffer)
     set nosi    si
cindent    enable specific indenting for C code
    (local to buffer)
     set nocin    cin


Then What you need is probably  the following:

indentexpr    expression used to obtain the indent of a line
    (local to buffer)
     set inde=HtmlIndent()
indentkeys    keys that trigger indenting with 'indentexpr' in Insert mode
    (local to buffer)
     set indk=o,O,<Return>,<>>,{,},!^F

I have no experience with html, but form these settings I would conclude that the HtmlIndent() function is used to detirime that amount of indentation when you hit enter in insert mode.
maybe you can try setting indentexpr to nothing and see if it gets better.

Add the following line to ~/.vimrc.after

set indentexpr=

It will unset the options indentexpr every time you start vim.

Hope this will prove to be the correct direction to fix your problem.

Jeroen

ggggg

unread,
Oct 5, 2012, 12:53:03 PM10/5/12
to janus-...@googlegroups.com
Jereon:
That did the trick, this had been driving me up a wall!  Much appreciated.
Reply all
Reply to author
Forward
0 new messages