Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I just copied over (recursively) a directory from a remote machine and would like to work on the files on my own computer.

However, whenever I used Vim remotely, every tab automatically did two things: - used 4 spaces per tab - put a vertical marking at the location of each tab to indicate that there was one

My own machine has none of these settings in place (I think each tab is about 8 spaces, and there are no vertical markings)

Is there a way to make it so that whenever I open up a file using Vim from now on, it will match the settings of the remote machine I originally developed the files on?

share|improve this question

2 Answers 2

Vim can display meta-characters that indicate tabs, eol (end-of-line) characters and such. To enable this just put the following in your ~/.vimrc file:

set list

To set vim to use 4 spaces on tabs:

set tabstop=4

If you wish to have your tabs act as if you input four individual spaces, and a way to delete these as one tab, include:

set expandtab
set softtabstop=4

Or, if you're lazy like me, you simply copy the ~/.vimrc file from your remote location to your home directory (note that it may use options or resources not available on your version etc.)

scp user@host.com:~/.vimrc ~/
share|improve this answer
    
I edited to add scp remoteuser@example.com:~/.vimrc ~/.vimrc since that explicitly answers the last question. –  styfle Jan 5 '12 at 18:57

Alternatively, you could supplement your files with modelines, e.g. in comments:

vim: set list tabstop=4:

(Note that there has to be whitespace or a line beginning before the vim: keyword.)

This way, they will automatically display correctly on any system's vim. (Unless the 'modeline' option is unset.)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.