# vi editor - ctrl+w not working



## ranjitsapre (Sep 19, 2018)

Hi All,

I am new to FreeBSD.  I have just started to learn about the vi editor from a book.  It has a command ctrl+w to delete the last typed word.  It does not work for me.  However it works fine on another Linux machine of a friend.  What am I missing?  Is there some keyboard mapping that needs to be done?  Thanks in advance.


----------



## iSiek (Sep 19, 2018)

Hi,

as far as I know FreeBSD is deployed by default with pure *VI *editor whilst Linux distributions uses VIM and VI is just an alias to this.
By default VI is very limited in functionality. To get better overview just use

`man vi`

and check what is supported by ti. If you wish you can install VIM on FreeBSD but I would not recommend as it does have vulnerabilities reported by `pkg audit`

Regards,
Krzysztof


----------



## SirDice (Sep 19, 2018)

On a lot of Linux distributions vi(1) is actually vim(1). On FreeBSD vi(1) is actually nvi. So there could be various implementation differences. 

That said, ctrl-w on FreeBSD's nvi(1) works as expected. The only noticable difference seems to be that on Linux' vi(1) the characters are visibly removed, on FreeBSD only the cursor moves (but the characters are deleted nonetheless).


----------



## SirDice (Sep 19, 2018)

iSiek said:


> If you wish you can install VIM on FreeBSD but I would not recommend as it does have vulnerabilities reported by pkg-audit(8)


I don't know how old your system is but the last issue with vim(1) stems from 2016: http://www.vuxml.org/freebsd/pkg-vim.html
Maybe you should update.


```
root@c1:~# pkg version -vR | grep vim
vim-console-8.1.0342               =   up-to-date with remote
root@c1:~# pkg audit
0 problem(s) in the installed packages found.
root@c1:~#
```


----------



## kpedersen (Sep 19, 2018)

Perhaps also look into editors/vim-tiny (without all the gvim / X11 cruft). Less moving bits means less bugs / security issues 

I imagine the only potential security issues with Vim these days involve the vim-server stuff to automate it with scripts (I think it uses a network socket). Luckily vim-tiny is vim without that kind of thing compiled in.


----------



## ranjitsapre (Sep 19, 2018)

Thanks all.  I will try out the stuff given in each of the replies once I reach home.  Right now I am just amazed to get so much help within just a couple of hours of posting the question.  u guys r awesome !!


----------



## iSiek (Sep 19, 2018)

SirDice thank you for your spot light on that


> I don't know how old your system is


I have 10.4 and 11.2 versions but when I checked the VIM version, it appeared outdated, that's why I can see vulnerability :/


```
vim-lite-7.4.979 is vulnerable:
vim -- arbitrary command execution
CVE: CVE-2016-1248
WWW: https://vuxml.FreeBSD.org/freebsd/c11629d3-c8ad-11e6-ae1b-002590263bf5.html
```

Now it is clear why. I am going to update this soon.

Regards,
Krzysztof


----------



## ranjitsapre (Sep 20, 2018)

Thanks all.  With latest version of vim all issues are resolved


----------



## SirDice (Sep 20, 2018)

iSiek said:


> I have 10.4 and 11.2 versions but when I checked the VIM version, it appeared outdated, that's why I can see vulnerability


vim-lite was renamed to vim-console quite some time ago. The -lite was a bit of a misnomer.


----------

