0

How can I change the automatic indentation in MacVim?

My problem is that when editing a TeX file, every time I type, for example, (, vim decides to indent the line for me.

Here is a video of my problem. You can see it's infuriating.

I am on Mavericks, the about MacVim window shows version as

Snapshot 66, VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Dec 12 2012 16:22:25)  
MacOS X (unix) version  
Included patches: 1-754

I have installed pathogen, and the plugins used via that include tabular, vim-slim, vim-colors-solarize, and vim-surround. (Listing them all here because I don't know what is creating this behavior.)

1 Answer 1

2

The easiest way to find all the options that affect indenting is to open an options window with

:options

and then look at Section 15, "tabs and indenting". Once you know which options are relevant, you can check their current values and which plugin is responsible with

:verbose set ai? si? cin? cink? inde? indk? ci? pi? lisp? lispw?

To actually disable a filetype-specific indentation; from the manual section 30.3:

If you don't like the indenting for one specific type of file, this is how you avoid it. Create a file with just this one line: >

:let b:did_indent = 1

Now you need to write this in a file with a specific name:

{directory}/indent/{filetype}.vim

The {filetype} is the name of the file type, such as "cpp" or "java".

3
  • Got it; the latter command shows indentkeys=0{,0},:,0#,!^F,o,O,e,[,(,{,),},] from vim/runtime/indent/tex.vim. Do you know how to change it locally, ie. in ~/.vimrc?
    – morbusg
    Commented Feb 20, 2014 at 14:28
  • Or better yet, how not to load that LaTeX-centric indentation plugin in the first place?
    – morbusg
    Commented Feb 20, 2014 at 14:32
  • See :help 30.3 in the users' manual. Commented Feb 20, 2014 at 15:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .