How to set gedit as my editor for fish

my config file goes as is:

function fish_greeting
	set_color red
	echo -n "THINK"
	set_color cyan
	echo -n "4"
	set_color magenta
	echo -n "YOURSELF"
	set_color blue
	echo -n "Question"
	set_color yellow
	echo "Authority"
end
fastfetch

alias home "cd ~"

set -gx EDITOR gedit
set -gx GIT_EDITOR gedit

why won’t it open my config.fish file with gedit? it keeps using vim i think it is… i find that confusing and wanna keep it simple.

THANKX 4 any help in advance!

What “keeps opening” vim ?
If you were opening something from the terminal you would often just use the command of the program you want to use; ex micro somefile.
What action is performed to open ‘config.fish’ ?

PS.

If this means your shell configuration file .. this will only affect things you do in the terminal.
IE: These things, like setting those variables, only happens when you start your terminal emulator program.

1 Like

right i agree with everything you said… example me opening something sudo gedit fish.config

that’s how i would do it in the terminal

i want my default app to open things with gedit as well

so if i just went fish.config

i want it to open with gedit by default without typing the command

in the fish shell i thought this was doable by setting it in the fish.config file but maybe i am wrong LOL

EDIT maybe it is set to gedit now that i look at this:

odd maybe it is solved and i didn’t know it… hmmmmmmmm

nope i typed in edit config.fish and it opened in vim :frowning:

  • A. You should never launch a GUI program with root/sudo
  • B. The file referenced is in your $HOME and privilege-escalation should be avoided there
  • C. Many modern editors (kate, gedit, micro) have proper polkit implementation and so simply attempting to save a file to a protected path will prompt for a password. No special launching options or similar required.

Stop doing it that way.

I dont know too much about fish shell.
But it sounds like you probably want these variables to be global.
If so then put them in /etc/environment or ~/.config/environment.d/*
These files accept VAR=VAL entries, one per line.

PS.

Since sudo was mentioned.
You might want to set SUDO_EDITOR=/usr/bin/micro or similar and practice the use of sudoedit. With the env var set then you can just do;

sudoedit /path/to/some/file

This is easy to remember/do, is at least as secure as regular sudo, and affords extra safeties like not mangling permissions and working on a temporary file before applying changes.

1 Like

thank you! for real, i really apreciate your help

1 Like

Sorry I couldnt give more fish-specific help.

And one of these days I’ll write a proper tutorial for both environment variables and sudoedit.

1 Like

it’s all good i am figuring it all out as i go along. i am actually having a complete BLAST learning about the fish shell! anyway back to editing my .config file… it is SO FUN! learning so much… HEHE

I did, too. I love the FISH shell. I’ve been using it for around 2 years. No going back to BASH for me.

2 Likes

You should refrain from setting any GUI editor as (any of) the shell’s EDITOR(s), in my opinion. Better to learn the minimal command set of nano, micro or the like, I’m thinking.

Just think what would happen if your DE crashed and you’d have to work in a “real” shell, like using Ctrl+F2, or ssh’ing into your system? No DE at all. GUI editor specified? You’re doomed

2 Likes

I never considered this but my mind was immediately blown when you said that. Not Good Errrr… I shall fix this tomorrow as my brain hurts to much from customizing stuff LRL

Good point purple friend! Thank you so much for bring this to my attention before I had a real BIG problem.

Hoping my system doesn’t crash in the mean time. Knowing my luck it will. Knock on wood.

Your right I better learn some minimal commands for nano or whatever. Right now I know none & that is obviously why I did what I did. Tomorrow I will attempt to teach myself some commands. Errr… Not looking forward to it but it is completely essential that I do. Hopefully I catch on to some of the basic commands… IDK I am not the sharpest tool in the shed when it comes to that kind of thing… though I really don’t have a choice.

THANKX AGAIN @Moonbase59 (you rock bro)

It wouldnt have been catastrophic.

But you may also want to set $VISUAL.

For whatever its worth heres how I set the assorted ones;

# Editors
EDITOR=/usr/bin/micro
SUDO_EDITOR=/usr/bin/micro
VISUAL=/usr/bin/kate
DIFFPROG=/usr/bin/meld
GIT_EDITOR="/usr/bin/kate --startanon --block"
2 Likes

thank you do i do this in the terminal or the config.fish file?

dumb question i know errr :frowning:

EDIT/UPDATE - I lied I fixed it in my config.fish file - here is what I have now:

tide configure --auto --style=Rainbow --prompt_colors='True color' --show_time='12-hour format' --rainbow_prompt_separators=Round --powerline_prompt_heads=Sharp --powerline_prompt_tails=Sharp --powerline_prompt_style='Two lines, character and frame' --prompt_connection=Dotted --powerline_right_prompt_frame=Yes --prompt_connection_andor_frame_color=Lightest --prompt_spacing=Sparse --icons='Many icons' --transient=Yes

fastfetch

function fish_greeting
	set_color red
	echo -n "Reality"
	set_color green
	echo -n "is"
	set_color magenta
	echo -n "merely"
	set_color blue
	echo -n "an"
	set_color cyan
	echo "illusion,"
	set_color yellow
	echo -n "albeit"
	set_color brblue
	echo -n "a"
	set_color brcyan
	echo -n "very"
	set_color brmagenta
	echo -n "persistent"
	set_color brgreen
	echo "one."
	set_color brred
	echo "~Einstein"
end

alias home "cd ~"
alias fishy "gedit ~/.config/fish/config.fish"

I just removed the part about editors altogether so I imagine it will go to the defaults now but I will still apply what @cscs mentioned as well.

╭─    ~ ································································································································· 03:57:23 AM ─╮
╰─❯ # Editors                                                                                                                                                ─╯
    EDITOR=/usr/bin/micro
    SUDO_EDITOR=/usr/bin/micro
    VISUAL=/usr/bin/kate
    DIFFPROG=/usr/bin/meld
    GIT_EDITOR="/usr/bin/kate --startanon --block"
~/.config/fish/functions/fish_prompt.fish (line 2): Unsupported use of '='. In fish, please use 'set EDITOR /usr/bin/micro'.
EDITOR=/usr/bin/micro
^~~~~~~~~~~~~~~~~~~~^
in function '_tide_enter_transient'

╭─    ~ ································································································································· 03:57:25 AM ─╮
╰─❯ # Editors                                                                                                                                                ─╯
    EDITOR=/usr/bin/micro
    SUDO_EDITOR=/usr/bin/micro
    VISUAL=/usr/bin/kate
    DIFFPROG=/usr/bin/meld
    GIT_EDITOR="/usr/bin/kate --startanon --block"
~/.config/fish/functions/fish_prompt.fish (line 2): Unsupported use of '='. In fish, please use 'set EDITOR /usr/bin/micro'.
EDITOR=/usr/bin/micro
^~~~~~~~~~~~~~~~~~~~^
in function '_tide_enter_transient'
╰─❯ set EDITOR /usr/bin/micro
╰─❯ set GIT_EDITOR /usr/bin/kate
╰─❯ set VISUAL /usr/bin/kate

╭─    ~ ································································································································· 04:01:02 AM ─╮
╰─❯

DONE! (I think)

Funny Thank You Jim Carrey GIF | GIFDB.com

I put them as written in /etc/environment.

( You know - by executing something like sudoedit /etc/environment. )

That file is global and is not sourced when a terminal is launched but when the system starts and accepts VAR=VAL lines .. which does not seem true for your fish terminal/config.

Saw your home alias above. An astonishingly high percentage of users don’t know that just cd will beam them back to their $HOME (or ~):

[matthias@toshi-mch somewhere]$ pwd
/home/matthias/somewhere
[matthias@toshi-mch somewhere]$ cd
[matthias@toshi-mch ~]$ pwd
/home/matthias
[matthias@toshi-mch ~]$ 

This is different from Windows.

1 Like

Pretty POSITIVE that I got it set correctly now for fish that is. :slight_smile:

oh yeah your right thankx!!! hehe funny misconception/mistake


tide configure --auto --style=Rainbow --prompt_colors='True color' --show_time='12-hour format' --rainbow_prompt_separators=Round --powerline_prompt_heads=Sharp --powerline_prompt_tails=Sharp --powerline_prompt_style='Two lines, character and frame' --prompt_connection=Dotted --powerline_right_prompt_frame=Yes --prompt_connection_andor_frame_color=Lightest --prompt_spacing=Sparse --icons='Many icons' --transient=Yes

fastfetch

function fish_greeting
	set_color red
	echo -n "Reality"
	set_color green
	echo -n "is"
	set_color magenta
	echo -n "merely"
	set_color blue
	echo -n "an"
	set_color cyan
	echo "illusion,"
	set_color yellow
	echo -n "albeit"
	set_color brblue
	echo -n "a"
	set_color brcyan
	echo -n "very"
	set_color brmagenta
	echo -n "persistent"
	set_color brgreen
	echo "one."
	set_color brred
	echo "~Einstein"
end


alias fishy "gedit ~/.config/fish/config.fish"```

REMOVED as it was utterly unnecessary. :slight_smile:

1 Like

Just thought you could save typing two more letters, hee hee. Why home when you could just use cd—plus, it would work on any other Linux system, too.

1 Like

Elon Musk 100 Percent Agree GIF | GIFDB.com

@Moonbase59 you really helped me out ~ dodging a bullet (that is)

GIF matrix bullet one - animated GIF on GIFER - by Sternrunner

:wink:

Credits go to @cscs — he said all the important things! I’m probably just bringing you off-track by digressing. :wink: Sorry, didn’t want to hijack the thread.

1 Like