Really, you don't have to use nano nor vim

I know this is a silly topic, but hey, it needed to be said somewhere:

When you’re editing your *.conf files, as long as their preferences are carefully set up correctly, your desktop text editors can usually be used instead of brutally minimalist and brutally oldschool text editors such as nano. The same goes for vim. You don’t need to use those.

We live in modern times now, and it’s okay to edit your *.conf files with featherpad, or mousepad, or geany, or gedit, etcetera. If you remember how to avoid the risks, heck, you could probably even use notepad++ in WINE or abiword.

The main pitfalls to avoid are the auto-formatting options.
But as long as you turn off all of the “automatic edits”, and make sure that you’re still reading/writing with a standard LINUX text format, say maybe UTF-8 without BOM, with linux linefeeds/formfeeds (I hope I got that right),… then it will be okay. Right?

UTF-8 is the standard “encoding”, and tends to be okay or even expected.
You can even paste ASCII text into a UTF-8 file and it will be okay, if I understand this correctly… As long as it’s saved as UTF-8 and has proper syntax and pragmatics and semantics, then you’re gold. A quick web search claims that *.conf files are often in a syntax similar to xml. But that’s different from ENCODING.

Stuff to avoid is of course settings for compatibility with microsoft windows systems, or specific “document” formats. Also to be avoided are optionals to add lines or to autocomplete syntax. You probably ought to avoid spelling and grammar checkers too if they are automatic. Of course converting tabs or spaces should be disabled too. What you need is the most simple and basic interaction without auto-saving backups or trying to do too much. Do you get what I’m saying?

Personally, I like using featherpad, because it’s easy to set up once you get used to it, and can open/write files without sudo permission. This isn’t a problem, because it doesn’t actually violate sudo/file protections: When you’re ready to save your changes, it will ask for your sudo password, kinda like pkexec, and only after you enter your password, will the changes be saved.

The advantage of using featherpad is; then you don’t have to drop into superuser mode just to edit a *.conf file. Instead, you navigate to the file and open for changes just like it was any other file. You only use your password if you otherwise don’t have access to the file. Featherpad is great that way; it handles the file permission gracefully without violations and without transgressions.

Another option is to use gedit. Gedit’s main advantage is that it has the ability to sort lines built in.

Or, you could use mousepad, which is installed by default on some distros.
Or, you could use pluma…

I think you see where I’m going with this.

As long as you’re not corrupting your own files with extra or missing data; as long as you’re not saving in the wrong text format; as long as words or lines aren’t missing, it’s going to be fine.

We have these fancy programs, why not use them?
Vim and nano still are celebrate and have their usage cases, I think for cron jobs maybe? But you don’t have to use those for basic configuration file edits.

The recently used items menus, the search and replace functions, the ability to pick legible fonts, etcetera… are all reasons why maybe you’d want to use more advanced text editors than vim or nano.

If you’re somebody who wants Linux to be user-friendly, please don’t recommend nano or vim, but instead teach people how to configure their advanced text editors to be safe enought to use on system configuration files.

Abiword might be a bit too complex, but hey, maybe not.

Thanks, that is all. :slight_smile:

P.S. - I know this technique works fine, because I’ve been editing GRUB and *.conf files and mirror lists for years now without nano and without vim. I even tend to remove those from my system installs.

Of course, there are plenty other nice efficient text editors so you might find different ones that you like that have other advantages too!

#pluma #mousepad #geany #featherpad #vim #nano #gedit

kate is a QT editor included with Plasma and properly supports polkit - ie; saving protected files and prompting for password.

Actually kate is closer to an IDE but uses kwrite as an engine of sorts.

kwrite is also included with Plasma and similarly supports polkit.

For the terminal micro is easy to use and has things like mouse support and common shortcuts (ctrl+c, ctrl+q, etc).

And while we are on the terminal it should probably also be mentioned that whenever necessary something like sudoedit should be preferred.

I have been using l3afpad to do my editing and have not run into a problem yet.

Thanks for the responses guys! I appreciate it.

Got me thinking, too. How could I have forgotten leafpad! Also, I didn’t know about sudo -e / sudoedit.

Any other decent text editors that are nice to use when editing *.conf’s or mirrors?

I’ve recently been using Sublime Text(sublime-text-4) for graphical text editing, which supports polkit authentication. It’s only been a couple weeks since I switched to it but I’ve been extremely impressed with it so far. Though it’s also one of those editors like kate that is more IDE than pure text editor, which is fine with me but worth mentioning.

For minimalist terminal editing that supports authentication, I’ve just used micro for a while and it does the job. I never really cared for nano either so I deselect it from the application list when installing CachyOS.

micro > nano :sign_of_the_horns:

The obvious choice is emacs :wink:

j/k if I was starting from scratch, with zero prior knowledge/experience, I’d probably lean towards micro, personally.

Relevant xkcd..

I don’t have to use Emacs I choose to, mostly out of spite, these days. Plus a crippling case of sunk-cost fallacy.

I get the part about nano - working the way it does (with all the extra steps) - “for extra caution” - but that’s exactly what i dislike about it, rather annoying imo. Never really tried Vim - cause tried Micro after being annoyed with nano - and Micro really hit the spot - terminal wise (simple and efficient).

As for graphical editor like Featherpad - used for edit a system file, that works too - by using sudoedit to avoid running the whole GUI as root (which can sometimes mess up file permissions in your home folder). So hey, if anyone used featherpad with sudo - you should run the following command - to see if you messed-up - if any files in your home folder leaked into root ownership:

find $HOME -user root

If it finds any results (shouldn’t find anything) - just run the following to fix them:

sudo chown -R $USER:$USER $HOME

Then run find $HOME -user root again - to see if they’re fixed. Or, just to be safe: find ~/.config/featherpad -user root 2>/dev/null I mean, If Featherpad was ran as root - it might have claimed ownership of its own configuration folder inside your home directory. If that command returns anything - it means your normal user can no longer save preferences (like themes or window size) in Featherpad because root “owns” the config.

Personally, i changed the abbreviation for sudoedit - to auto-fill-itself when typing se (+ space bar), with the following command: abbr -a se sudoedit - which I also added to config.fish - with following command:

micro ~/.config/fish/config.fish as in:

well, alongside featherpad - as can be seen above:

set -gx SUDO_EDITOR featherpad abbr -a se sudoedit

Which makes Featherpad - the default sudoeditor :slight_smile:

is anyone really recommending vim as user friendly? Let’s be real - the main new user advice people offer about vim is how to exit. And the main recommendation people make of nano is “it’s there and you can figure out how to save and edit”.

If someone’s making substantial enough edits to config files that an “advanced” editor really matters (and vim can obviously be an advanced editor…significantly more so than featherpad for example…) then the “friendly” discussion has already become a bit complex.

Those aren’t really great examples of advantages.

  • If I’m making a quick one-off edit of a config, I probably don’t want it taking up space in a menu. And when you’re opening config files from a terminal they’re accessible to reopen in your history.
  • nano and vim both have search/replace
  • you should have a legible terminal font…and you have just as much control over that as you have over the one in your text editor.

Of course this isn’t to say that there aren’t reasons to choose a GUI editor (or a different TUI one like micro) if you prefer. Use what you’re familiar and comfortable with (or comfortable learning, or use across the range of tasks you routinely do).

cron isn’t different from any othet config file (other than not being installed on cachy as default).

Terminal editors are useful because you’re already in the terminal. it’s quicker and involves less mental context switching to just make a quick config edit and then e.g. restart the service to apply it than opening new windows, waiting for them, navigating around, etc. And they’re useful because they work the same without any extra prep whether you’re operating on your local computer or remotely over ssh.

There’s a reason that the most-recommended editor in this thread seems to be (by a large margin) a terminal editor (micro). GUI editors are kind of a pain for most quick config file edits.

LOL, that brings back some painful memories… micro FTW!! nano is a close second IMHO.

It was claimed polkit was properly supported by featherpad in the opening post.

Otherwise I would have been more explicit about not using it with elevated privileges.

But apparently this is not so.

While sudoedit is preferable over sudo you still should not really be running any GUI application with/as root/sudo.

Because, yeah, you can mess up permissions.

But also because its wildly unsecure.

Thanks guys, for pointing out the more in depth topics. Sorry for some confusion.

To be fair, I wasn’t talking specifically about running a program as root, in fact just the opposite.
Featherpad itself(?) handles the security/password part right before it writes to disk, if and only if the password is correct. But I’m not very knowledgeable about how this is accomplished–

it sounds like that’s what polkit authentication support is? I believe Featherpad is using that protocol, right? Or am I mixing things up?

I’ve never used sudoedit, and don’t know anything about it.
However, different topic–I have used pkexec on some GUI programs and sometimes it works, other times it fails gracefully. I understand there are risks but I don’t think I’ve caused any damage over the years. I used to drop into root mode just to delete system files. But lately I just do it the normal way, not using thunar nor catfish. And to be real, catfish doesn’t allow running as root anymore anyways. Thunar can be run as root, but warning messages show up in both the GUI and on the terminal. But again, I realise that’s risky and contraindicated (we’re not supposed to do that).

But what I love about Linux is that there’s multiple ways to accomplish the same goal(s).

One way that I know that I did mess up permissions though, was trying to run PCmanFM over sudo. I did that several years ago and I wasn’t able to recover from that mess.

Again, just to avoid confusion… I’m not advocating for running GUI’s as root either. I was just trying to hilight (clumsily) how Featherpad can be run as a normal user and it will automatically call upon the system to ask for password (only if needed) if you’re otherwise about the change a restricted file. It’s nice and elegant. Until you guys responded, I didn’t know of any other text editors that did that.

I will try and learn more on this topic. Also, I wasn’t talking about menus nor adding menus.
Peace and good will.

P.S.-I think cron uses nano by default? Right? When you do the normal process of creating/editing a cronjob it automatically goes into nano? Or, does it just happen to use a similar minimally responsive technique. Whichever it is, I’ve noticed that none of the common modern keyboard commands seem to work (and definately no mouse commands) except for Ctrl-Z or Ctrl-C, but those are system level.
I can’t figure out the proper keyboard behaviors and I don’t have nano or sed keyboard commands memorized. I do, however, have common stuff memorized. (arrowkeys, pagekeys, clipboard commands, ctrol-q or q to exit, etc). I’m definately NOT used to using alphabetical or punctuation keys as control keys.

You must learn how to use “vi” as that is the standard text editor for the majority of UNIX / Linux servers without a GUI. It’s like knowing DOS before Windows.

Ah shucks, I forgot to mention vi (!!!).
Actually, to be honest, that’s the other one that I tend to avoid like the plague.
I get vi and nano mixed up with each other.

I get that it would be an advantage to know how to use vi, but I wouldn’t call it user-friendly and it’s certainly not modern. Personally, I get too confused about proper command/interface syntax if I start learning too many interfaces/commands. It’s a bit easier when multiple programs use the same or similar conventions for syntax and interactivity.

Programs like vi are exactly why I started this thread, LOL.

The idea of insert mode is probably the biggest hurdle to using vi*.

That and the joke of ‘now knowing how to exit’ .. I might as well state here that its :q. Or :wq if you want to write (to the file) and quit.

I was also going to share a video that goes over the history of text editors in unix/linux and specifically points out the lineage of ed but I cannot find it (easily) right now.

assuming the vi config is modern enough to use arrow keys in addition to hjkl, of course.

And basic keybindings (and modal access to functions which overlaps with insert mode) being neither obnoxiously self-documenting like nano nor using bindings likely to be familiar with new users like micro.

Even if those bindings are actually quite nice and capable.

While I share your passion for using a desktop editor most of the time, I would like to point out one glaring issue. You really should learn to use a common CLI editor as well for the rare occasion when something breaks badly.

Having the ability to fix your OS when you can’t get to that GUI depends on knowing how to navigate a CLI editor, and trying to learn one “on the fly” isn’t the best option at that moment.

That’s the biggest benefit of nano - instructions are printedon the screen as standard.