I want to indent with gg=G
some LaTeX files. But I get a bad indent.
\title{
\rule{\textwidth}{1pt}\\[0.5em] \huge
\textsc{My headline
\rule{\textwidth}{1pt}}
}
What I get:
\title{
\rule{\textwidth}{1pt}\\[0.5em] \huge
\textsc{My headline
\rule{\textwidth}{1pt}}
}
What I want (or similar):
\title{
\rule{\textwidth}{1pt}\\[0.5em] \huge
\textsc{My headline
\rule{\textwidth}{1pt}}
}
Is this normal? Wrong config file? Flags? AddOns? Can anybody help? Thank you!
To turn off autoindent when you paste code, there's a special "paste" mode. Then paste your code. Note that the text in the tooltip now says -- INSERT (paste) -- . After you pasted your code, turn off the paste-mode, so that auto-indenting when you type works correctly again.
How to Turn On Auto Indent in Vim. To automatically indent when editing a file in Vim, enable the auto indenting feature using the :set autoindent flag in command mode: Press Enter, and this will auto-indent the file you are currently editing.
Start in the top of a file (to get there, press gg anywhere in the file.). Then press =G , and Vim will fix the indentation in the whole file. If you don't start in the beginning of the file, it will fix indentation from current line to the bottom of file.
autoindent essentially tells vim to apply the indentation of the current line to the next (created by pressing enter in insert mode or with O or o in normal mode. smartindent reacts to the syntax/style of the code you are editing (especially for C). When having it on you also should have autoindent on.
I allways had a bad indentation with VIM, even after trying many stuff. if it helps I just turn it off and indent manual. there is the autoindent, the smartindent, and not sure if any other "geek" indent type setting just if you would like to experimentate combinations of on off
http://vim.wikia.com/wiki/How_to_stop_auto_indenting
also maybe trying with the :set paste could be what you need.
http://ayaz.wordpress.com/2008/06/21/paste-mode-pasting-text-and-indenting-it-in-vim/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With