Creating Gedit syntax files - shell

I have started a new thread rather then reviving this one:
Creating your own syntax highlighting in GEdit?
Hope that was the right thing to do. I have created a syntax file for fish shell and placed it in /usr/share/gtksourceview-2.0/language-specs (in Ubuntu). When I open a .fish file with gedit there is no highlighting and the view-->high light mode menu does not show this fish as an option. Is there something that needs to be updated to allow the file to be recognized?
Thanks for reading-Patrick

Make sure you are in fact using Gedit 2 and not Gedit 3 (which uses gtksourceview-3.0). For the newer, 3.0 lang files, you can put them into ~/.local/share/gtksourceview-3.0/language-spec/
If you've installed it to the correct location, you should see the name you specified in the _name attribute in the View > Highlight Mode menu under the sub menu you specified with the _section attribute in your .lang file. For example, if I had test.lang with:
<language id="test" _name="Test Language File" version="2.0" _section="Markup">
Then I would see "Test Language File" under View > Highlight Mode > Markup in the Gedit menu.

As an alternative to /usr/share/gtksourceview-2.0/language-specs/, you could try putting it in ~/.gnome2/gtksourceview-2.0/language-specs/.
Assuming you've restarted gedit after installing your syntax file, then it may just be a syntax error. Try installing the Go syntax file (http://go-lang.cat-v.org/text-editors/gedit/), and if that shows up but your custom one still doesn't, then it's a problem with your file. If none of them show up, then you may need to re-install gedit or gtksourceview.
Also, make sure the permissions on your new file match those of the existing ones. I doubt gedit would need more than read permissions to be able to use the file, but it wouldn't hurt to check.

Related

Set Extended Attributes with AppleScript Objc

So I am looking for a way to set Mac specific extended attributes (specifically kMDItemWhereFroms) for a file (Image File, Jpg) using AppleScript or AppleScript-Objc.
There is a command line tool that will do this xattr -w kMDItemWhereFroms . The problem is that on the several machines that I have access to (10.12, 10.13, and 10.14) when you run this command as a do shell script from within an AppleScript it does not work, the metadata is not added to the file. If I set Script Debugger to debug mode, and go through the script step by step it will actually set the metadata, but since that is not the way I am running the script, it is more of an interesting fluke than anything else. I have tried running the command with both "com.apple.metadata:" included and not included with the shell script and that makes no difference.
I have tried running my script through SD, Script Editor and osascript, and they all fail to update the metadata. So I am thinking that this tool might be broken when called from an AppleScript.
I found setxattr but that looks like it only applies to C.
So my questions are
1. Is there a way to set the extended attributes of a file on MacOS using Aobjc? if not then
2. Is there a way to get setxattr to work with either version of AppleScript? Probably not so
3. Any ideas how I might be able to get the command line tool xattr -w kMDItemWhereFroms to work when using scripting?
This is more of an annoyance for me, I am just being stubborn with wanting the source of the file to show up in the "Where From" data in the Get Info window from the Finder. I already am setting some metadata for the file using exiftool. So it is more of an interesting problem for me, than a critical problem that I must try and solve now. Thanks!

Use only a single Geany instance under Windows

I'm running Geany 1.34.1 under Windows 10. Whenever I click a text file on Windows Explorer Geany opens the file in a new instance.
How can I configure Geany so that it opens all files in a single instance only?
According to a section of the Geany documentation, the behavior you want should occur unless Geany is started with the appropriate command line option. From the table of command line options, that would be either -i or --new-instance.
Check your file type association for text files and delete either of those command line options if they're there.
If no options are found, you might check your Geany configuration file to see if there's something related to starting a new instance. If so, you can try deleting the related stuff and see what happens. Be sure to make a backup copy of the configuration file before editing it so you can recover in case something goes terribly wrong.
If no options are found anywhere, then it may be a bug in the Windows version of Geany.

use external editor in Octave on OSX

I want to use Sublime Text as my default editor for Octave, but cant get it to work.
The location of my Sublime Text app is in the /Applications/ folder as usually.
For example putting EDITOR (“/Applications/SublimeText.app”) results in the following error:
parse error near line 1 of file /Users/czapla/.octaverc
syntax error
>>> EDITOR (“/Applications/SublimeText.app”)
^
error: source: error sourcing file '/Users/czapla/.octaverc'`
FYI: Yes SublimeText, this is name of the application, no spaces in between, I changed it to avoid having to escape spaces - I wasnt sure how that would be handled by Octave.
Any ideas?
Thanks!
You don't mention what different things you tried to place in your .octaverc file. The following should work EDITOR ("path_to_your_sublime_aplication"). It doesn't need to be the full path, whatever works to call it from the command line should suffice. For example, EDITOR ("gedit") works fine on my system.
Also, it is important to set this before calling any function that makes use of it. The variable is persistent during an Octave session after being accessed the first time (and defaults to emacs).
I am using Sublime Text 3 on OS X
Octave programs are running perfectly. So you can try the below mentioned steps
Open Sublime
Goto Tools --> Build System --> New Build System...
Paste this code
{
"cmd": ["/usr/local/octave/3.8.0/bin/octave-3.8.0", "$file"],
"selector": "source.m"
}
Save it as Octave.sublime-build
Now use Octave as your build system
Use ⌘ + B to run your code.
Enjoy!

Why does the TextMate title bar not show the file path when opened with the "mate" command?

When I open a file in TextMate using the mate command the title bar does not allow me to right click to see the path of the file while files opened within the TextMate app do show the full path. Is there something about the behavior of the mate command that prevents this functionality or is this a bug?
If you wish to have the path visible in the title bar the mate command must include the full path of the file. Using mate with an assumed current working directory (CWD) does not inherently provide mate the full file path.
If you have a local project .tm_properties file it's trivial to have TM2 display the path - add something like:
windowTitle = "$TM_DISPLAYNAME – $TM_DIRECTORY"
Works with $ mate [filename] in terminal and in normal finder use.
But I agree it's pretty lame that it doesn't seem to work for the global .tm_properties - though I'd love to be proved wrong!
Go to folder "/Applications/TextMate.app/Contents/Resources" or where your TextMate.app installation folder. Close textmate app before modifying the file.
Modify the file Default.tmProperties as below. I have provided the diff here:
diff Default.tmProperties
../textmateBin/TextMate.app/Contents/Resources/Default.tmProperties
10c10
< windowTitleProject = '${projectDirectory:+ — ${projectDirectory}}'
windowTitleProject = '${projectDirectory:+ — ${projectDirectory/^.*///}}'
Restart your textmate app and it should display your folder path :)
I think TextMate has updated the documentation on their website.
It even contains a similar snippet to solve the issue above.
For example, if we want to show the path as relative to the project
folder, we can use:
windowTitle = '${TM_DIRECTORY:+${TM_DIRECTORY/^${projectDirectory}(?:\/(.+))?/${1:+$1/}/}}$TM_DISPLAYNAME$windowTitleProject$windowTitleSCM'
Source: https://macromates.com/textmate/manual/projects

Does netbeans support coloring for .sh (bash) scripts?

I use netbeans 6.8 beta and when i load .sh (bash) file it's not colored at all. i can add a new file association for the .sh extension but it doesn't seem that there is a known associated mime type.
I have not tried this myself but you can get shell script support in Netbeans if you install the C/C++ plugin.
old question, time for an update (tested for 8.0.2,8.1,8.2).
Here's what worked for me
Install C/C++ plugin.
This will recognize .sh extensions as bash files
Install nb-noext-mime-resolver (for 8.2 you'll find it as No Extension MIME Resolver) . This will add support for files with no extension by recognizing the shebang line
Go to tools/options/editor/spellchecker and uncheck 'Script and make comments'.(not available after 8.2) This will get rid of the red squiggly lines that appear under 'usr' and other legitimate notations in the shebang line and elsewhere.
You'll get full syntax highlighting as well as the ability to right click and select 'run' which will launch your script in the built in terminal. very nice.
To get the context menu 'run' to work with your shell
Select 'Run'/'Set Project Configuration'/'Customize'
Click 'New' and add a name for your shell like 'bash' or 'cygwin'
Select 'Run As' 'Script (run in command line'
Where it says 'Php Interpreter' (or equivilent) add the path to your bash shell. e.g: C:\cygwin\bin\bash.exe
Click 'ok'.
Also, check out the properties of the bash files and you'll find some helpful ones.
This is very odd. I have NB6.8beta installed with the C/C++ plugin. When I open a .sh file I do see syntax high lighting. Quotes strings show up in orange, commands are in blue.

Resources