Sublime has built-in auto complete. It works fine, but I would really like to know how to disable autocomplete popup but still be able to cycle through completions using Tab with word under cursor changing right away?
You should be able to achieve this with a combination of two settings, shown here with the default values:
// When enabled, pressing tab will insert the best matching completion.
// When disabled, tab will only trigger snippets or insert a tab.
// Shift+tab can be used to insert an explicit tab when tab_completion is
// enabled.
"tab_completion": true,
// Enable auto complete to be triggered automatically when typing.
"auto_complete": true,
auto_complete controls whether the autocomplete popup appears automatically or not, so setting that preference to false in your user preferences will stop the popup from appearing unless you manually cause it to appear with the appropriate key binding (the default is Alt+/ on Linux and Ctrl+Space everywhere else).
Regardless of the value of that setting, if tab_completion is set to true (which it is by default) then that command will try to insert the best matching completion at current cursor location, and as long as you don't move the cursor or take any other actions you can continue to press Tab to cycle between all of the available completions.
Related
I was reviewing several pages but I can not make Sublime Text 3 have a hot key where you can show and hide the Tabs quickly, read this link where it talks about it but it seems that there is no such combination, someone who could do it ?
Pd: I do not want to do it from the menu, i want is by keyhots
In order to bind a key to this, you need to know what command to use in the key binding. The easiest way to determine that would be to select View > Show Console from the menu to open the console, then enter sublime.log_commands(True) to turn on command logging, and execute the command that you want to bind.
In this case, that would be View > Hide Tabs (or View > Show Tabs, depending on if they're visible or not), which allows us to see this in the console:
>>> sublime.log_commands(True)
command: toggle_tabs
Armed with the command, you can select Preferences > Key Bindings and add your own key binding in the right hand pane, such as this one:
{
"keys": ["ctrl+alt+t"],
"command": "toggle_tabs"
},
Naturally you can choose any key binding that you'd like here. Once you do this, the menu command and the command palette entries for toggling the tab state will show the key you selected next to them to remind you.
Note that if this is your first custom key binding, you want to make sure that you add the binding inside of the [ and ] characters that will appear in the file. If you have other bindings, make sure that you separate each binding with a , character.
I am trying to write in some comments for this project, but every time I hit the tab button, it automatically changes the files extensions from "rb" to "Ruby"
How do I get it to stop doing that?
It's because Sublime has "tab completion" enabled by default, as described in the config:
// When enabled, pressing tab will insert the best matching completion.
// When disabled, tab will only trigger snippets or insert a tab.
// Shift+tab can be used to insert an explicit tab when tab_completion is
// enabled.
"tab_completion": true,
So you could either set tab_completion to false in your custom settings, or use shift+tab to insert an explicit tab.
I’m currently writing an MFC dialog app which has a menu. The menu displays correctly and the menu entries work correctly via mouse, accelerators, and hotkeys (e.g., to quit: Ctrl+Q or Alt+F,Q).
Unfortunately, the Enter key doesn’t seem to work. That is, pressing Alt+F will open the File menu and pressing ↑ will highlight the Quit entry, but pressing Enter will not select it.
I know that using menus in dialog apps can be a bit tricky, but I’ve done this successfully before. However, that was a long time ago with a customized VS wizard, so I am trying to remember how to do this from scratch. I tried checking my old code, but could not find anything in reference to VK_RETURN. (No, there’s nothing special in PreTranslateMessage.)
These two questions are related, but they want the dialog to receive the key, I need the menu to get it.
Does anyone know what the problem is and how to fix it?
I'm making a Vim Script. I want to make a popup that offers alternatives. It should work the same as the Omni-popup, but not replace the string or go through the omni functions. Like this:
I've haxxed in the functionality I need by using the completefunc and the auto command event CompleteDone, just to get the popup. But it's really ugly and messy, since I'm not using it for auto completion.
Is there a way to use this popup but with full control, not going through the omni-complete functionality? Like populating it with values and receive the value selected?
I know you can just place the alternatives in an other buffer and just grab the input from there. But it disturbs the work flow, I want a popup.
The insert mode popup menu is only meant for completions, as you've correctly found out. There is not other precedence for popup menus as a general selector in Vim, so such functionality is not there and is difficult to emulate. (In GVIM, one can populate a right mouse button popup menu, but this would need to be triggered by a mouse key press.)
The "Vim way" would be to :echo the list of menu items and query (via getchar() or input()), or just use confirm() or inputlist(). Examples built into Vim are the query in :tselect.
Plugins often use a split scratch buffer to build a more elaborate menu; this can even be combined with 'completefunc', as any text entry into the scratch buffer is discarded, anyway.
The FuzzyFinder - buffer/file/command/tag/etc explorer plugin uses this, and even provides an API for custom uses, cp. :help fuf-callbackitem-mode. That's certainly worth a look, though the menu would still be located at the top, not inside the current buffer.
Do either of these do what you want?
:help inputdialog()
:help inputlist()
i.e. to show a value (let's say, for the purpose of this example, set tabstop? ... 8), but when that value changes to show the changed value?
I'm playing with Vim to see if I could setup a menu which would display some of my more used settings to save up on set setting? ... any ideas?
I also find it a little bit unusual to put settings values into the menu (a menu item usually is associated with an action that is triggered by selecting it), and would also recommend using either the 'statusline' (for settings that you want to see in parallel for each open buffer) or 'titlestring' (for settings that you only need for the current buffer).
You can use the :menu and :unmenu command to dynamically create and update menu items. Unlike the above mentioned mechanisms, however, Vim will not automatically trigger the updates; you have to do this with :autocmds on the appropriate events (e.g. CursorHold) yourself.