Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I tried to use vim on FreeBSD (via ssh on Linux xterm-compatible terminal). However vim behaves similar to vi out-of-box. For example it does not react on delete key, insert F character instead of going up while on insert mode etc.

On FreeBSD X11 is not installed.

Edit: As asked I post vim --version

# vim --version
VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Jul 28 2010 11:48:54)
Included patches: 1-6, 8-35, 37-48, 50-70, 73, 75-87, 90-92, 94-100, 102-137, 139-149, 151-171,     173-190, 192-193, 195-203, 206-211, 213-215, 217-218, 220-232, 234-246, 251-259, 261-301, 303-319, 321-322, 324-335, 337-351, 353-361, 363, 366-371, 373, 375-376, 378-383, 385-387, 389-398, 401-402, 404-411
Compiled by root@enterprise.piechotka.com.pl
Big version without GUI.  Features included (+) or not (-):
+arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent 
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments 
+cryptv +cscope +cursorshape +dialog_con +diff +digraphs -dnd -ebcdic 
+emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path 
+float +folding -footer +fork() -gettext -hangul_input +iconv +insert_expand 
+jumplist +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap 
+menu +mksession +modify_fname +mouse -mouseshape +mouse_dec -mouse_gpm 
-mouse_jsbterm +mouse_netterm +mouse_sysmouse +mouse_xterm +multi_byte 
+multi_lang -mzscheme -netbeans_intg -osfiletype +path_extra -perl +postscript 
+printer -profile -python +quickfix +reltime +rightleft -ruby +scrollbind 
+signs +smartindent -sniff +startuptime +statusline -sun_workshop +syntax 
+tag_binary +tag_old_static -tag_any_white -tcl +terminfo +termresponse 
+textobjects +title -toolbar +user_commands +vertsplit +virtualedit +visual 
+visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup 
-X11 -xfontset -xim -xsmp -xterm_clipboard -xterm_save 
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: cc -c -I. -Iproto -DHAVE_CONFIG_H   -I/usr/local/include  -O2 -pipe -fno-strict-aliasing  -D_FORTIFY_SOURCE=1        
Linking: cc   -L/usr/local/lib -o vim       -lm -ltermlib -liconv  
share|improve this question
What keymap are you using on the Linux box? –  gvkv Aug 18 '10 at 15:31
uk (set in /etc/conf.d/keymaps). In X11 uk + some customization. I use gnome-terminal. –  Maciej Piechotka Aug 18 '10 at 19:43

5 Answers 5

up vote 6 down vote accepted

This is generally a terminal setting problem. Check your $TERM environment variable on the FreeBSD side, and check what your local terminal setting is. This is almost certainly the problem with the arrow keys.

In addition to this, make sure you have the standard set of "unbreak my vim" .vimrc settings applied.

set nocompat
set backspace=eol,start,indent

If you're sure the terminal settings are correct, but you're still having backspace issues, take a look at vim's help

:help fixdel
share|improve this answer

I've just recently set up a FreeBSD 8.2 server after mostly working with Linux, and I had the exact same frustration with VI. The problem is that FreeBSD comes with very different defaults for VI than most Linux distros.

Thanks to stumbling onto this page: http://jmcpherson.org/vimrc.html, here's how I set up my .vimrc file to get VI working the way I'm used to:

set nocompatible
set autoindent
set smartindent
set tabstop=4
set shiftwidth=4
set showmatch
set guioptions-=T
set vb t_vb=
set ruler
set nohls
set incsearch
set virtualedit=all
set bs=2

I used the nano text editor to make the file because VI was giving me so much trouble.

For anyone new to VI, just create a text file in your home directory called .vimrc and paste the contents of the code box above and save. Or you can try any of those options right in VI by typing a : then the option, i.e. :set ruler and hitting enter.

share|improve this answer
As I interpret the question, it looks like he wasn't just asking about the delete key, or just arrow keys typing letters in insert mode. It looks to me that he's a Linux user using FreeBSD for the first time and frustrated with the VI defaults as compared to the standard defaults used in most Linux distros. The options I posted will get VI working just like it usually does in Linux when installing vim-enhanced. So I think it's a good addition to the accepted answer, and also there's no need to mess with terminal settings (at least I didn't need to). Hopefully my info helps others. –  einsteinx2 May 18 '11 at 21:54

Are you typing "vim", or assuming that typing "vi" runs Vim?

On FreeBSD, the command "vi" is likely to get you nvi.

share|improve this answer
I'm typing vim. –  Maciej Piechotka Aug 18 '10 at 13:29
In a terminal use: type -a vi and type -a vim After that: ls -ld /usr/bin/vi and ls -ld /usr/bin/vim to see if there's a symbolic link. –  dZkF9RWJT6wN8ux Aug 18 '10 at 16:27
which vim --> /usr/local/bin/vim, which vi --> /usr/bin/vi. I don't have type --> no such command. None is symlink. –  Maciej Piechotka Aug 18 '10 at 19:42
"type" is a Bash builtin. "type -p" is the same thing as "which", and "type -a" just extends that. Can you post the output of "vim --version"? –  Warren Young Aug 18 '10 at 20:03
posted in main post –  Maciej Piechotka Aug 18 '10 at 21:04

my guess is following could be the possible reason for this issue:

  1. May be in your vimrc file by mistake someone has set vim to behave like vi.
    set compatible
  2. Your vim is pointing to original vi binary.
share|improve this answer
As stated it is not pointing. I don't have any vimrc or similar file. –  Maciej Piechotka Aug 18 '10 at 21:05
@Maciej but does freebsd set any defaults. If I had a nickel for every distro that screwed up vim defaults... have you read the :h compatible? have you checked the vimrc file that freebsd probably has? –  xenoterracide Aug 18 '10 at 21:11
@Maciej: did you check for .vimrc ? –  Hemant Aug 18 '10 at 21:18
I don't have .vimrc –  Maciej Piechotka Aug 18 '10 at 21:59

First thing I do after installing vim:

cp ${LOCALBASE:-"/usr/local"}/share/vim/vim*/vimrc_example.vim ~/.vimrc

That has most sane defaults, except that I set background=dark.

share|improve this answer
Thanks for this. It fixed a lot of things for me. It's got a lot of extra stuff, of course, but it's a good starting point. –  tjameson Jul 31 '12 at 18:42

Your Answer


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.