How would one go about setting up some hotkeys for commonly used SVN actions such as diff?
Currently to view diff, I have to select file(s), then right click, navigate to TortoiseSVN and then select Diff action. Quite a few steps for something used often.
Instead, I would like to select file and use hotkey(for example Ctrl-Alt-F) to do the same Diff action.
Searching for solutions, I have found some people running AutoHotKey scripts to do similar things, but it seems like an overkill.
I made a hotkey shortcut(using standard Win 7 method of creating a shortcut then adjusting its properties) to run TortoiseMerge, which is the tool that displays the diff, but such a shortcut ignores current file selection and brings up a blank TortoiseMerge.
Any ideas to try?
You can modify the TortoiseSVN context menu and place your favorite commands at the root of the context menu. This way you have only to click twice for a diff. Not that much, I think.
Another option would be to use an advanced file manager (like Total Commander or FreeCommander) which enables you to define custom menu commands with custom hot keys.
In Total Commander this would be "Change Start Menu":
Command: C:\Program Files (x86)\TortoiseSVN\bin\TortoiseProc.exe
Parameters: /command:diff /path:%P\%N
Shortcut Key: CRTL+ALT+F1
Whether shell context menu or hotkey, you need at least 2 steps to run a TortoiseSVN command:
Select the file (selecting and right clicking to open the context menu is a single action)
Run the command (click on the context menu item or press the shortcut key)
From this point of view it's just a question of your personal preference: should I click twice or should I click once and leave the mouse for pressing a key? ;-)
Autohotkey is overkill for a single key, but you can collect the hotkeys for actions you might perform in any window type all in a single script. As a result, you can have hotkeys perform fairly complex actions in one class of windows, and the same hotkeys perform different actions in another window type using the '#IfWinActive' directive.
For example, this URL mentions adding hotkeys for commit and update; you could add a key for your diff need, and perhaps one for log or some other svn option you perform frequently.
For some reason, bringing up the explorer context menu is slow for me in Windows 7. Adding these hotkeys really improved my workflow.
Note: you can also prefix that URL's example code with the following:
GroupAdd explorers, ahk_class ExploreWClass
GroupAdd explorers, ahk_class CabinetWClass
#IfWinActive ahk_group explorers
And suffix it with:
#IfWinActive
And those specific hotkeys will execute the TortoiseSVN-specific commands when Windows Explorer has focus, and be passed through in all other cases.
You could try directly calling the process with the correct parameters instead of worrying about right-click context menus.
For example, I was able to set up a shortcut directly to the following item:
"C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:update /path:"c:\Source"
From there, you can call this shortcut from your hotkey program, or if you prefer a out-of-the-box solution, map a folder directly to the task bar (I labeled mine "o" for aesthetics) and stick that shortcut in this folder.
Theoretically, you could have one shortcut per operation, per repository.
Looking at the problem more generally, I'd say that this is a workflow issue. Presumably the reason you want to find a quicker way of finding diffs is because you want to do it for a number of files. In that case, go to the root of your working copy and choose TortoiseSVN -> Check for modifications. That will show you a list of changed files. Do get the diffs, just double click on each.
Install the StExBar, then add commands for diff/update/commit/... and specify the corresponding TortoiseProc.exe command.
And of course assign a hotkey for the command.
You can use context menu shortcuts.
Just open code folder in explorer and use below:
Commit: alt + F + C
update: alt + F + U
Check for updates: alt + F + T + F
So you can press above keyboard shortcuts to commit instead of having to right click directory then click commit.
Related
On my windows pc, I would just double click a folder and click "Open in VS Code" to a open a folder, which saved time for me when looking through lots of code online. With Mac, however, I do not have this option. I have to directly open vscode and click "Open" to open a new folder. How do I directly open a file in vscode through finder in macOS?
2023 Update - Use Native Method
Open the Command Palette (Cmd+Shift+P) and type shell command to find the Shell Command: Install 'code' command in PATH command.
Restart all terminal sessions for the new $PATH value to take effect.
You'll be able to type code . in any folder to start editing files in that folder.
If you want to do it in Finder, you can write an Automator script to do it (it's easier than it sounds, AND shows you the power of the OS).
Launch Automator
Create New Document
Create a new Quick Action
Add the Action... (New Method - 10.13+)
Workflow receives current files or folders from Finder.
Add a new "Open Finder Items" action to the workflow. (drag the "Open Finder Items" object, highlighted in the screenshot, to the empty window on the right)
Select "Visual Studio Code" from the list.
Add the Action... (Old Method)
Workflow receives current files or folders from Finder.
Add a new Run Shell Script action to the workflow. (drag the "Run Shell Script" object, highlighted in the screenshot, to the empty window on the right)
Configure the Workflow (Old Method)
Set the Pass Input to be as arguments
Paste the following in the input box:
open -n -b "com.microsoft.VSCode" --args "$*"
Save the action using a name like Open in Visual Studio Code.
You may now right-click on the folder and find your newly created task under Quick Actions.
The simplest solution is to create a Quick Action with Open Finder Items:
This way you don't need a shell script that might break with an OS update or VS Code update
Launch Automator and select Quick Action or File > New > Quick Action If Automator is already open.
Set Quick Action receives selected to files or folders and in to Finder.
Choose an Image (icon) select Choose.. and double click Visual Studio Code in the window that pops up, this will set your quick action icon to the same as VS Code
Add Open Finder Items, Choose open with as Other.. select Visual Studio Code and save your Quick Action as Open in VSCode optionally choose an Image for your Quick Action job done.
Finally just hit Cmd+S to save and name it Open with VSCode
Well you need to understand. macOS has different ways to do things than windows and initially it might be a challenge. For starters you start to make use of Terminal. its beautiful.
Now answering your question.
Open your VS code and then, press CMD + SHIFT + P, type shell command and select Install code command in path. Afterwards, navigate to any project from the terminal and type code . from the directory to launch the project using VS Code.
Using the new shortcuts app.
Download:https://github.com/gluedpixel/shortcuts
Or create it by yourself
Open Shortcuts app > Quick Actions
Change from receive any to Files and Folders
Add run shell script action
Paste the code open -n -b "com.microsoft.VSCode" --args "$*"
Change input to Shortcut input
Click on Shortcut input and set type to "Folder" & Get to File Path
There are some ways suggested here in the VS Code GitHub Issues tracker, but I would go with the first option of dragging the folder onto the app icon if you have VS Code icon in your dock!
If you really want to be able to do so from a right click, then this repository has a workflow solution. https://github.com/Sankra/OpenFolderInVSCode
Drag and drop the folder from Finder onto an empty VSCode window.
Found a way to achieve a 'Quick Action' that met my needs using the following steps using MacOS' Shortcuts app (No Automator needed):
if you are looking for screenshots as well, I wrote a small Notion page
Open the ‘Shortcuts’ app on your Mac
On the Left Pane, navigate to ‘Quick Actions’
On the top bar, press the ➕ button to add New Shortcut.
Click on ‘Any’ and change to ‘Files and Folders’ by selecting only those from the dropdown that appears on clicking the ‘Any’ field.
Click on ‘Action Library’ on the right pane and search for ‘shell’. Drag and drop the ‘Run Shell Script’ onto the main pane. This will add the action to the Shortcut’s flow.
In the shortcut details (on the right pane), make sure Use as Quick Action is ticked and so are ‘Finder’ and ‘Service Menu’.
In the newly added action called ‘Run Shell Script’ write “code “ and right-click to get the below pop-up, go ahead ‘Insert variable’ and then ‘Shortcut Input’.
Click on the ‘Shortcut Input’ tag that appears. A pop must appear, choose ‘File Path’ and just click anywhere else. This will change the tag to ‘File Path’.
Set ‘Pass Input:’ option to ‘as arguments’.
Be sure to set a cool name for your new Shortcut! I named mine a boring “Open in VSCode”.
Open a new ‘Finder’ Instance, right-click on a folder, go to ‘Quick Actions’ > ‘Customize...’
Make sure your Shortcut’s Name is selected. Exit the dialogue and Test!
There is a Terminal command named code, I would stick with it and you should get used to it as well if you are regularly using VS.
Follow the one-time setup with-in VS Code
Open your VS code and press ⌘ CMD + SHIFT + P
Type shell, and select Shell Command: Install 'code' command in PATH from the list
Open Terminal and hit any of the commands below:
code <path-to-folder>
OR
cd <path-to-folder>
code .
OR
cd <path-to-folder> && code .
I've actually managed to have it as an icon you can just add to the Finder window as such:
The script will allow you to open the current folder path in VSCode.
The steps to do so are:
Create a new Application with Automator
Select the "Run shell script" from the menu and drag it to the editor
Paste the following small script to the text area:
finderPath=`osascript -e 'tell application "Finder" to get the POSIX path of (target of front window as alias)'`
open -n -b "com.microsoft.VSCode" --args "$finderPath"
Save the Application to the Applications folder
Right click the app and drag and drop your desired VSCode icon to the blank area to the left of the name and close the Get Info window
Press and hold the Command key and drag the Application to an empty space in the Finder title row like in the picture
Test that it works by pressing on the icon. VSCode should now open with the content of the current folder in the navigation bar
Here is an alternative derived from the accepted answer.
Indeed the accepted solution by #jnovack just opens VS Code for me, but not the desired folder. If VS Code is already running it just switches the focus to a running instance of VS Code.
Solution
Provided that you have the code CLI command installed (if not, go to VS Code and do CMD+SHIT+P>"Shell Command: install 'code' in PATH")
Then open a terminal and run which code. You should get the code executable path looking somethin like /usr/local/bin/code
Then, as per #jnovack 's answer,
Open Automator
Create a new Document (CMD+N)
Create a new Quick Action
Workflow receives current files and folders from Finder.
Add a new Run Shell Script action to the workflow. (drag and drop the "Run Shell Script" object)
Pass input as arguments
Paste this code in the shell command field /usr/local/bin/code -n "$*" or replace with your path to the code executable if it differs from this one.
Save the action
Tbh. I would have expected to be able to use just code -n "$*", but for some reason, the PATH used by the automator's shell seems to be different from that used in the terminal. I'd welcome some input on that matter.
I find this to be the best solution out there:
https://github.com/RoadToDream/SzContext
Alright so I recently did a clean install of visual studio and one thing changed from last time.
With vs2019, I think, came the different looking "Search History". Here are two screens of what exactly I mean with that. New looking history and here is the old one
I'm just not sure why now I only get the old one. I found out that the new one only appears with CTRL + SHIFT + F and the older one with regular CTRL + F. Is there are way so that the default CTRL + F window displays the same output window? (the newest one)
At first I didn't really like it that much, but now I prefer it. I'm running VS2019 Version 16.5.2.
Edit: And also, this is where I used to get the table version if anyone was wondering. Now it's just this old text thing.
In the "Find in Files" tool window, ensure "Find results table" is selected, not "Find results 1 window":
You can customize the keyboard shortcut.
Go to Tools\Options
Navigate to Environment\Keyboard
Under "Show commands containing", type Edit.FindinFiles
Under "Press shortcut keys", press the desired keyboard shortcut (i.e. in your case Ctrl+F)
Click Assign and then OK
See screenshot here
Tools > Options > Environment > Preview Features > Check "Use
Previous Find in Files"
Ctrl+Shift+F > Open Result options > Select
"Find results table"
Close the Find and Replace tool window and
revert the aforementioned "Use Previous Find in Files" setting
(optional)
Perform a search (either Find in Files or simply through
the standard Ctrl+F find prompt) Your results will then appear in
the advanced tabular "Find results table" window.
Presumably this setting is also found elsewhere but I haven't been able to find it without turning off the Find in Files preview feature.
https://stackoverflow.com/a/63789479
When I try to use the shortcut for moving lines up/down (Ctrl+Alt+Shift+↑/↓), it highlights the code and shows the tooltip message "Use Up/Down to move text line" but nothing happens. If however I try the same command via the menu bar (Resharper > Edit > Rearrange Code > Move Up) it moves the selected lines as expected.
I used to use this feature all the time so I find this bug very annoying. Apparantly, others also experience this (see comments for Resharper move line up down not working) but I haven't been able to find a solution for it. Resetting keyboard layouts and reapplying VS keyboard schemes doesn't work.
Has anyone been able to resolve this issue?
[EDIT]
Reason of this is issue (when you are logging to machine with VS and Resharper via Remote Desktop) is that Ctrl-Alt-Left Arrow/Ctrl-Alt-Right Arrow combinations are not sent to your virtual machine
There are two workarounds:
My first soultion (change combination see below)
You can use AutoHotKey script as stated in thread:
https://superuser.com/questions/327866/remote-desktop-sending-ctrl-alt-left-arrow-ctrl-alt-right-arrow-to-the-remote-p
[/EDIT]
Reason is
duplication of the same hotkeys which could be found in 'Shortcut currently used by:' combobox
Fix is
I described process for _MoveRight shortcut - for other shortcuts it works the same
STEP 1 Check for conflicting changes
seeImage
go to Tool --> Options --> Keyboard
in field 'Show commands containing' find your command (moveright in example)
click in field 'Press shortcut keys' press ALT + RIGHT ARROW
in field Shortcut currently used by you will find conflicting shortcut -
Edit.CompleteWord...
STEP 2 Now we need to delete this shortcut
in field 'Show commands containing' write Edit.CompleteWord
you should see ALT + RIGHT ARROW shortcut in field 'Shortcuts for selected command
click Remove button
STEP 3 Now we need to add our shortcut to _MoveRight function
in field 'Show commands containing' find your command (moveright in example)
click in field 'Press shortcut keys' press ALT + RIGHT ARROW
click Assign
There's an external command I'm using constantly - basically launching a batch file. I'd like to put a toolbar button (and possibly keyboard shortcut) for this into the IDE. Is there an easy way to do that?
First, add an item to your Tools menu by choosing Tools, External Tools, and filling out the dialog, like this:
Then bring up Tools Customize, click the Keyboard button at the bottom, and find the appropriate external tool number:
All the configured external commands in VS are available to add to a Toolbar or Menu through the Tools>Customize menu as "External Command ##". You just need to know which number corresponds to the particular command you've configured. I believe it is in order of entry in the external commands list.
Similarly, you can find those names in the commands list in Options>Environment>Keyboard and assign a shortcut to your command that way.
On Eclipse, whenever I double click a tab, it fills the workspace (by hiding all other views like project tree, console, etc).
Is there any way to do this on Visual Studio?
Note: i'm not looking for full screen, just want a way to declutter the workspace but still have access to menus.
Are you after this?
Set shortcuts for the Window.AutoHideAll function and for the Window.ResetWindowLayout function. In order for the ResetWindowLayout to work, you have to export your settings (make sure you select "All Settings") with all windows expanded and then import them again.
ResetWindowLayout will restore all windows to the way they were the last time you imported your settings.
Not with double click on tab, but you can do the same with Shift+Alt+Enter key combination.
This keyboard shorcut was changed to F11 from 1.9.1 vscode version.
All keyboard Shortcuts: https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf
I was looking for that, as well, and I now just got used to using full screen (Shift+Alt+Enter), which hides a little too much, which you seem to think, as well, but does in fact still show the menus.
Looks like drby got it on this one. Just FYI. I pinged the VS team to ask about this and here is the response:
"There is no way to reverse the command automatically. For it to work as a toggle we would need to save which toolwindows were auto hidden and which ones were not when the command was run, which we don’t do (it would cause lots of interesting persistence questions, across profiles and VS sessions)."
The idea of a "Unhide All" command is what I suggested. So if you hide all then you can unhide all as well. There might be some windows you don't want to unhide but the 1 or 2 extra windows is better than not having an unhide IMHO.