[email protected] ,
September 20, 2002 22:50
:h pt
even better
[email protected] ,
September 22, 2002 11:21
I find that I'm annoyed by the indent policy accompanying some file types (HTML and XML in particular). Adding the following lines to your .vimrc will turn off ALL indenting for the given file types:
autocmd BufEnter *.html setlocal indentexpr=
autocmd BufEnter *.htm setlocal indentexpr=
autocmd BufEnter *.xml setlocal indentexpr=
autocmd BufEnter *.xsd setlocal indentexpr=
Just change the above to whatever file type (extension) you want to disable indenting for.
[email protected] ,
October 2, 2002 5:51
As a 15 year + vi user I find the latest version of vim intensely irritating.
I would like a quick way of disabling the irritatingly stupid indentation and I
am not keen on wasting any time learning how to configure vim.
To my mind vim -C should disable indentation and highlighting (which is none to
clever either) but it doesn't- any hints?
[email protected] ,
October 2, 2002 18:38
AMEN to the person who finds the indenting exceedingly annoying. Does anyone know how to disable this so-called feature completely so that I can type things the way I want rather than the way someone else decided I should want? This sort of thing is very un-Unix-like.
[email protected] ,
October 3, 2002 7:52
I finally found out how to disable the autoindent annoyance.
Put the following line in the file .vimrc in your home directory:
filetype off
Amazingly easy to do. Why was it so hard to find out how to do it?
[email protected] ,
October 9, 2002 18:34
Another alternative is to modify $VIMRUNTIME/filetype.vim, which
is a fairly straight forward process. Just find the section for the
file type in question and start commenting or deleting sections
that offend you.
--
Michael
And now, my Two Cents:
>>Amazingly easy to do. Why was it so hard to find out how to do it?
Because most people are not so put off by it.
>>I [want to] type things the way I want rather than the way someone
>>decided I should want? This sort of thing is very un-Unix-like.
Most of the indenting schemes are fairly configurable on an individual
basis, and almost all conform to de-facto and/or official code standards.
That's not so un-unix like, is it?
>>I'm a 15 year + vi user I find the latest version of vim intensely irritating.
>>I am not keen on wasting any time learning how to configure vim.
Why are you using VIM then? Use a VI clone if you are not willing to
configure VIM. Why are you unwilling to configure your editor?
>>To my mind vim -C should disable indentation and highlighting
I agree. Intuitively I would expect that to disable those features.
Anonymous ,
October 22, 2002 11:55
:set pastetoggle=<F11>
[email protected] ,
November 6, 2002 5:39
To turn off indenting, you can use:
:set noai
:set noautoindent
Anonymous ,
November 14, 2002 19:42
To rando:
':set no ai' will not work when filetype (or the new indent feature) exists. that's all this tip about.
[email protected] ,
January 17, 2003 8:00
Is there a way to make it insert spaces instead of tabs when it auto-indents?
[email protected] ,
January 17, 2003 8:02
never mind...
the answer to my question was
set expandtabs
anonymous,
March 1, 2003 19:39
There's no s on that:
:set expandtab
Also, I tried a few of the options above to turn off the indenting but none seemed to work
so I renamed the html.vim file in the indent directory to html_vim.
Syntax highlighting still works but the indenting is disabled for now until I have time to figure
it out.
vim (at) leonini.net,
March 30, 2003 23:57
add in your .vimrc:
" Paste Mode On/Off
map <F11> :call Paste_on_off()<CR>
set pastetoggle=<F11>
let paste_mode = 0 " 0 = normal, 1 = paste
func! Paste_on_off()
if g:paste_mode == 0
set paste
let g:paste_mode = 1
else
set nopaste
let g:paste_mode = 0
endif
return
endfunc
[email protected] ,
April 11, 2003 15:45
If you're using gvim for Windows, just deleting all the contents of the "indent" folder works nicely to disable this "feature".
[email protected] ,
May 13, 2003 6:12
Serendipidy to the rescue.
:a
Paste in stuff using X or GPM etc
Control-C, or ESC
I find this tremendously useful, but it does bauk sometimes when you paste in escape codes.
[email protected] ,
July 31, 2003 5:54
I would like to shift some text a tabs-width left or right. For some reason, regardless of what my "set ts=<some number>" is set to --- it shifts the block 8 spaces. Since I prefer 4 spaces as a tab-width, I have to jump down, row-by-row and do a "4x" on each row to do what should be a simple "<L" operation. Any tips?
Anonymous ,
August 15, 2003 8:34
what you're after is shiftwidth not tabstop
ie :se sw=4
[email protected] ,
August 24, 2003 3:04
obviously you ppl never code much. vim's auto indent feature is written for people who don't write letters etc but who program. I assure you that it is amazingly usefull for programming and that i for one love the guy who wrote it! As the people wrote vim obviously write alot of code they wrote it in to help themselves out (and the many other programmers out there). For those of you who said it was "very un-*nix like" i say that its very un-*nix like to bash features that you don't understand ... if you don't wanna play round with config files and acutally have to figure stuff out then go install windows and use notepad :D </rant>
[email protected] ,
October 8, 2003 17:25
Troll dude - lighten up. Some people (sorry - ppl) actually _care_ about what they type and use their 'brains' to decide what kind of indentation/style/whitespace they wish. For those folks (sorry - fks) the 'new' vi can be a real pain in the ass - as it's pretty tricky to work out how to turn the stuff off.
Sylvester
anonymous,
October 10, 2003 15:39
I just upgraded to vim 6.2 also. Can't say I have any problems with auto indent on my UNIX box, although, the trick that worked for me using gVim 6.2 on Windows was the following:
:set nocindent<CR>
:set cinoptions=<CR>
One way to find out what is causing the indent is to just type ":set<CR>". A list of all options that differ from their default value will be shown. If something weird arrises when I'm coding, such as autoindent, I will exit vim, restart it, check the settings using the ":set" command, open the file that I was working on, and check ":set" again to see what the differences are.
I suggest looking and the command ":help set". You may be able to alleviate any future problems by simply looking to see what values are set to what.
[email protected] ,
October 19, 2003 22:34
RE: "obviously you ppl never code much."
and
RE: "Because most people are not so put off by it."
Amazing! With arrogance like this, who needs M$?
Common sense goes further than a lot of learning.
Anonymous ,
October 21, 2003 20:52
To fully disable any and all forms of autoindenting in vim, you have to add all these options at the bottom of your vimrc file. If you want the settings in the default vimrc file that comes with the official distribution of vim but want autoindening turned off, all you have to do is place these options at the bottom of the vimrc file.
set nocindent
set nosmartindent
set noautoindent
set indenexpr=
filetype indent off
filetype plugin indent off
To see how I came up with this solution, check out the thread I began with the subject "disabling all forms of auto indentation completely"
in the vim mailing list. The beginning of the thread of over a dozen post/replies can be found at the mailing list site:
http://groups.yahoo.com/group/vim/message/43582
or the alternate site
http://marc.theaimsgroup.com/?l=vim&m;=106438290613886&w;=4
Alternatively, you can check out the archive set:
http://marc.theaimsgroup.com/?l=vim&r;=1&s;=disabling&q;=b&w;=4
Enjoy!
Best Regards,
Carlo
------
Carlo Florendo
Astra Philippines Inc.
www.hq.astra.ph
Anonymous ,
November 22, 2003 19:27
M$ ne 'Common sense'
Anonymous ,
February 11, 2004 3:55
Even with all these things set, I had to force vim to use my ~/.vimrc file by aliasing vim to 'vim -u ~/.vimrc'. Only then does the cursed autoindenting go away.
As far as I'm concerned this does break the unix standard. .rc files in a user's home directory should be read last and should override other settings.
Anyone else know what's going on?
Gilou,
February 15, 2004 16:06
Thanks ;)
[email protected] ,
April 28, 2004 17:22
Whatever I tried, I couldn't get rid of my auto indentation for PHP or HTML.
So I went into vim directory and deleted the intendation files for both php and html, and now its great!
Anonymous ,
April 29, 2004 4:08
Tip:
filetype off
worked fabulously for turning off autoindenting. Thank you!! I am a 10 year user of vi. I can understand autoindenting while programming, and that's useful to some extent, but as one of the users points out, cutting and pasting with the autoindent on is a pain in the a$$. :set noautoindent in the vi session itself does not turn it off, the plugin either ignores or overrides it. The reason that I rely on vi is that is it simple, basic and works consistently every time. That is, until the new-and-improved-hard-to-configure vim. Now its a battle to override the stupid smarts. Kind of feels like Windows in the Unix environment. Not good.
And to those fellows who arrogantly state that those who cannot configure the new vim don't program - get a life. Probably you don't write enough code that you find you have the time to learn all the cryptics about vim configuration. Bet you can't program squat, but know eLisp and X configuration backwards.
Anonymous ,
May 7, 2004 15:48
Why cant this be done automatically? Just like irssi can detect if you 'write text really quickly' (paste text). This seems hardly convinient from a star editor.
Anonymous ,
June 10, 2004 15:53
I don't know why this was so hard for some people.
I just googled: gvim windows automatically indenting
and got this page!
=)
Just kidding obviously. Thanks to the above for figuring this stuff out for me
Anonymous ,
July 2, 2004 15:41
damn, at first I thought it was PuTTY not translating carriage returns properly, because I had done a full re-install of my desktop box, and my new webserver box. I spent so much time going thru the settings on PuTTY before I figured out that it was (1) tabs/indenting not coming out right and (2) the VIM configuration!
Shoot... 2 weeks ago, I manually fixed 3 pages of code that was all messed up because I couldn't figure out how to get it to paste correctly. What a waste...
After finally finding out that it was VIM and not PuTTY, I found this page quickly ("vimrc indent" in google). After trying some of the things here, this worked for me on Debian:
edit /etc/vim/vimrc and changed "set autoindent" to "set noautoindent"
It's actually amazing how much CUT-AND-PASTE a person does when WRITING CODE IN C/C++/perl/HTML/PHP. Making that the default setting was a poor choice for me and apparently others. Though very interesting features, I find that I dislike syntax highlighting (many colors are not readable on any of my screens) and the new autoindenting, and that's only because (for me) they have bad side effects that outweigh what they offer.
The worst part was not knowing that it was vim that was causing my text to paste incorrectly for so long.
heh.. tip #330? how many are there? shouldn't there only be 20 or so? ;)