VsCode Terminal - How to clear terminal scrollback buffer - windows 10 - node.js

I have googled this but not found an answer. Everytime I do a new operation I get the results of older runs. The terminal selected is powershell.
when i clear the screen cls in command line it does clear the screen but after next command I get stale data. It's annoying. Is there a way to clear the buffer in Windows 10 OS

I'm new with VSCode, and also just recently googled for an answer because the bug really bugs me XD but haven't found an answer so I made a way myself.
P.S. I'm also new with Stack Overflow so I'm sorry in advanced if I suck at explaining and commenting. XD
P.S. I'm not really sure if it'll work with yours but you can try it because it worked for me.
Apparently, you can actually clear the terminal including the scroll buffer by doing this in order:
Use the Terminal: Clear command.
Use the cls command in the terminal.
By knowing that, we can now make a keyboard shortcut for it because we're lazy XD.
But first, we need an extension to enable multiple commands for a key because VSCode doesn't really have a support for that.
Download the multi-command extension for VSCode.
Then after that, put this in your settings.json.
"multiCommand.commands":[
{
"command": "multiCommand.clearTerminal",
"label": "Clear Terminal",
"sequence": [
"workbench.action.terminal.clear",
"workbench.action.terminal.sendSequence",
{"command": "workbench.action.terminal.sendSequence", "args": {"text": "cls \u000D"}}
]
}
]
And also this, in your keybindings.json. You can use any key for the shortcut. Ctrl+K doesn't work for no reason. But you can experiment as much as you like.
{
"key": "ctrl+shift+k",
"command": "extension.multiCommand.execute",
"args": {"command": "multiCommand.clearTerminal"},
"when": "terminalFocus"
}
The only problem is that when there are already characters in the terminal, it'll be included in the send sequence, so just press the key twice. Or can someone recommend me a solution for it cause I'm lazy. XD

Related

Sublime Text 3 toggle on/of side bar shortcut

I want to have a shortcut for showing/hiding the side menu, because I mainly use sublime on a flipped monitor.
I tried this but it doesn't work...
[
{"keys": ["ctrl+alt+q"], "command": "show_side_bar"}
]
t
The command is actually toggle_side_bar.
This can be discovered for any command or action by opening the console (Ctrl`) and running
sublime.log_commands(True)
Run whichever commands you wish, and the command names along with any runtime parameters will show up in the console. When you're done, it's usually a good idea to run
sublime.log_commands(False)
to avoid your console filling up with nonsense, such as every single key you press.
By the way, there already is a keyboard shortcut for showing and hiding the side bar: CtrlK,CtrlB. That means hit CtrlK, release them, then hit CtrlB.

Vim freezes consistently for several reasons

Vim freezes and I see a key sign as I have circled in the picture below when doing the following things
When opening a new file in terminal vim, especially a cpp file.
When terminal vim is left idle for a few seconds
When I click outside the terminal window and then click back into terminal vim.
Ctrl-c unfreezes vim.
This is 100% reproducible on terminal vim, and not reproducible at all on MacVim. I am on MacOS.
When vim is launched from MacOS terminal app (and not iterm), I get a blinking key, and vim freezes just the same.
Please help me unfreeze vim, I've been digging for a while and not come up with anything.
Maybe one of your plugins/custom config is playing the devil here. Would you try and see if the same problem exists while running vim without any custom configurations, like :
vim --clean
if it works as expected, then you should definitely take a look into your .vimrc and start cleaning it.
If the error persists even after running vim clean, then what i would have done would be to check if the shell configs (like .bashrc,.bash_profile etc) for unwanted settings that directly/indirectly affect the working of vim.
As a last resort to avoid confusion, you should also try to debug whether you have given any custom setting for your terminal emulator. Try reinstalling your terminal emulator or run it clean and see if it helps.

Sublimetext find usages, references

I'm using SublimeText3 and wanted to know if there is an option (package) which can be used to
Find references within the file.
Find references within the folder.
Goto definition.
I found a command called Goto->Reference, but this does not work for the current file and seems buggy.
I also found a package called wordhighlighter which is very useful.https://github.com/SublimeText/WordHighlight. I want to use this to navigate among highlighted words. Is there any keyboard shortcut to achieve this? There is an option to expand and collapse the selection but thats about it.
For someone else who comes up with the same issue, I found the answer here
How to navigate between instances of selected text in Sublime Text 3?
{ "keys": ["alt+super+g"], "command": "find_under" },
{ "keys": ["shift+alt+super+g"], "command": "find_under_prev" },

Sublime Text Command Palette for playing macro

Is it possible to play a saved macro using the command palette?
I know that it is possible to assign a keyboard shortcut to a macro but that is another thing to remember and not very feasible when you have more than a few macros.
Yes, it is possible. You need to save your macro to a file at ../sublime-text-3/Packages/User/YOUR_MACRO_NAME.sublime-macro. Then add the following code to file ../sublime-text-3/Packages/User/Default.sublime-commands:
[
{
"caption": "ADD TEXT TO BE DISPLAYED ON COMMAND PALETTE",
"command": "run_macro_file",
"args":
{
"file": "res://Packages/User/YOUR_MACRO_NAME.sublime-macro"
}
}
]
I haven't been able to run a macro from the command palette but I have found the Macroptimize package to be helpful in running my macros - one hotkey gives you a list of defined macros to choose from. Not quite what you're looking for but perhaps it will be helpful.

Change or disable modifier key (alt) which activates the application menubar in Sublime Text 3 Linux

I am trying to use the package "Alternate VIM Navigation" in ST3 on Linux Ubuntu, but the alt+i and alt+h keybindings bring up the find and help menus rather than their movement keybindings:
{ "keys": ["alt+i"], "command": "move", "args": {"by": "lines", "forward": false}},
{ "keys": ["alt+h"], "command": "move_to", "args": {"to": "bol", "forward": true}},
I have been able to disable the alt key from displaying the application menubar using CompizConfig Settings Manager, but the alt+i still brings up the find menu (and likewise for alt+h).
I have looked in many places for an answer to this, but have found nothing that works for ST3 in Linux. Here are some related answers for OSX and Windows, and an answer in Ubuntu that suggests the CompizConfig Settings Manager:
https://askubuntu.com/questions/553687/change-or-disable-modifier-key-alt-which-activates-the-application-menubar
Change behavior of Alt key in Sublime Text 2
Stop Alt key bringing up the menu in Sublime Text 2
Any solution to this in ST3 for Linux would be much appreciated!
This worked for me:
Open Sublime's packages directory by going to Preferences > Browse Packages.
Open the User directory and create a file called Main.sublime-menu
Paste the following in:
[
{
"caption": "Help",
"mnemonic": "",
"id": "help"
}
]
Save the file and enjoy!
I found a bit of a strange workaround...
I have a sublime text package called "SubRed" which has a file "Main.sublime-menu" (it's in .config/sublime-text-3/Packages/SubRed - I manually installed the package).
To disable the menubar all I have to do is:
ctrl+shift+p view: toggle menu (which does not disable the menu by
itself for some reason),
open the Main.sublime-menu file in sublime,
save it.
Then voila, the menu bar is gone and I can finally use my Alternate Vim package key bindings without conflicting with the alt+[menubar mnemonic].
To get the menu bar back if needed, just simply do ctrl+shift+p view: toggle menu.
If anyone could suggest a better solution based on this (which doesn't involve a random 3rd party package) that would be much appreciated!
The ideal solution would be to not have to disable the menubar, but get it to work like windows where user or package defined st3 keybindings take precedence over default or system bindings. So if "alt+i" is defined by the package as "move up a line", then it no longer opens the "Find" menu, but actually (eureka!) moves up a line! But opening the "Find" menu is still possible with "alt, i" in sequence.

Resources