Linux mint set default editor

Как сменить редактор по умолчанию

Когда поставил себе цель уметь пользоваться чем-либо то нужно сразу же переключиться на задуманное, а не время от времени. Вот так и я. Я решил, хочу более сносно ориентироваться при использовании редактора именуемого vim, а раз так то ниже пошаговые шаги по воплощении задуманного. Все дальнейшие действия происходят на рабочей/тестовой системе Ubuntu Trusty Desktop/Server.

Ранее я постоянно использовал редактор nano, а теперь хочу VIM.

$ sudo apt-get install vim -y

$ sudo update-alternatives —config editor

Есть 5 вариантов для альтернативы editor (предоставляет /usr/bin/editor).

Выбор Путь Приор Состояние

* 0 /bin/nano 40 автоматический режим

  • 1 /bin/ed -100 ручной режим
  • 2 /bin/nano 40 ручной режим
  • 3 /usr/bin/mcedit 25 ручной режим
  • 4 /usr/bin/vim.basic 30 ручной режим
  • 5 /usr/bin/vim.tiny 10 ручной режим

Нажмите enter, чтобы сохранить текущий выбор[*], или введите выбранное число: 5

update-alternatives: используется /usr/bin/vim.tiny для предоставления /usr/bin/editor (editor) в ручной режим

Но и после этого при вызове sudo crontab -e все равно открывает редактирование через редактор nano, а я хочу через vim, как тогда сделать это?

touch: невозможно выполнить touch для «/home/ekzorchik/.selected_editor»: Отказано в доступе

$ ls -l /home/ekzorchik/.selected_editor

-rw-r—r— 1 root root 66 Jul 18 15:26 /home/ekzorchik/.selected_editor

$ sudo chown ekzorchik:ekzorchik

Select an editor. To change later, run ‘select-editor’.

Источник

Linux Mint Forums

Welcome to the Linux Mint forums!

Changing default text editor in Linux Mint 14

Changing default text editor in Linux Mint 14

Post by blueplastic » Thu Nov 22, 2012 11:21 pm

Hi, I following this tutorial to install Sublime Text 2 sucessfully:
http://www.technoreply.com/how-to-insta . -04-unity/

I basically edited the /usr/share/applications/defaults.list file and replaced all instances of gedit.desktop with sublime.desktop.

But upon reboot, the defaults.list file seems to be reloaded with gedit.desktop instead of sublime.desktop.

Is there some way I can make the settings stick in the defaults.list file beyond reboot?

Re: Changing default text editor in Linux Mint 14

Post by cwsnyder » Fri Nov 23, 2012 7:16 am

Yes, don’t use the method you used to change the default. Instead, choose a text file you want to edit in a file manager, right click the file, select Properties >> General tab >> Open With pull-down box and select either Sublime Text, if it is listed, or Other Application . . . if it is not to bring up a full list of known applications and find Sublime Text. Once that is changed, the default editor for those type of files will be Sublime Text.

Читайте также:  Mac os x mach one

The /usr/share/applications/defaults.list is only changeable by root and is reset at every login from a list which is dependent on who is logging in.

Re: Changing default text editor in Linux Mint 14

Post by zeddock » Sat Dec 08, 2012 6:41 pm

Are you saying that sudo gedit to change the defaults.list file will not hold through a reboot, but that a GUI approach will?

Re: Changing default text editor in Linux Mint 14

Post by cwsnyder » Sat Dec 08, 2012 8:27 pm

@zeddock, I am saying that I think the /usr/share/applications/defaults.txt is not the governing file, but may be changed during the boot process depending on the actual user login. I have seen this occur as blueplastic reported. What the GUI does is change not all users defaults, but seems to set up a preferences configuration file in the individual’s /home/ / folder someplace (again, I haven’t investigated enough to know where) which overrides the global default.

I don’t want to imply that a GUI is better than the CLI, but first you have to know exactly what file is the controlling configuration file. As an analogy, look at the GRUB 2 system.

There probably is a more ‘elegant’ solution, but I went with what I found to work which was simplest. I know, no cookie, and no geek credit.

Источник

Change default system text editor in Ubuntu or Linux Mint

Pick a different text editor for Linux Mint or Ubuntu

Here’s how you can quickly change the default system text editor in Ubuntu or Linux Mint. 1. Open a terminal window. 2. Type in this command and then hit Enter: sudo update-alternatives —config editor 3. You’ll see a list of editors appear in the terminal window. 4. Select the number of the editor you want to use, then hit Enter.

For more, see the original article at the link below.

This story, «Change default system text editor in Ubuntu or Linux Mint» was originally published by ITworld .

Jim Lynch is a technology analyst and online community manager who has also written for many leading industry publications over the years, including ITworld, InfoWorld, CIO, PCMag, ExtremeTech, and numerous others.

The opinions expressed in this blog are those of Jim Lynch and do not necessarily represent those of IDG Communications, Inc., its parent, subsidiary or affiliated companies.

Источник

How do I change the default text editor?

How can I change my default text editor from gedit to Emacs?

12 Answers 12

Here is what worked in my case:

  1. Right click on a text file.
  2. Choose «Properties» (not «Open With. «)
  3. Click on the «Open With» tab.
  4. Choose your new text editor.
  5. Mark chosen text editor using a button «Set as default».

This also works on 12.04 and 13.04.

@ Edit: based on comments it does work on all distros until 20.04

To change default text editor across the file types, try updating gnome-text-editor configuration.

A more robust solution would be to replace the bindings in /usr/share/applications/defaults.list .

Right click on a text file, point to «Open With» and it’ll show other editors in a sub-menu. Click on «Other Application. «. It’ll show you a dialog with a list of applications, select Emacs and make sure the «Remember this application for «plain text document» file» option is checked. Click «Open».

I don’t use a DE, but for my configurations the next command is the best:

  • it selects your default sensible-editor from all installed editors
  • must run with current user
  • you must have more than one editor in your system

If you are working from the terminal then I would add the following to your .bashrc file (or the config file for your favorite shell):

You can set the default text editor for a specific user in #

For global configuration for all users you have to modify the /etc/gnome/defaults.list

If you would like to replace gedit with any other text editor for all file types, the easiest is to edit the defaults.list file located here:

Just find and replace all gedit.desktop references with your own editor (in this case emacs.desktop ). You need root permissions to edit the file. So, just do:

Save the file, close it and it’s done.

On Ubuntu 20, you need to change the gnome-text-editor alternatives link from gedit to the one you want. However, there usually is only one such editor detected so update-alternatives —config won’t work; you’ll have to add the editor you want.

E.g. to add notepadqq :

For some reason I had to use xdg-mime :

you can use your system-wide .desktop files under /usr/share/applications/ or local files under

To set Pluma as default text editor for all user (global):

sudo sed -i ‘s|text/plain=gedit.desktop|text/plain=pluma.desktop|g’ /etc/gnome/defaults.list

Not the answer you’re looking for? Browse other questions tagged default-programs or ask your own question.

Linked

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.10.8.40416

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

Change default Linux / UNIX text editor from VI to Pico

Q. I find vi hard to use. How do I change my default text editor from vim / vi to Pico under Debian Linux?

A. To use and change an editor to edit your text message, set the variable EDITOR to the pathname of the vi / vim binary file. You need to use export or set command for the same purpose.

Many Linux / UNIX command read shell EDITOR environment variable to determine which editor to use for editing a text file.

  • No ads and tracking
  • In-depth guides for developers and sysadmins at Opensourceflare✨
  • Join my Patreon to support independent content creators and start reading latest guides:
    • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
    • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
    • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
    • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
    • How to protect Linux against rogue USB devices using USBGuard

Join Patreon

Set default text editor to pico

Type the command as follows:
$ which pico
Output:

Now setup a new text editor:
export EDITOR=/usr/bin/pico
OR
export EDITOR=pico

Add above line to

/.bashrc file:
$ vi

/.bashrc
Append text as follows:
export EDITOR=pico
Close and save the file. There is no no need to reboot system.

Also you can add alias if you want:
alias vi=/usr/bin/pico

🐧 Get the latest tutorials on Linux, Open Source & DevOps via

Category List of Unix and Linux commands
Documentation help • mandb • man • pinfo
Disk space analyzers df • duf • ncdu • pydf
File Management cat • cp • less • mkdir • more • tree
Firewall Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04
Linux Desktop Apps Skype • Spotify • VLC 3
Modern utilities bat • exa
Network Utilities NetHogs • dig • host • ip • nmap
OpenVPN CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04
Package Manager apk • apt
Processes Management bg • chroot • cron • disown • fg • glances • gtop • jobs • killall • kill • pidof • pstree • pwdx • time • vtop
Searching ag • grep • whereis • which
Shell builtins compgen • echo • printf
Text processing cut • rev
User Information groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w
WireGuard VPN Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04

Comments on this entry are closed.

just a small suggestion:
alias pico=’nano -w’

thats because not every distro has pico symlinked to nano (nano is the open source pico) and because nano by default wraps long lines (-w).

also someone might be interested in seting TERM to linux
export TERM=linux
so he can use home/end/delete and numpad correctly in nano and also in shell

Источник

Читайте также:  Как майкрософт создает windows
Оцените статью