Shell problem in setting default editor to vim

pramitkumarpal

New Member

Reaction score: 1
Messages: 6

I am on

FreeBSD 10.2-RELEASE-p14 FreeBSD 10.2-RELEASE-p14 #0: Wed Mar 16 20:46:12 UTC 2016 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64

Installed vim through pkg install vim.

My Current shell is:

Code:
$ echo $SHELL
/usr/local/bin/bash

My .profile file is edited as below:

Code:
$ vim .profile
# $FreeBSD: releng/10.2/share/skel/dot.profile 266029 2014-05-14 15:23:06Z bdrewery $
#
# .profile - Bourne Shell startup script for login shells
#
# see also sh(1), environ(7).
#

# These are normally set through /etc/login.conf.  You may override them here
# if wanted.
# PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:$HOME/bin; export PATH
# BLOCKSIZE=K;  export BLOCKSIZE

# Setting TERM is normally done through /etc/ttys.  Do only override
# if you're sure that you'll never log in via telnet or xterm or a
# serial line.
# TERM=xterm;   export TERM

EDITOR=vim;      export EDITOR
PAGER=more;     export PAGER
# set ENV to a file invoked each time sh is started for interactive use.
ENV=$HOME/.shrc; export ENV

if [ -x /usr/games/fortune ] ; then /usr/games/fortune freebsd-tips ; fi

After rebooting also when I use $EDITOR same old vi opens.

Help required on how to set the shell to open vim when I use vi command.

Note:
I am coming from ubuntu
where the following happens:

1. By default only vi is installed.
2. Then when I install vim
3. And run vi
4. vim opens by default.
 

getopt

Aspiring Daemon

Reaction score: 617
Messages: 866

My Current shell is:

Code:
$ which sh
$ /bin/sh
This does not tell you the used shell. It does print the location of sh.

There are several ways to check the used shell:

echo $shell or pw usershow <user>

First be sure which shell you are using. Probably you are editing the wrong configuration file.
The default user shell in FreeBSD is csh.
 
D

Deleted member 48958

Guest


To be more precise, it's .bash_profile
.bashrc also work for me.
$ ee ~/.bashrc
Code:
export EDITOR=vim

You can also change color of your promt.
Add
Code:
PS1="\[\033[1;32m\][\u@\h:\w]$\[\033[0m\] "
to your ~/.bashrc . Then your promt will be green.
You can also change color of your "root" promt to red, add
Code:
PS1="\[\033[1;31m\][\u@\h:\w]#\[\033[0m\] "
to /root/.bashrc
waccEkJ.png

More colors here
you can also change your cursor color in bash with
Code:
echo -ne '\e]12;#215D9C\a'
#215D9C is your cursor color, to find preferable color, use graphics/gcolor2


But IMO /bin/csh or /bin/tcsh are BEST :)
 
Top