-1

I am having difficulty getting MacVim to behave and look the same as gVim on Windows or Linux. Here's an example:

gVim on Windows: GVIM on Windows

MacVim on Mac OS: MacVim on Mac OS

These are viewing precisely the same file. The gVim on Windows look is what I want.

Note: the MacVim version appears to be computing the beginning of the line incorrectly, as it should be directly under the 'I' as the very first character in the file. On a number of the later lines, you simply can't navigate to the very beginning of the line, either with the 0 command, or with the usual h key.

Here are the vimrc files:

gVim on Windows:

set guifont=Courier_New:h9:cANSI:qDRAFT
set guioptions-=T
set guioptions-=m
set showmode
set cursorline
set showcmd
set autoindent
colorscheme murphy
set noswapfile
syntax on
set number
set mouse=a
map <ScrollWheelUp> <C-Y>
map <ScrollWheelDown> <C-E>
set numberwidth=8
set ruler
set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab
autocmd FileType python set columns=80
:imap <c-s> <Esc>:w<CR>a
:nmap <c-s> :w<CR>

MacVim on Mac OS:

set fileformat=mac
set guifont=CourierNewPSMT:h10
set showmode
set cursorline
set showcmd
set autoindent
colorscheme murphy
set noswapfile
syntax on
set number
set mouse=a
map <ScrollWheelUp> <C-Y>
map <ScrollWheelDown> <C-E>
set numberwidth=8
set ruler
set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab
autocmd FileType python set columns=80
:imap <c-s> <Esc>:w<CR>a
:nmap <c-s> :w<CR>

Finally, here's the text of the text file, as copied from MacVim:

I.   33: Introductions

 A. 33: Meyer: Scientific and Philosophical Introduction: Defining Theistic Evolution
    1. 34: Evolution #1: "Change over Time"
       a.  34: Can be simply "change over time". Has little or nothing to do with the modern "neo-Darwinian" theory of evolution.
       b.  34: In evolutionary biology, "change over time" can refer to the idea that the life forms we see today are different from the life forms that existed in the distant 
               past.
       c.  35: "Change over time" can also refer to observed minor changes in features of individual species - small-scale changes that take place over a relatively short 
               period of time: microevolution.

Any ideas on how to fix this? Thanks in advance for your time!

  • 2
    The file you pasted has no tabs. Something is very wrong if spaces are showing up as different widths on MAC. – Tumbler41 May 17 at 16:15
  • Right, I'm replacing all tabs with spaces - at least I thought I was. What would be wrong? – Adrian Keister May 17 at 16:16
  • 3
    Put set list listchars=tab:>- in your vimrc to confirm that there are no tabs. (Tabs will show up as ">---".) – Tumbler41 May 17 at 16:18
  • @Tumbler41: Hmm. I'm not seeing tabs showing up as >---, even after deleting the line with tabstop and so on, and restarting MacVim. It still seems to be replacing tabs with spaces. – Adrian Keister May 17 at 16:22
  • Followed the procedure here: github.com/macvim-dev/macvim/wiki/Troubleshooting. Didn't help. Problem appears to be in base vim, not in MacVim. – Adrian Keister May 17 at 16:34
2

Got an answer on the vim_use Google group. It came down to priorities, and which vimrc is being used. For MacVim, there's a .gvimrc as well as a .vimrc file, and the .gvimrc file was overriding the .vimrc settings. Once I copied the .vimrc file to .gvimrc with the following changes in particular, I got the same view:

set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab

The .gvimrc file had tabstop=8, which was the primary problem. There were also tabs in the actual file, which I replaced using the following command:

:1,$s/\t/    /g
  • 2
    Two notes: 1) Instead of duplicating .vimrc into .gvimrc you may want to simply clear out .gvimrc and use it only for settings that you exclusively want have in MacVim/GVim but not in console Vim. Should speed up startup by not setting everything twice, might avoid some issues that I think can sometimes occurs with setting certain things twice, and for things you want in both MacVim/GVim and console Vim, you only need to make a change in one place. 2) You might be interested in the :retab command for files with mixed indentation characters. – 8bittree May 30 at 17:36
  • @8bittree: Great, thanks for those tips! – Adrian Keister May 30 at 17:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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