# vim



## mariourk (Nov 28, 2011)

I just installed vim on my brand new FreeBSD server, so I can edit some configuration-files the way I'm used to do on my Linux servers. However, vim behaves oddly. Certainly not the way I'm used to. 

I'm missing the syntax highlighting. When I press _insert_ there is no way I can see that I just went into editing-mode. When I press _insert_, I assume I'm actually in editing-mode, right? :q When I'm in editing mode and press the cursors, to move around in the text/code, A's, B's, C's and D's show up.

What am I doing wrong? :r


----------



## jrm@ (Nov 28, 2011)

Are you using your old ~/.vimrc?


----------



## Beastie (Nov 28, 2011)

For syntax highlighting add *syntax on* to ~/.vimrc.

For the rest, I have no idea. It's working fine here.


----------



## graudeejs (Nov 28, 2011)

This is because on Linux you probably used preconfigured vim.
On FreeBSD vim default to almost vi-like behavior

You can try my vim config if you want
https://github.com/graudeejs/dot.vim
after cloning/extracting
`$ cd [FILE]~/vim/[/FILE] && make` to install my default plugin set


----------



## Carpetsmoker (Nov 28, 2011)

Many (almost all) Linux distributions modify configuration files in their packages, this means you can never rely on the same defaults, or even on relatively sane defaults for that matter...

FreeBSD, on the other hand, almost never modifies the default configuration files beyond what is absolutely necessary, usually the only things that are changed are the various filesystem locations.

So what you have now, are the default Vim settings, instead of a Linux package maintainers choice of "defaults" for that specific distribution.

I don't know what you're used to, but here are a few basic options you will probably want to set in your *~/.vimrc*


```
set nocompatible        " Use Vim settings, rather then Vi settings
set backspace=indent,eol,start  " allow backspacing over everything
set ruler               " show the cursor position all the time
set incsearch           " do incremental searching
set hlsearch            " highlight the last used search pattern.
set autoindent          " always set auto indenting on
set lbr                 " Wrap at word
set tabstop=2           " Tabs are 2 spaces wide
set shiftwidth=2        " Auto-indent 2 spaces wide
set softtabstop=2       " Still 2...
set encoding=utf-8      " Default encoding
syntax on               " Switch syntax highlighting on
```

This should fix the syntax highlighting (with *syntax on*) and add the INSERT when in insert mode (with *set ruler*).



> When I'm in editing mode and press the cursors, to move around in the text/code, A's, B's, C's and D's show up...



If setting *nocompatible* doesn't help, you're probably using the wrong *TERM* environment variable. For xterm and most other modern terminal emulators, this should is usually set to *xterm-color*.

In tcsh you use: *# setenv TERM xterm-color*
And in sh/bash/zsh/ksh: *# export TERM=xterm-color*


----------



## mariourk (Nov 30, 2011)

The following command did the trick:
[cmd=]cp /usr/local/share/vim/vim71/vimrc_example.vim /usr/local/share/vimrc[/cmd]

However, I'm used to selecting text with the left mouse-button and pasting it by clicking the mouse-wheel. This doesn't work for some reason. And I find that very annoying. Does someone know how to fix this?


----------



## graudeejs (Nov 30, 2011)

in vim *:help mouse*


----------



## mariourk (Dec 1, 2011)

When I select something with the mouse, vim jumps to _visual mode_. I think that's causing the problem. Is there some way to turn this off?


----------



## graudeejs (Dec 1, 2011)

vim *:help mouse*


----------



## OH (Dec 1, 2011)

mariourk said:
			
		

> When I select something with the mouse, vim jumps to _visual mode_. I think that's causing the problem. Is there some way to turn this off?



:set mouse=r


----------

