vim

Installing and maintaining the FreeBSD Ports Collection or FreeBSD Packages (i.e. third party software).

vim

Postby mariourk » 28 Nov 2011, 18:35

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
mariourk
Member
 
Posts: 151
Joined: 19 Nov 2011, 14:48

Postby jrm » 28 Nov 2011, 18:44

Are you using your old [file]~/.vimrc[/file]?
User avatar
jrm
Member
 
Posts: 726
Joined: 16 Nov 2008, 17:32
Location: Halifax, Nova Scotia, Canada

Postby Beastie » 28 Nov 2011, 18:50

For syntax highlighting add syntax on to [file]~/.vimrc[/file].

For the rest, I have no idea. It's working fine here.
May the source be with you!
Beastie
Senior Member
 
Posts: 1859
Joined: 28 Mar 2009, 11:27
Location: /dev/earth0

Postby graudeejs » 28 Nov 2011, 19:25

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
[cmd=$]cd [FILE]~/vim/[/FILE] && make[/cmd] to install my default plugin set
User avatar
graudeejs
Style(9) Addict
 
Posts: 4591
Joined: 16 Nov 2008, 23:23
Location: Riga, Latvia

Postby Carpetsmoker » 28 Nov 2011, 19:32

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

Code: Select all
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
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
User avatar
Carpetsmoker
Member
 
Posts: 904
Joined: 16 Nov 2008, 19:07
Location: Eindhoven, Netherlands

Postby mariourk » 30 Nov 2011, 19:37

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?
mariourk
Member
 
Posts: 151
Joined: 19 Nov 2011, 14:48

Postby graudeejs » 30 Nov 2011, 21:50

in vim :help mouse
User avatar
graudeejs
Style(9) Addict
 
Posts: 4591
Joined: 16 Nov 2008, 23:23
Location: Riga, Latvia

Postby mariourk » 01 Dec 2011, 10:28

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?
mariourk
Member
 
Posts: 151
Joined: 19 Nov 2011, 14:48

Postby graudeejs » 01 Dec 2011, 11:33

vim :help mouse
User avatar
graudeejs
Style(9) Addict
 
Posts: 4591
Joined: 16 Nov 2008, 23:23
Location: Riga, Latvia

Postby OH » 01 Dec 2011, 15:20

mariourk wrote: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
OH
Member
 
Posts: 209
Joined: 25 Aug 2009, 09:32
Location: The Netherlands


Return to Installation and Maintenance of FreeBSD Ports or Packages

Who is online

Users browsing this forum: No registered users and 1 guest