I want to setup build system so:
If build is successful, run my program
If not, it automatically jump to the first error (i.e. as if I pressed F4 once)
Simplest way I see it is to setup a callback with
"command": "next_result"
Which would navigate to first error in case build fails.
How could I do it?
I feel it should be something very evident, but cannot find anything in build reference.
It depends on your programming language but cf this post to get the configuration for a C build (with gcc).
Then add a regex in file_regex:
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$"
This should catch and highlight all the warnings/errors produced by gcc : Sublime Text will automatically jump to the next one when you press F4.
Have a look at the documentation for more details.
[EDIT] For custom commands, you can edit the User's Key Binding file.
For syntax example, in the Default one you have:
{ "keys": ["f4"], "command": "next_result" }
where next_result is the callback called when you press F4
Related
whenever I select code and then do Cmd + c (copy) it then goes by itself to normal mode in vim. So:
How do I stop VS code from doing that?
Why is it doing that?
My default keybinding for copy paste has (go to command pellet type keybinding go to default keybindings):
{ "key": "cmd+c", "command": "execCopy" },
probably this: { "key": "cmd+c", "command": "extension.vim_cmd+c",
"when": "editorTextFocus && vim.active && vim.overrideCopy && vim.use<D-c> && !inDebugRepl" }, except it doesn't let me edit the file!?!?!
I feel the answers are longer than need.
Follow these steps:
Command palette Cmd+shift+P
Type Open Keyboard Shortcuts (not the Json one)
Nice looking file in vscode comes up like pinocchio said (see attached image)
Search cmd+c
Go the the row that has in it's column extension.vim_cmd+c
Click it and then hit backspace (or right click select remove).
Done.
For sake of context see Snippet:
without seeing your exact extension configuration and system info, it's hard to say with certainty, but you may have an extension conflicting with or overriding the default behavior.
open the command palette and type keybindings and choose the command to edit keybindings. you can search for cmd+c to see if anything else is using it, and in what context. alternatively, you can do this directly from your keybindings.json file.
also, for the sake of diagnostic, you can always launch vs code with no extensions enabled just to see if it is indeed an extension problem. if so, you can selectively enable extensions, and when you find the right one, you can look within its internal settings
As Tedskovsky suggested, go to the json file that has the keybinding. Find the last one that maps cmd+c to something. Then remove it. Though, that file can only be opened in read mode so you will need open:
Preferences: Open Keyboard Shortcuts `Cmd+K Cmd+S`
NOT THE JSON ONE (at least not in vscode):
So the first one (not the second one).
That opens a nice looking window that allows you to edit the keyboard settings. Probably the last one in that list I assume. I went to the uneditable one and found the last one and removed it (and yes as Tedskovsky suggested, it was added by the vim extension).
The name of it was:
{ "key": "cmd+c", "command": "extension.vim_cmd+c", "when": "editorTextFocus && vim.active && vim.overrideCopy && vim.use<D-c> && !inDebugRepl" },
search is somewhere in your default editable file to remove it (click and select remove).
Don't select the json file for the keyboard bindings if you want to change it.
Go to settings.json and add this:
"vim.handleKeys":{
"<C-c>": false
}
Going to Tools > New Snippet everytime I need to create a new Sublime Snippet is starting to become cumbersome. Is there a way to create a shortcut in which I can jump to the new snippet page by pressing Command + i?
Preferences -> Key Bindings - User, then add the below line:
{ "keys": ["ctrl+g"], "command": "new_snippet" }
You can replace the ctrl+g combination with anything of course.
BUT be aware: it might happen that the keyboard layout doesn't send the exact keys that the command is bound to.
To investigate this open the console at View -> Show Console or with CTRL+, and type sublime.log_input(True). Now click in the document and give your key combination a try - if the appropriate output doesn't appear in the console, you better specify another combination.
Finally, if sublime.log_input(True) bothers your coding or debugging process, you can easily disable it by clicking again in the console and using the UP arrow to get the command you typed the last type, change True to False, then hit Enter.
open the command palette, find a item named "Preferences: Key Bindings - User", open it and add this:
{ "keys": ["ctrl+y"], "command": "show_overlay", "args": {"overlay": "command_palette", "text": "Snippet: "}}
You can change the "ctrl+y" for anything you like to be the shortcut.
When using the goto function to bring my cursor to a particular line number, say 3017, how do I prevent Sublime from jumping around from line to line until I hit enter?
For instance, in that case, I would jump to the following lines:
3
30
301
3017 (finally)
Sublime Text 3 seems to have two "Goto Line" features:
one which is built in via the "Goto Anything" overlay. Internally, the command to execute this is show_overlay with the arguments {"overlay": "goto", "text": ":"}. This is the default, available from the Goto menu -> Goto Line, and with keybinding Ctrl+G. MattDMo is correct in his answer that it is not possible to disable fuzzy matching in this overlay.
one which is included in the "Default" package as a plugin and shows a small prompt panel at the bottom of the screen. Internally, the command to execute this is prompt_goto_line, with no arguments necessary. This implementation has the behavior you desire, and will only go to the specified line when you hit the enter key. It has no default way of accessing it, but read on... :)
The reason I have mentioned the internal commands above is because Sublime Text makes it possible to add or override keybindings, and also to change or add menu items, and the commands are used to instruct Sublime Text what action to perform.
Therefore, this means that you can choose to override the existing menu item and/or keybinding, (and/or you can create a new menu item and/or keybinding) to use the prompt_goto_line command. The two links I have just provided should give enough detail on how to perform these tasks, but if you would like more specific information, please let me know in a comment and I will provide it.
This feature is by design, and cannot be disabled. Most popup menus in Sublime feature "fuzzy matching", meaning you do not need to type the full search term, just a few letters (for example, pci finds Package Control: Install Package in the Command Palette). The menus also feature instant searching, which is what you are seeing. This means that you do not need to hit Enter to search, just start typing and the matches appear as you type.
I'm using a Mac for development, but 15 years of Windows experience before that means certain keystrokes are hard-wired (like Home for beginning of line, etc).
Is there a simple way to get Sublime Text 2 on my Mac to behave more like a Windows editor? I am used to Visual Studio.net on Windows.
I see two possible methods to solve your problem. The first is to find an OS X keybinding that does what you want. Then in the ST console enter sublime.log_commands(True). Then execute the command. This will give you the command so you can create a custom key binding. The second is to search for a key binding where you know the proper behavior exists in the Windows key map file (in your case home). In either case, the goal is to get a command and any necessary arguments.
You can now create a custom key binding. Go to Preferences -> Key Bindings - User. Insert the key binding you desire here. For your particular case, you would want something like the following.
[
{ "keys": ["home"], "command": "move_to", "args": {"to": "bol", "extend": false} }
]
Of course remove the square braces if you already have an entry. Additionally, you can change the keys to something else if you need to, but since you said you wanted to rebind home, I assume that is what you want.
I had a hard time getting used to Mac after I switched from Windows. Took me quite a while but you know, you have to get used to a few frequently used shortcuts.
Here are a few shortcuts.
Command +
left arrow - beginning of the line,
right arrow - end of the line,
up arrow - beginning of the document,
down arrow - end of the document.
Alt or Option +
left arrow - beginning of the word,
right arrow - end of the word.
Hope this helps.
Geany is the closest thing I can find to the perfect web development IDE. However, I can't find a way to automatically close curly brackets ({).
For example, typing:
function test()
{
..and pressing RETURN should cause this to happen:
function test()
{
// cursor ends up here (indented by 1 tab)
}
Is there anything that can make Geany do that?
This is a native feature of Geany,
Go to Preferences, then Completions, down there you can choose which one you want to auto close.
Check here for screenshots
You make something else:
If you want, open https://plugins.geany.org/autoclose.html and see "autoclose" plugin. You can install with :
sudo apt-get install geany-plugins-autoclose
and It is all
That isn't full answer to your question, but may be helpful.
I have Geany not in english, I make translations of menu's fields on my own.
Geany has a feature: when you type special text and press Tab, the text is going to be replaced with another text.
It works by default for if, else, for, while, do, switch and try.
Configuration of this feature is in [Tools]/[Config files]/[snippets.conf].
After doing some changes, save file and click [Tools]/[Reload configuration].
I added two lines to section C++:
class=class %cursor%%block%;\n
struct=struct %cursor%%block%;\n
With block=\s{\n\t%cursor%\n}
It doesn't let you press { Enter or { Tab to get
{
//cursor
}
because {=anything is ignored, I don't know why.
What you can do? You can have some another text, replaced using {\n\t%cursor%\n}, or define keybinding inserting it.
Geany can have user defined snippets. It is possible to open snippet configuration file from menu.
Tools ->
Configuration files ->
snippets.conf
Go to the language block where you want to add that feature.
For example:
[C]
if=if (%cursor%)%block_cursor%
else=else%block_cursor%
for=for (i = 0; i < %cursor%; i++)%block_cursor%
while=while (%cursor%)%block_cursor%
do=do\n{\n\t%cursor%\n} while (%cursor%)\n%cursor%
switch=switch (%cursor%)%brace_open%case %cursor%:\n\t\t%cursor%\n\t\tbreak;\n\tdefault:\n\t\t%cursor%\n%brace_close%%cursor%
At first it can be thought that the problem can be fixed just with adding this line
{=%\n{\n\t%cursor%\n}%
But Geany does not accept that when snippet is one non alphabetic character.
It will work for any other alphabetic character like this
b=%\n{\n\t%cursor%\n}% or bl=%\n{\n\t%cursor%\n}%
However I dont think it is what you want. The real solution you can find from geanys menu.
Edit
->Preferences
->Editor
->Completions
Tick the Auto-close quotes and brackets then click on apply and save
The Auto-close doesn't work if we place brackets inside another pair of brackets. For example, the inner bracket doesn't auto-close.{{|}
However, we can use the following snippet to create a block.
{={\n\t%cursor%\n}
But in order to use this snippet, we first have to include '{' char in our wordchars set by changing the below line in snippets.conf file.
wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789{