VIM Question

Quick question. Does anyone know how to save a VIM document to .txt with all the lines and spaces the same as how it’s viewed in VIM? I’m trying to copy and paste bash scripts onto the internet or to elsewhere and I’m having a devil of a time because after I’ve copied the scripts to .txt files I have to go through and re-space them. It takes forever. Anyway, any help would be much appreciated!


Try setting the autoindent feature on in .vimrc.


Also, you wanna do the following:

set expandtab
set ts=3

basically expand any tabs into 3 spaces. Tab spacing is usually what gets messed up when you move between different environments.

After installing linux, I make a backup copy of “/etc/vimrc” in case I ever need it. And then I delete /etc/vimrc . That way, I don’t get all of that annoying special formatting by vim.

Maybe it’s because I have spent a lot of time with traditional “vi” that I don’t like what vim does to files.

In any case, that way what I see is what it will look like when saved to a text file.