Zsh Shell Smart Completion (ala PhpStorm) - phpstorm

While I'm familiar with a few of the options Zsh provides for autocompletions (i.e. the standard Tab menu-complete and the Ctrl+i completion option), but I've been spoiled with the type of search/completion you can get out of PhpStorm.
For example, in a stock Laravel project in PhpStorm you are able bring up the Search Everywhere dialogue (Double Shift), type in wbp, and have the editor complete that to "welcome.blade.php". The closest I can get to that functionality with Zsh would be to type in wb, place the cursor between the two letters (w|b), and use Ctrl+i.
I have searched around and found a few custom completion scripts, but none that have this type of functionality.
So the big questions are:
1. Is it possible to have smart completion functionality in Zsh like it exists in PhpStorm?
2. If so, how does one go about enabling it?
If it's relevant, I'm using OhMyZsh on OS X 10.12.

The following setup works for me (put them in ~/.zshrc):
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
unsetopt CASE_GLOB
zstyle ':completion:*' completer _complete _match _approximate
zstyle ':completion:*:match:*' original only
zstyle ':completion:*:approximate:*' max-errors 2 numeric
Reference: zprezto

Related

How to write argument for Chrome/Chromium's '--enable-features=' flag

I am trying to modify Chromium browser's behavior in Chromium OS.
When I execute Chromium browser, I can handover arguments with '--enable-features=' flag.
And I found a argument (#enable-virtual-keyboard) from Available list in chrome://flags.
Then I executed Chromium browser like below.
example instruction # /opt/google/chrome/chrome --incognito --enable-features=enable-virtual-keyboard
And when I check the flags in chrome://version, I could see the arguments.
Command Line: /opt/google/chrome/chrome --blahblah --enable-features=enable-virtual-keyboard
But actually the virtual keyboard is not working.
When I enable the argument (virtual keyboard) from chrome://flags manually. It works well and I could see the Virtual Keyboard.
What is wrong? I would appreciate it if you guys advise me.
--enable-features actually takes the name of a feature, not the name of a flag. The Chromium documentation explains the difference, but to simplify somewhat, a flag is sort of a user-visible interface to a feature or a command-line switch.
Anyway, to do what you want, you need to find out what feature or command-line switch the enable-virtual-keyboard flag toggles. Searching for enable-virtual-keyboard in Chromium Code Search brings us to these lines in about_flags.cc:
{"enable-virtual-keyboard", flag_descriptions::kVirtualKeyboardName,
flag_descriptions::kVirtualKeyboardDescription, kOsCrOS,
SINGLE_VALUE_TYPE(keyboard::switches::kEnableVirtualKeyboard)},
That last line tells us what we're looking for: that this flag is actually backed by a command-line switch, not a feature. Clicking on kEnableVirtualKeyboard shows us its definition:
const char kEnableVirtualKeyboard[] = "enable-virtual-keyboard";
So, adding --enable-virtual-keyboard to your command line should have the same effect as flipping the flag. (I should note, though, that there are a number of things that can break the virtual keyboard, so you may have to do other things to get it working.)
For the sake of completeness, if you'd found that it was actually backed by a feature, like the gesture-properties-dbus-service flag, for example:
{"gesture-properties-dbus-service",
flag_descriptions::kEnableGesturePropertiesDBusServiceName,
flag_descriptions::kEnableGesturePropertiesDBusServiceDescription, kOsCrOS,
FEATURE_VALUE_TYPE(chromeos::features::kGesturePropertiesDBusService)},
Then clicking kGesturePropertiesDBusService takes us to its definition which specifies the feature name:
const base::Feature kGesturePropertiesDBusService{
"GesturePropertiesDBusService", base::FEATURE_DISABLED_BY_DEFAULT};
...so in that case you'd pass --enable-features=GesturePropertiesDBusService to enable the flag from your command line.

Variable completion in Octave GUI Editor

I mean to get completion of variable names, function names, function argument names, and keywords in Octave, similarly as in Eclipse CDT, e.g.
This works in the Command window, but not in the Editor, where only keywords and functions can be completed.
Official documentation indicates <Tab> and <M-?> should work.
If I press <Tab> I get a Tab character inserted.
And I do not know which is the Modifier key. Plus, I have a Spanish keyboard, so the question mark is obtained with <Shift>+', so I am not sure how will it work if I find the correct M key.
How can I enable it for the Editor?
Notes:
Help -> About shows
GNU Octave, version 4.4.1... configured for "x86_64-w64-mingw32"...
Using Octave portable under Win 10.
I found files <octave-dir>\etc\inputrc.default and <octave-dir>\share\octave\4.4.1\m\startup\inputrc
There is a file C:\Users\user1\.config\octave\qt-settings containing
...
[editor]
...
codeCompletion=true
...
codeCompletion_threshold=2
codeCompletion_keywords=true
codeCompletion_octave_builtins=true
codeCompletion_octave_functions=true
codeCompletion_document=false
codeCompletion_case=true
codeCompletion_replace=false
...
tab_indents_line=false
This refers to the speed of readline for Octave under Win. I have speed issues with readline of my Portable Msys2 under Win 10, but this is a different issue.
On the top of the editor widget, select Edit > Preferences.
Select the Editor tab.
Look for Auto Completion.
Select Match words in document.
There are essentially no references that mention completion specifically in the editor.
The only one I found, from 2014, stating that:
There is no editor completion on all known function names, nor on
parameter lists of known functions. There is an open bug report
requesting function name completion in the editor, see
http://savannah.gnu.org/bugs/?41371.
The GUI is an experimental new feature in the 3.8 release, please
consider helping to improve it for 4.0 by joining the maintainers
mailing list or participating on the bug tracker (even submitting
feature request bugs if you want).
So at that time it was not available.

Set syntax for a specific file name in Sublime Text 2/3

I have a program that uses a file called user.cfg to get its user defined configuration settings. The odd thing is that they chose the syntax for this file to be Tcl (it's not odd that it is Tcl, it's odd they chose the .cfg extension instead of .tcl). So, when I open this file in Sublime Text, it doesn't know what syntax highlighting scheme to choose.
What I would like to do is set the syntax highlighting for user.cfg to Tcl, but not all .cfg files to Tcl.
I have seen this question which is very similar to mine, except in that case the special file name had no extension so Sublime Text knew to assign Ruby highlighting to only that one file. Unfortunately, I have an extension so the solution given there will not work for me.
Is there any known way to get Sublime Text base a highlighting scheme on the full filename?
Take a look at the ApplySyntax plugin.
The previous answer is completely true; however, I thought it would be better to have it here all in one place rather than going on another webpage to find the list of procedure to apply it
Sublime text 3
This is found here
Ensure Package Control is installed. Instructions are found here.
In Sublime Text, press Ctrl+Shift+P (Win, Linux) or Cmd+Shift+P (macOS) to bring up the quick panel and start typing Package Control: Install Package.
Select the command and it will show a list of installable plugins.
Start typing ApplySyntax; when you see it, select it.
Restart to be sure everything is loaded proper.
Enjoy!

Add a new command to notepad++

Notepad++ is my go to editor for most things. I would like to develop a new command(keyboard shortcut) for doing something unique. Anybody has any pointers regarding how I can do this?
I would like to create a command which arranges selected text in certain order based on the characters found. I would also like create a keyboard shortcut for running the same command.
You have several options:
develop a macro - examine Macros dropdown menu in Notepad++
use AutoHotKey which can send keystrokes/mouseclicks, run apps/DLL's, work with clipboard, read any system settings, take values from input boxes and many more. Please see here for its sample usage with Notepad++
use JN plugin for Notepad++ and script your functionality in JavaScript - example. Similarly, there is a Python scripting plugin, too.
write your own N++ plugin. You get the best control, but without experience this is the most difficult option.

Keybinding overview for SublimeText 2?

I think the SublimeText 2 editor has a lot of potential, but I'm struggling to learn the keyboard shortcuts, because unlike Vim it doesn't have comprehensive documentation, or a command to show you what each key combination is bound to.
It's frustrating going through the .sublime-keymap files and find that 4 different packages all rebind ctrl+t for their own purposes.
So, is there a way to view all the keybindings in an organised way: by key, by package, by command - with descriptions?
Currently my hack is a bash function that shows me all the keymap lines that mention a certain key. For example, *sublime_keys '+t'* finds me all the bindings that use the letter "t"
function sublime_keys {
find ~/.config/sublime-text-2/Packages \( -name 'Default (Linux).sublime-keymap' -or -name 'Default.sublime-keymap' \) -print0 | xargs --null ack-grep -C1 "\".*$*"
}
I've tried KeymapManager but it is very limited - only shows bindings from some of the top-level non-default packages without descriptions or package context. I suppose I could take time to improve on it.
Is there a package that does this better?
I am using a package called KeyCue on OSX. I find it very helpful because I have the same difficulty in remembering all the keystrokes.
http://www.ergonis.com/products/keycue/
On the Mac, when you press and hold the "Command" key for 1 sec, a pop up window will appear and show you all the keystroke for Sublime Text 2, and all other software also. I think it scans through all the menu and show you the keystrokes.
You can also add custom keystrokes. I have added for zencoding and color picker as the keystrokes are from installed package and KeyCue cannot pick those up automatically.
The package is not free (Euro20). Well worth the price as I use it frequently and saves me lots of time.