eye icon indicating copy to clipboard operation
eye copied to clipboard

Feature request: search/run command by name

Open e3krisztian opened this issue 7 years ago • 5 comments

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

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

e3krisztian avatar Dec 16 '17 17:12 e3krisztian

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()?

hydrargyrum avatar Dec 17 '17 00:12 hydrargyrum

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

  • simpler in that it is not possible to to compose anything, even arguments can not be given
  • easier as there is autocomplete - or rather select as you type

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.

e3krisztian avatar Dec 17 '17 17:12 e3krisztian

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 avatar Dec 23 '17 10:12 hydrargyrum

(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.

hydrargyrum avatar Dec 23 '17 10:12 hydrargyrum

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.

e3krisztian avatar Dec 25 '17 20:12 e3krisztian