注意:

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

News:Better Experiences: Ego and Vim

From Funtoo
Jump to navigation Jump to search

Better Experiences: Ego and Vim

Info on Funtoo's new personality tool called 'ego', and user-focused updates to vim's defaults.

By Drobbins / April 27, 2015

Hello Funtoo Users,

In this news item, I'm going to introduce you to a couple of changes to Funtoo Linux: ego, the new Funtoo Linux personality tool, and much-needed updates to vim defaults.

Ego

ego is Funtoo's new personality tool, designed to eventually replace the venerable eselect. I created a new meta-tool to replace eselect because eselect has a couple of design issues. It requires extensions to be written as shell scripts, which is a big limitation. With the advent of Funtoo's modular profile system, eselect profile was becoming cumbersome to use, and I needed to make the tool faster and more feature-rich. Ultimately, shell scripts are too slow and too hard to use to implement advanced functionality.

ego is a meta-tool that works similarly to eselect. Typing ego will show a list of available commands. Some of the benefits of ego over eselect are that ego modules can be implemented in any language. In addition, the ego architecture is designed so that the modules are themselves stand-alone commands, which allows you to access these sub-commands using shortcuts. For example, epro is a shortcut for ego profile.

Epro

The first and currently only module for ego is called epro, which can also be called using ego profile. This new extension replaces eselect profile on Funtoo Linux systems. It is implemented in Python, which allows it to hook directly into the Portage python API for accessing information about your Portage settings. It also allows epro to implement some fairly advanced functionality to make your experience with Funtoo's modular profile system much more pleasant. There are several big improvements, detailed below.

Enhanced Setting

With epro, profile selection is much improved. To set your system flavor to desktop, type:

root # epro flavor desktop

To add or remove mix-ins, type:

root # epro mix-in +foo -bar

And subarches can be set similarly to flavors:

root # epro subarch amd64-bulldozer

There is no longer a need to refer to a particular profile by number.

Enhanced Show/List

Possibly the nicest improvement found in epro is the new list and show commands. eselect profile used to show profile info in a long numbered list, and it had bugs related to showing profiles that were automatically enabled by other profiles. All this has been addressed in epro.

The new "show" mode will not only display your Funtoo Linux profile settings, but will also display what mix-ins and flavors have been enabled automatically via inheritance:

Epro-show.png

In addition, the new "list" mode lists all available profile settings in a compact yet very useable form. In addition, directly enabled settings are highlighted in bold cyan, and have an asterisk appended, while settings enabled via inheritance are highlighted in cyan:

Epro-list.png

The enhanced list and show commands should make your experience with Funtoo Linux profiles much more pleasant :)

Vim Defaults

Gentoo's vim defaults haven't been touched since 2005, and there is some room for improvement. By default, modelines are disabled due to a long-fixed security bug. There are a lot of people in the Gentoo community who are very anti-modeline, and this appears based on the perspective that modelines are a security risk. However, this perspective appears to be based on a security issue in vim that was addressed about a decade ago.

Funtoo's upcoming changes to vim's defaults include:

modelines
Enable them.
tabs
Set to display as a width of 4 by default. Also, turn off expandtab by default.
status line
Enable a useful blue status line by default, which displays encoding, language, line position, and other useful information.
display tabs and whitespace
One of the big challenges with a text editor is being aware of when a tab is a tab, and when it's a bunch of spaces. Now, by default, tabs and trailing whitespace will be displayed using ---> and ~ respectively. So you'll always know when you're really getting tabs. And you'll be able to identify trailing whitespace, which can be important in certain situations, such as when editing hostapd.conf, which doesn't like trailing whitespace.
comments in cyan
Instead of using dark blue for comments, which is nearly invisible on many terminals, use cyan.
F3 to turn auto-indent and display of tabs and whitespace off/on
Pressing F3 will turn off auto-indent as well as display of trailing whitespace and tabs. This allows text to be easily copied (without extra characters) and pasted (without indenting problems.) This is set up as a toggle, so prior to copying or pasting code, you press F3, take care of business, and then press F3 again to re-enable editing-friendly features.
Relaxing Gentoo's ebuild rules
No longer enforce 78 character word-wrap when editing ebuilds.

Here's what it all looks like. Here's vim in its default state with the new settings, displaying tabs and with auto-indent enabled:

Vim-edit.png

...and after pressing F3, here's the same window, with auto-indent disabled for pasting, and no visible tabs and extra whitespace for copying:

Vim-paste.png

Look for these changes soon, and let me know how they work for you.

Best Regards,

Daniel Robbins, BDFL.