hydrargyrum / eye

Edit Your Editor: a scriptable Qt-based text editor - mirror of https://gitlab.com/hydrargyrum/eye
Do What The F*ck You Want To Public License
15 stars 1 forks source link

Feature request: search/run command by name #16

Open e3krisztian opened 6 years ago

e3krisztian commented 6 years ago

Emacs: M-x Vi*: ESC : Sublime Text: control-shift-p

http://docs.sublimetext.info/en/latest/extensibility/command_palette.html

hydrargyrum commented 6 years ago

I'm not sure to understand what it does, it seems there are diverse things in it. Sublime's command palette lists a few customizable commands or does it also add stuff to the menubar?

BTW, there's an REPL console in eye (though it really lacks autocompletion). Use this sample config:

import eye.widgets.eval_console
from eye.connector import *
from eye.helpers.qt_all import Qt
from eye.pathutils import getConfigFilePath

@registerSetup('eval_console')
def consoleConfig(console):
    console.line.setHistoryFile(getConfigFilePath('eval_console.history'))

@registerShortcut('window', 'F2', Qt.WindowShortcut)
def popConsole(win):
    if not hasattr(win, 'console'):
        console = eye.widgets.eval_console.EvalConsole()
        win.console = win.addDockable(Qt.BottomDockWidgetArea, console)
    win.console.show()
    win.console.widget().setFocus()

In this REPL, there are a few variables set, for example editor points to the currently focused editor widget, window points to current window, eye is already imported.

Is it something like that you're looking for? Or are you rather looking for a place to type simpler commands like saveFile, instead of Python code like editor.saveFile()?

e3krisztian commented 6 years ago

It is something like this, but both simpler and easier to use

It is a replacement for menu. E.g. if I want to replace tabs with spaces in a file, I type ctrl-shift-P ind here ind will match the command "Indentation: Convert to Spaces" or ctrl-shift-P wr for "Word Wrap: Toggle". ind and wr are substrings with character omissions of the selected command names.

It is highly usable: compare these key-presses with remembering which menu to look for these commands and navigating there. It also makes commands discoverable, as typing something usually lists more related commands/operations.

hydrargyrum commented 6 years ago

If this popup bases its completion entries, I have a thing I'll push to experimental branch. However, the standand menus are quite empty. Another helper could fill the menus with a set of common tools (like the ones you used as example: word wrapping etc.).

hydrargyrum commented 6 years ago

(Sorry for the wrong closing, I reopened is) Another possibility would be to propose completions based on slot names in the editor widget for example.

e3krisztian commented 6 years ago

I think this feature is most useful if all of the editor functionality is available through it (thus needs to search/filter the command registry), and menus/shortcuts only provide a well selected, greatly reduced set of functions.