Geany snippets: change the outcome of %cursor% - cursor

I love Geany and I love Geany snippets.
However I found an annoying little quirk: the result of "a=" e.g. <a href="%cursor%" target="%cursor%" class="%cursor%"> is <a href="_" target="_" class="_". So there's a space added and a "_" in that space. Where is the %cursor% defined in Geany and how can we change it?

it is defined in snippets configuration file. This file is stored on Data folder of Geany install location which is "c:\Program Files\Geany\data\snippets.conf" on Windows.
# use %cursor% to define where the cursor should be placed after completion. You can define multiple
# %cursor% wildcards and use the "Move cursor in snippet" to jump to the next defined cursor
# position in the completed snippet.
However if you want to customize snippet file then you normally edit file of your own user which you can acess in menu:
Tool - Configuration file - snippets.conf

You may go to Edit -> Preferences -> Keybindings -> Editor -> Move cursor in snippet then set your keybinding, for me I use CTRL+]. This action quite useful when you use in snippets. It's like when you press the CTRL+], it will jump to the next _ which is %cursor%, and the _ will be selected(I mean highlighted), then you can just type anything on it without pressing Backspace.
And Geany WebDev Snippets is my version of snippets for web development(HTML, JavaScript, PHP, Vue) in Geany, you may use it if you want to. Hope it helps.

Related

'gcc' is not recognized - How to make gcc/mingw work in Windows?

The Mingw binary installation instructions (such as these) tells me to change the PATH environment variable in Windows, in order to use the gcc/g++ etc commands anywhere. This might also be necessary for some programming IDE to find the compiler. Failing to do so yields errors such as this:
'gcc' is not recognized as an internal or external command, operable program or batch file.
How do I do this specifically in newer versions of Windows (10/11) and which path should I use?
Right-click "My Computer"/"This PC" from Windows explorer and pick properties. Alternatively Windows key + X and click "System". An "About" window appears.
Scroll down to "Advanced system settings" and click on it.
Click on the "Environment Variables" button.
Select "Path" in the window that appears and click the edit button.
Click on "Edit text" (not on "Edit"!).
Before modifying anything, I strongly recommend to copy the text there and save it in a text file for backup, so that you can restore the PATH in case of mistakes.
Write a semicolon ; at the end of the text there unless already present. Then after the semicolon add the full path to your Mingw installation's bin folder. For example ;c:\mingw_w64\bin.
Important: if you installed Mingw under for example C:\program files\mingw_w64, then the path must be ;C:\Program Files\mingw-w64\bin; without any surrounding " ... ". If using the "Edit" command available in this window, then the " ... " will get added and this may break the gcc path from working. (It just happened to me and that's the reason why I decided to write this Q&A.)
Click OK for each open window.
Reboot Windows.
Now you should be able to type gcc from the command line or use it from your programming IDE.
Alternatively, for CLI users:
Open cmd.
Type PATH.
Add the absolute path to the bin folder to it.
Place a semi-colon at the end.
Press enter.
Reboot.
And you're done.
Edit: For the full path to the bin folder:
cd your way to Mingw installation's bin folder, or alternatively, press windows key + e.
Open mingw -> bin.
Copy the full path present in the search bar.
As #Lundin said, you should first make a copy of the original PATH and save it, just in case something goes wrong.

How to set default opener [duplicate]

How can I set TextMate as default text editor on Mac OS X?
I've tried it with
ln -s /Applications/TextMate.app/Contents/Resources/mate ~/bin/mate
export EDITOR='mate -w'
but that doesn't work.
Just right (or control) click a file of the type you want to change and:
"Get Info" -> "Open with:" -> (Select TextMate) -> "Change All"
The method through Finder is not practical. If you're a developer, your files likely include .profile, .gitconfig, .bashrc, .bash_profile, .htdocs, etc.
The best way to do this is in Bash (for Sublime Text 3):
defaults write com.apple.LaunchServices LSHandlers -array-add '{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.sublimetext.3;}'
For other text editors, I assume you can replace 'com.sublimetext.3' with the proper string. You could probably Google for your text editor's name + "LSHandlerContentType=public.plain-text" to figure out what your app's string would be.
For me, this changed the defaults for both Finder, and
$ open ~/.bashrc
Have you modified your shell PATH environment variable to include ~/bin? That directory is usually not included in PATH by default on OS X. It might be simpler to create the symlink in /usr/local/bin which is usually included in PATH. Try:
echo $PATH
This worked for me on OS X v10.11 (El Capitan):
defaults write com.apple.LaunchServices/com.apple.launchservices.secure LSHandlers -array-add \
'{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.macromates.textmate.preview;}'
For TextMate 2:
defaults write com.apple.LaunchServices LSHandlers -array-add '{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.macromates.TextMate;}'
And you need to restart after that.
To change the default text editor across the board, use the aforementioned method (i.e., "Get Info" → "Open with:" → (editor of choice) → "Change All") on .txt files. Then it will be used as the default editor for any text-based file that doesn't yet have an application preference for its extension.
For instance, if you use the terminal, the command open -t will use your preferred text editor, which is whatever application is associated with .txt files. By default this is (you guessed it) TextEdit, unless you explicitly specify otherwise.
I found Replace Text Edit as the default text editor on apple.stackexchange which works really well.
For developer-type files like .gitignore, use the last option provided:
duti -s com.macromates.TextMate public.data all
Substitute your editor's CFBundleIdentifier as needed. To find it, locate the application file, right-click and choose Show Package Contents, then open Info.plist in the Contents folder. CFBundleIdentifier should be near the top...
This work on Catalina. I'll update my answer if/when I update my OS.

save entire cmd screen to image

I just finished writing a program, (download here if you're interested) Basically, it is like an etch-a-sketch. here's a screenshot of version 1:
Version 2 is more like a pixelated painting program. Here's a screenshot: As you can see, v2 supports 16 different colors.
Anyway, I want the users to be able to "save" their creations. I know that I can highlight everything, and copy it into a text file, but this does not get the colors, and there isn't a clean way to do this (that I know of).
Is there a command line tool that I can download to save screen output as an image? Or am I screwed?
By the way, This is just a batch file, compiled with This program. It only works compiled, because the compiler features advanced commands, the kind that allow me to have multiple colors in one window. You can check out the source code here. All lines starting with REM are the "advanced commands".
:edit
I was originally just going to go with a method that saves all of the text, but when I add colors, it looks something like this. Here is what it should look like:
You can use this commandline tool (I made it in AutoIt):
Capture.exe
Use :
capture.exe outputFile.jpg (png,bmp)
It will capture the entire screen.
EDIT :
You can use THIS new one :
Use :
Capture.exe "Title_of_the_Windows"
So in your bat, give a title to your CMD windows, using :
Title capture
and then display your colored text, and just make a :
Capture.exe "Capture"
This will create Output.jpg.
you can do this without external tools ,but you'll need .net framework (installed on windows from vista and above by default) and screenCapture.bat
call screenCapture screen.png png n

trouble with cake.bat

I am new to php and cake php. I am attempting to bake up some cakephp code in the Windows Command Prompt. When I do the command "cake bake" within C:\xampp\htdocs\cake\lib\Cake\Console, I get no result, just a blinking cursor. Has anyone else ever had this happen or have any suggestions that might be helpful?
Go to the dir C:\xampp\htdocs\cake\app.
I don't know which version of Windows you have. However, you must access Environment Variables Access it by any mean.
In Windows7:
Right Click on Mycomputer-> Properties -> click on Advanced System Settings -> The last button Environment Variables is there, click on it From System Variables list select Path and then press Edit button. You will see a line of code, at its end add something like the following:
;C:\xampp\htdocs\cakephp\cake\console\;C:\xampp\php
The first path is the path in-which cake.bat file is found
The second path is the path in-which php.exe is found.
Restart your coputer and you will find cake bake works fine at any directory you want.

Cannot see files copied to C: (system drive) in Windows 7

Could someone can explain me why can't I see a file copied to C:?
Note that if I try to copy it again to the same location, the system ask me if I want to override it.
Not a matter of weird attributes, or common stuffs ;)
Hope I can find an answer here...
Solved,
I noted there was a magic "Compatibility files" link in the tool bar. Just clicked on it and the files I had copied suddenly showed up their faces.
Thanks anyway,
Maybe you've set the file of that extension to be hidden? Does it appear with the 'dir /H' command?
Sounds like you may need to refresh the folder - use F5.
Alternatively, if the file is hidden, you may need to "show hidden files".
To do that, hold down alt -> Tools menu -> Folder options -> View -> Show hidden files and folders.

Resources