How do I set the Editor variable?

Asked by Shirish Agarwal on 2008-03-09

Hi all,
 How do I set the editor environment variable?

I tried to google this up . I came up with two ways of doing this, tried them both, dunno why they don't work or how to know if they work.

http://esofthub.blogspot.com/2007/02/set-editor-variable-for-vi.html

http://www.kb.indiana.edu/data/acnc.html

Tried both of them, dunno why its not happening or how to find out what editor it is, seems to be default vim .

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu editmoin Edit question
Assignee:
No assignee Edit question
Last query:
2008-03-09
Last reply:
2008-04-23
Shirish Agarwal (shirishag75) said : #1

This is my environment.

shirish@Mugglewille:~$ printenv
GPG_AGENT_INFO=/tmp/seahorse-cMCSlV/S.gpg-agent:12531:1
SHELL=/bin/bash
DESKTOP_STARTUP_ID=
TERM=xterm
XDG_SESSION_COOKIE=some cookie
GTK_RC_FILES=/etc/gtk/gtkrc:/home/shirish/.gtkrc-1.2-gnome2
WINDOWID=92322382
GTK_MODULES=gail:atk-bridge
USER=shirish
LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.svgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:
SSH_AUTH_SOCK=/tmp/some keyring
GNOME_KEYRING_SOCKET=/tmp/some keyring/socket
SESSION_MANAGER=local/Mugglewille:/tmp/.ICE-unix/12031
USERNAME=shirish
PATH=/usr/lib/kde4/bin:/usr/lib/ccache:/home/shirish/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
DESKTOP_SESSION=gnome
GDM_XSERVER_LOCATION=local
PWD=/home/shirish
LANG=en_IN.UTF-8
GNOME_KEYRING_PID=11992
GDM_LANG=en_IN.UTF-8
GDMSESSION=gnome
HISTCONTROL=ignoreboth
SHLVL=1
HOME=/home/shirish
GREP_OPTIONS=--color=auto
GNOME_DESKTOP_SESSION_ID=Default
LOGNAME=shirish
XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/usr/share/gdm/
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-something alphanumeric,guid=some numbers
LESSOPEN=| /usr/bin/lesspipe %s
WINDOWPATH=7
DISPLAY=:0.0
LESSCLOSE=/usr/bin/lesspipe %s %s
COLORTERM=gnome-terminal
XAUTHORITY=/home/shirish/.Xauthority
_=/usr/bin/printenv

Have edited so no numbers are known.

Please open a Terminal from the menu Applications->Accessories->Terminal and to open your .bashrc file, type:

gedit .bashrc

and add at the end of the file this row:

export EDITOR=/path/of/your/preferred_editor

Save and exit
Then please logoff and logout to make sYstem able to read your new configuration.

Hope this helps

Shirish Agarwal (shirishag75) said : #3

marcobra,
 I did that & logged out but still it didn't happen. Is there some way to know what my default editor is?

Please open a terminal and please copy and paste here the result of

env | grep -i editor

Then:
I think you are reading http://labix.org/editmoin#head-ecc12f25ecbc788e6cfa103eadf40a8991253550
I don't know editmoin but i think you must set EDITOR variable for user under editmoin run.

Thank you

Shirish Agarwal (shirishag75) said : #5

hi marcobra,
 Got the thing u asked.

shirish@Mugglewille:~$ env | grep -i editor
EDITOR=/usr/bin/leafpad

My question is precisely what u said l8er

[quote]
I think you are reading http://labix.org/editmoin#head-ecc12f25ecbc788e6cfa103eadf40a8991253550
I don't know editmoin but i think you must set EDITOR variable for user under editmoin run.
[/quote]

Shirish Agarwal (shirishag75) said : #6

how do I do that?

For your user the EDITOR env variable is set with success.

I think you must set this env var for the www-data user

If you read the /etc/passwd file (sudo less /etc/passwd ) you can find this rows:

www-data:x:33:33:www-data:/var/www:/bin/sh

www-data is the user with Apache2 web server run, i think you must put your env EDITOR variable for this user, the homepage of user is /var/www and the default shell is /bin/sh

So please using terminal type:
sudo -i
give your password, then press enter.

You have plain root access, then go to www-data homedir

cd /var/www

and try to create a .profile file and put into it this row:

nano .profile

put this rows:

EDITOR=/usr/bin/vim
export EDITOR

save and exit and try.

Hope this helps

Shirish Agarwal (shirishag75) said : #8

marcobra,
 thank you. I did all the things. The only thing I changed is I want to use gvim or better yet leafpad, is this ok?

root@Mugglewille:/var/www# cat .profile
EDITOR=/usr/bin/gvim -f
export EDITOR

I think you must not set the -f paramater or put it by putting this line
EDITOR='/usr/bin/gvim -f'
export EDITOR

Try if it works.

Thank you

I just added the following to .bashrc and it worked for me:

export EDITOR=/usr/bin/gedit

I didn't change any thing for the www-data user or use any "-f" flags any where.

Is the wiki opening in Vi or is there an error? You must make sure you are logged into the wiki.

See this link to set up a .moin_ids file so you don't need to manually log in:

http://blog.nixternal.com/2008.03.08/ubuntu-wiki-editing-made-easy/

Can you help with this problem?

Provide an answer of your own, or ask Shirish Agarwal for more information if necessary.

To post a message you must log in.