Shortcut, set filetype Geany - editor

Every time I create a new file I have to select the file type manually via Document->Set Filetype->.....
Is there a shortcut or a custom command I can use to select programming language to pascal fast?

I'm glad you asked. The same annoyance bugs me every I create a new file to write a Bash script. So, I worked out a solution.
If you're using a Linux system, you can set up a custom command to call xdotool to do the job. If you don't have it installed, it should be available in your distro's repo. With xdotool, you can simulate a sequence of keypresses to do the work of selecting Pascal for you.
Go to Edit > Format > Send Selection to > Set Custom Commands
Click the Add button
Enter the appropriate xdotool command in the Command edit box (see below)
Hit the Enter key (Important! If you don't hit Enter, Geany won't save what's in the box.)
Click the OK button
The exact command to select Pascal on my Geany installation is...
xdotool key alt+d t p Page_Down Up Up Up Up Up Up Up Return
...but make adjustments if needed.
You'll also want to set a keyboard shortcut to run the custom command. (Important! The new document needs to have focus for the custom command to work.) You can try Ctrl+1, which is supposed to be the default keyboard shortcut for Custom Command 1, but it wouldn't work on my Geany installation for some reason. If you have the same issue, then...
Go to Edit > Preferences > Keybindings
Scroll down to "Send to Custom Command 1"
Click the Change button
Press the combination of keys you want for the shortcut
Click the OK button
Test the shortcut (Geany seems weirdly strict about what key combinations will work, so you may have to try a few. I got it working by choosing Alt+1.)
If you're using Windows, where xdotool isn't available, I'd probably try out xdotool-for-windows first, and if it didn't work out I'd see if something listed at AlternativeTo would serve the purpose.

There's commander plugin for Geany (geany-plugin-commander package on Debian-based distros). It basically makes all menu items, including Set Filetype, searchable. Don't forget to set the shortcut for the "command palette" menu after installing/enabling the plugin.

Related

docker-dive extension for VsCode - error trying to run

I installed the "docker dive" extension in VsCode. I aready had the Docker extension installed (which it requires). The docs say that Dive will run when an image is selected in the Docker extension images list. But that does not happen.
I entered "dive" in the command palette and "Docker:Dive" came up. I selected it and it displayed a list of my images for me to select one. When I did that, a new terminal window opened and tried to run dive my_image_name.
Then Powershell displayed the error: dive : The term 'dive' is not recognized as the name of a cmdlet, ....
It's looking for "dive" in my PATH.
I'm confused. Docker Dive is an installed extension. Why should it also need it in my PATH? And if it really needs it, what is the path of the executable?
You need to install dive first. Just check the repo and you should be ready to go github.com/wagoodman/dive
For Windows users. From the releases page https://github.com/wagoodman/dive/releases/
you need to find the Assets and download the windows one. Like https://github.com/wagoodman/dive/releases/download/v0.10.0/dive_0.10.0_windows_amd64.zip
You unzip the file and then you can create a folder on your C drive called dive, like C:\dive. Copy the executable dive.exe intoC:\dive
Then you need to add that folder address into your PATH. For that you need to go to
From there you click on Environment Variables, then to System variables; from there you click on the Path variable and then on Edit. On the Edit window, add a new entry, with tyhe New button; the add C:\dive and click Ok button.
Then close and re open Visual Studio Code. Now the extension should work as intended.

TFS check as default - overwrite writeable files and overwrite all files for get specific version

How can TFS be configured to select by default the two checkboxes "Overwrite writeable files that are not checked out" and "Overwrite all files even if the local version matches the specified version" when doing a Get Specific Version?
I am using TFS 2013. My real goal is to automate the process of right clicking a folder, selecting Advanced, and then clicking the two checkboxes. I have created a keyboard shortcut to pull up the window for Get Specific version, but I also want to have the two checkboxes selected by default. I do not want this scripted through the command line as I still want to have the window popped up and manually perform the final step to hit the Get button. Ideally the whole process would work something like Alt-G to pull up the Get Specific Version window, and then manually hit the Get button to complete the action.
There is not option to change this default setting. Even though you don't want to use command, it seems using command line is the only way to automate the process.
tf get-overwrite
tf get-force
https://msdn.microsoft.com/en-us/library/fx7sdeyf(v=vs.120).aspx

shortcut key for diffing a file in Visual Studio Code?

What is the shortcut key for diffing a sourcefile in VSCode?
Seems like I can only do diffs from the Git View
On top of that I seem to only have the ability to right-click and Open Change, so no seemingly obvious shortcut key from there as well.
Ideally what I would like to do is have the diffing ability on the explorer view or from the git view via shortcut key?
With the update to 0.3.0 there is now a command to diff the opened file to another file. You can assign a keybinding to it, the command id is workbench.files.action.compareFileWith
There is a special tool for diffing, not sure it answers your question though.
https://visualstudiogallery.msdn.microsoft.com/d8d61cc9-6660-41af-b8d0-0f8403b4b39c

Xcode rebuild on changes`

How can I make Xcode automatically build when I save changes to a file?
I may have to stop developing for apple if I need to hit that stupid play button/ reach for a mouse one more time.
I am so desperate that I have even considered using Java.robots to click the screen for me on git commits
Look at Jenkins - This does exactly what you want. It's a bit of a faff to get it set up the first time, but it will save you hours in the long term.
You can build without running by hitting (CMD+B) by default. The default behavior of the IDE is to save modified files upon build, so if you just want to save and build all the time, just hit build, and it will do both for you.
You can even modify the shortcut key for build to be cmd+s if you really want to by opening up XCode preferences (Cmd+, by default, or going to the "XCode" menu in the top left and selecting preferences), and go to the keybindings section and change the "Build" action keybinding to be cmd+s

How to keep fsi.exe open after running

I have a bunch of F# scripts (fsx) that I use for my basic deployment needs. I just right click them and say "Run with F# interactive"
However, sometimes the script fails and I would like to keep the interactive console running. So far I haven't figured out a nice way to achieve that.
I tried starting up the fsi.exe manually but then how can I launch my script from there?
If you are hackish enough, you may want adding just another Explorer context menu item similar to Run with F# Interactive, but keeping the console window open after .fsx script terminates. Here is the working outline of how to achieve this for Windows7/VS2012:
being admin open regedit and find the key HKEY_CLASSES_ROOT\VisualStudio.fsx.11.0\shell
add new subkey with some unique name, like openRunCmd, make (Default) value for this key whatever you like to see in context menu, maybe Run with Fsi in shell
finally, add subkey HKEY_CLASSES_ROOT\VisualStudio.fsx.11.0\shell\openRunCmd\command and set (Default) value for this subkey to the following line:
c:\windows\system32\cmd.exe /Q /K %%USERPROFILE%%\fsx.bat "%1"
Now, close regedit, go to your home directory and create there a batch file fsx.bat with the following line:
"C:\Program Files (x86)\Microsoft SDKs\F#\3.0\Framework\v4.0\Fsi.exe" --quiet --exec "%1"
After these mods you would be able to click on any .fsx script with right mouse button, pick Run with Fsi in shell and have the shell window staying after script termination until you close it. With few small adjustments the same approach would work for VS2010.
Just be careful to adjust details, if your system settings differ from ones above. Good luck!
Update: For those who want to try this at home or at work I've posted a detailed walk-through here.
#load "myScipt.fsx";;
should work I think. But myself i prefer just to have separate console window (cmd.exe), from which i can run fsi myScipt.fsx and see the output.
I have created a windows shortcut with
Target:
cmd /k "C:\Program Files (x86)\Microsoft SDKs\F#\3.1\Framework\v4.0\Fsi.exe" deploy.fsx
Start in:
C:\FolderContaningFsxScript
This keeps the window open if the script fails so I can see any compile errors. It also keeps the window open if the script runs successfully which might or might not be desirable.
I find it easier to just click the shortcut instead of Right Click > Run with F# Interactive. I think a batch file with the above command would work as well.

Resources