# Problem with vim



## osp (Sep 12, 2014)

nakal said:
			
		

> What I want to know about is your problem with vim that I cannot understand. Please be a more exact here what is happening.



Examples:
 in insert mode I write something and decide to delete that - (not escaping insert mode) I press [backspace] - what is happening is that cursor just moves left, characters stays and they disappear only after I press [ESC]
I enter insert mode with _ and try to move with arrow keys: it starts to make newline with one 'C ' at the beginning - in [ESC] mode arrows keys work properly
[*]backspacing at the beginning of line stays there - on linux it just erase newline and keep backspacing to the top._
_

Just a few annoying things I found after a few minutes - really simple editing - this is not a vim behaviour that I am used to on Linux._


----------



## SirDice (Sep 12, 2014)

osp said:
			
		

> 3. example: backspacing at the beginning of line stays there - on Linux it just erase newline and keep backspacing to the top...


Create a ~/.vimrc and put this in there:

```
set backspace=indent,eol,start
```

On most Linux distributions the vim configuration has been heavily modified. On FreeBSD you get the standard, default settings. So you need to tweak it a bit for your environment.


----------



## scottro (Sep 12, 2014)

Just to be completely sure--you are using editors/vim and not the version of vi that is included with FreeBSD, correct?  FreeBSD uses nvi which behaves a little differently than editors/vim.

If so, then as @SirDice said, it's most likely to be a particular Linux distribution's customized version of editors/vim, and you might get different results with different Linux distributions.


----------



## osp (Sep 12, 2014)

scottro said:
			
		

> Just to be completely sure--you are using editors/vim and not the version of vi that is included with FreeBSD, correct?  FreeBSD uses nvi which behaves a little differently than editors/vim.
> 
> If so, then as @SirDice said, it's most likely to be a particular Linux distribution's customized version of editors/vim, and you might get different results with different Linux distributions.



Like I wrote I did `pkg install vim`, and `vim <file>`


----------



## osp (Sep 12, 2014)

SirDice said:
			
		

> osp said:
> 
> 
> 
> ...



OK, I didn't know that, Linux setup is kind of more sensible, but I understand that in FreeBSD is everything vanilla - also good.


----------



## SirDice (Sep 12, 2014)

osp said:
			
		

> but I understand that in FreeBSD is everything vanilla - also good.


Yes, that's something to keep in mind. A lot of things you install will need to be configured, which is a good thing because it allows you the freedom to modify it and adjust it to your liking. The downside is that you really need to configure everything, sometimes even for the most basic settings.


----------



## osp (Sep 17, 2014)

Vim is fundamental for me in text mode, so I am trying to replicate my Linux setup and possibly export it to a single .vimrc, which I could copy to FreeBSD installation.

I find this hints: http://vim.1045645.n5.nabble.com/export-settings-td1180809.html and done this: `vim -s /usr/share/vim/vim74/bugreport.vim`. This creates a text file bugreport.txt (in attachment) and it should be a file with my complete vim environment. But the output is a little strange to me.

Can someone help me how to edit/reformat that file so it would become a correct vimrc file? It is huge so manually to pinpoint what is relevant and what not would be a pain - does anyone know how to do properly export/import of a vim configuration?


----------



## xtaz (Sep 17, 2014)

I use vim and none of the problems originally described happen with me. It sounds like either you're using vi instead of vim, or your terminal is wrong. All I've done is copied the /usr/local/share/vim/vim74/vimrc_example.vim file into ~/.vimrc and aliased vi to vim. I'm also using PuTTY with the xterm terminal settings. Arrow keys in edit mode etc all works normally.


----------



## SirDice (Sep 18, 2014)

xtaz said:
			
		

> and aliased vi to vim.


That might be the reason. On a lot of Linux distributions vi already points to vim. On FreeBSD they remain separate. In my ~/.cshrc I have:

```
if ( -x /usr/local/bin/vim ) then
  alias vi vim
endif
```


----------



## osp (Sep 18, 2014)

xtaz said:
			
		

> I use vim and none of the problems originally described happen with me. It sounds like either you're using vi instead of vim, or your terminal is wrong. All I've done is copied the /usr/local/share/vim/vim74/vimrc_example.vim file into ~/.vimrc and aliased vi to vim. I'm also using PuTTY with the xterm terminal settings. Arrow keys in edit mode etc all works normally.



I wrote two times already: I did 
	
	



```
pkg install vim
```
 and using 
	
	



```
vim
```


```
# which vi
/usr/bin/vi
# file /usr/bin/vi
....ELF 64bit....
# which vim
/usr/local/bin/vim
# file /usr/local/bin/vim
....ELF 64bit....
```

P.S. and now I had to use vipw (so I guess true vi) and that was just beyond terrible


----------



## osp (Sep 18, 2014)

SirDice said:
			
		

> xtaz said:
> 
> 
> 
> ...



Maybe both of you should test it on fresh install without X - I am using viM


----------



## nakal (Sep 19, 2014)

You should set the environment variable EDITOR to your favorite editor. vipw will read this environment variable and start accordingly.


----------



## osp (Sep 19, 2014)

nakal said:
			
		

> You should set the environment variable EDITOR to your favorite editor. vipw will read this environment variable and start accordingly.



That was first thing I tried: `echo $EDITOR`. it was empty, so I guessed that I would have to read manual or ask question, because FreeBSD does again something different. So I battled my way trough default vipw.


----------

