BBEdit is not recognizing ctags' tags file - ctags

I'm trying to get BBEdit to recognize my ctags file for a Rails project. I've tried generating it both with ctags-exuberant directly and with the bbedit --maketags command. While the tags I generate work perfectly in Vim, no such luck in BBEdit. No error messages or anything, just no symbols trigger completion or allow me to jump.
I've tried moving the tags file into the project directory, no luck. I've tried generating one lower down in my hierarchy (my models folder) and jumping between model classes, no luck.
Any ideas?

In case anyone else comes upon this question like I did, here's the answer from BBEdit support. In short, if you're using OSX Fuse, do this in Terminal:
defaults write com.barebones.bbedit DisableCtagsScanOnRemoteVolumes -bool NO
Full answer from BBEdit support:
Cribbing from the "Expert Preferences" page of the Help book (Help -> BBEdit Help):
====
** Miscellaneous **
[...]
When editing files that are on remote file servers (AFP, NFS,
SMB, etc), BBEdit will not look for directory-relative tags
files or settings files. This is a particular performance win
when the file is located on a volume mounted via MacFUSE/SSH or
similar, or if the file server is over a slow or high-latency link.
To enable scanning for tags or settings files on remote volumes,
use these [ Terminal commands ] separately or together:
defaults write com.barebones.bbedit DisableCtagsScanOnRemoteVolumes -bool NO
defaults write com.barebones.bbedit DisableSettingsScanOnRemoteVolumes -bool NO
====
Please note that if your only need is for ctags, you need apply only the first option ("DisableCtagsScanOnRemoteVolumes").

From the BBEdit manual (pages 302-304):
Using ctags
BBEdit allows you to generate and use tags files as text completion
sources, and will recognize any tags files associated with your
documents.
You may place tags files generated via ‘bbedit --maketags’ in the
Completion Sources folder of BBEdit’s application support folder (see
page 32) for use as text completion sources.
[...]
Tag Files as Completion Sources
You can now add tags files to specific locations to make symbols
available as completion data sources when editing in desired
languages. In particular:
When you build a (coded) language module, if you place a file named “tags” in the language module’s “Resources” directory, BBEdit will
use those tags as completion sources.
You can generate a tags file (using exuberant ctags or “bbedit --maketags”) and place the resulting file in Application Support/BBEdit/Completion Data/ /, where “
name>” is the name of the language as it appears in the list of
installed languages (or on the Languages popup menu).
So, for example, if you were to generate a tags file for the 10.6 SDK
so that you could add completion data when editing Objective-C files,
the file would go in Application Support/ BBEdit/Completion
Data/Objective-C/. Tags files can be given any appropriate name, so
you can have multiple tags files for a single language, and they will
all be examined when generating completions.
And the Completion Data section on p32:
Completion Data
This folder does not exist by default, but you may create it. The
Completion Data folder contains tags files (or aliases to tags files)
which can provide additional text completions for editing documents in
the corresponding languages. These tags files should be in the format
generated by ‘bbedit --maketags’, and must be placed in subfolders
corresponding to their languages.
Each subfolder should have the exact name of its language as that
language appears in the list of installed languages (or on the
Languages popup menu).
For example, the subfolder containing a Python tags file must be named
“Python”, and the subfolder containing a tags file for ANSI C must be
named “ANSI C”.

Related

can i make windows file explorer show certain text extracted from files as a new detail column?

I have folders full of log files, and I'd like to display their final status in a column in the folder they are in. That is, in Details view I want to make a new column that shows a piece of text which is extracted from each file. I don't expect to find such a thing out there, and the searches I've tried haven't even yielded a hint about how I would go about writing a plugin to do any such thing. Is it possible?
This sort of thing used to be possible with custom column handler shell extensions but Microsoft removed support for those in Vista (3rd-party Explorer replacements might still support them).
Microsofts inadequate replacement are property handlers. You cannot do this for .log files, you would have to invent a .myapp-log file extension.
Some people abuse the Windows 10 cloud API to create columns but that only works in specific folders.
If you are looking for a specific string in the last line, you could perhaps use a custom icon handler for .log files.

How to create .lisp files and run them on mac?

As can be seen on the picture TextEdit on mac gives only limited options of file extensions in which I can safe a file. Lisp not included.
Create .lisp files
https://www.tutorialspoint.com/lisp/lisp_environment.htm is describing everything step by step, but it says TextEditor on Mac can save .lisp files, which I wasn't able to do.
Load .lisp file
(load "filename.lisp") leads to error: file with such name doesn't exist
TextEditor on mac has limitations to how file can be saved (.txt, etc.). You can use any other editor, ex: TextWrangler, which allow you to write file extension. Or you can use editors specific for lisp, ex: Emacs (more massive)
It's possible that when you type (load "filename.lisp") it searches in some specific directory, where it's not present. So, to avoid this, you should type full path to the file you want to open. Ex: (load "/Users/macbook/Desktop/foldername/filename.lisp")

mac default application for any unknown extension

I have a series of files that are all text files that i want to open with text editor (let's say Sublime).
The extensions on these files follow the pattern:
file.sff123
file.sff124
file.sff125
file.sff126
and so on...
Every time i go to open one of these files, the dialog pops up to select the default application for this file type, but since they all have varying extensions, i have to navigate and select the new file type each time. I literally have 1000s of these files and would like to be able to open all of them. Further, i want to be able to open any unknown file with something like Sublime by default. 99% of the time its a random text file... the 1% that it's not i'll "open with".
Is there a way to get Mac to recognize any unknown file extension and open it with an application of my choosing by default?
I am not sure if it is possible, but the following (untested) may help you, or someone else work out how to do it.
OSX uses UTIs (Uniform Type Identifiers) to categorise filetypes and map them to applications - and this works in conjunction with Launch Services to launch the appropriate application.
I don't have one of your .sffnnn files available, but I think you need to run mdls on one and see what kMDItemContentType is. You can do that like this in Terminal:
mdls -name kMDItemContentType somefile.sff123
I am hoping you get the same content type for all your .sffnnn files - if you don't, this approach won't work.
You then need to edit your LaunchServices.plist file which, I think, is in ~/Library/Preferences/com.apple.LaunchServices.plist and make an entry corresponding to the filetype you found above that maps to the sublime application. I suggest you look in there, or the system-wide version to see how entries look.
Once you get the hang of it, you may be able to do it from the command-line with a command like:
defaults write com.apple.LaunchServices LSHandlers -array-add '{LSHandlerContentType=xxxType;LSHandlerRoleAll=xxx.yyy.sublime;}'

OSX service menu entry: How to localize?

I have setup an OSX service based on an Automator workflow that contains (among others) an Obj-C action.
I have successfully localized the Obj-C action, but I am not able to localize the service menu entry.
The Services implementation guide says one has to create a ServicesMenu.strings file for every localization. Other docs, e.g. this, say the same, and this SO entry suggests in an answer to apply some console commands to refresh a system file, but I am afraid to do so without understanding.
I have created the localized ServicesMenu.strings files in the Xcode project of the Obj-C action (because the Automator does not have an localization function), but these files are surely in the wrong bundle.
The problem is that I don't know where to place these files.
Any help is appreciated.
EDIT:
One of the links cited above says:
Adding a Localized ServicesMenu.strings file
To localize this text, you will need to add a UTF-16 encoded strings file named ServicesMenu.strings to your application project or Automator workflow bundle resources (details on how to do this are below). This strings file will contain, for each service menu item you are providing, an entry that uses the default text as the key, and the translated text as the value. For each language you wish to support, you will provide a translated ServicesMenu.strings file in a language-specific project (.lproj) directory in your project resources.
...
If you are providing a service from an Automator created workflow, you will need to manually add the strings files and .lproj resource directories to the workflow bundle. You can find Automator created workflow bundles in your home directory under ~/Library/Services.
I have done exactly this, but the localization does not work.
Below I added my Info.plist content, the folder structure and the ServiceMenu.strings file contents.
Here is my own solution. Maybe it helps somebody else.
The 1st problem was that I did not read the docs carefully enough. The text cited in my question continues:
Refreshing the Services menu
Once you have provided localized text for your service menu item title, you may need to refresh the Services menu list to see the changes. One way to refresh the list of services shown in the Services menu is by using the services debugging tool pbs. This is a command-line tool located in /System/Library/CoreServices that provides useful services debugging features, such as refreshing the list of services or printing out the current list of registered services. Listing 3 shows an example of a command-line you can enter into the Terminal application to refresh the list of services for English and French.
Listing 3  Example use of pbs to refresh services.
/System/Library/CoreServices/pbs -existing_languages en fr
The 2nd problem was that the command given in Listing 3 above did not work for me. However the command
/System/Library/CoreServices/pbs -update
actually updated the service menu and the localized menu entry was displayed.

Notepad++ : Custom Syntax Highlighting for .txt files

I keep code samples that I find useful as text files on my computer. I store them as txt files as opposed to the language in which they are written, so that they will open in Notepad++ instead of the editor (i.e. I don't want my c++ examples to open in an IDE, just Notepad).
Is there a way I can have Notepad++ apply appropriate syntax highlighting to the text file by reading a special code in the text file itself?
For example if I had some sql, the first line of the text file could read like this:
##Language=SQL
... my sql code properly highlighted as sql ...
Thanks in advance. I realize I could just choose the language after opening the file (i.e. Language > SQL), but it would be much more convenient if it could do it automatically.
No, it can't. You can choose it manually or use special file type extensions which you then associate with Notepad++ and tell it to highlight the files as the appropriate language.
For example, use .txtsql files for SQL, .txtcpp files for C++ and so on.
I ended up writing it myself:
You need the Python plugin
Add the code below to your startup.py file
Switch your Python Initialization setting from "LAZY" to "ATSTARTUP"
#if found determine the menu command and switch language in NPP
def switch_language_view(args):
notepad.activateBufferID(args["bufferID"])
lineone = editor.getLine(0)
if '##' in lineone:
lineone = lineone[lineone.rfind('##'):].replace('##', '')
lineone = "MENUCOMMAND." + lineone.upper()
try:
notepad.menuCommand( eval(lineone) )
except:
pass
#command to link notification
notepad.callback(switch_language_view, [NOTIFICATION.FILEOPENED])
I'd suggest giving them the proper file extensions, then import something like this into your registry:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\NotepadPlusPlus]
[HKEY_CLASSES_ROOT\*\shell\NotepadPlusPlus\command]
#="C:\\path\\to\\notepad++.exe \"%1\""
Then you can open your files in NP++ with a quick right-click, and NP++ will be able to auto-detect the right language based on the file extension.
Manual selection is a much simpler way. Store all the files in .txt format (irrespective of java or C or C++). Open the file in Notepad++ and select the corresponding language in the Menu. e.g. Language --> Java.
You could try some npp scripting,
python
lua
and/or hacking macros. you could make the script start conditionally, check your special string and select the language for you.

Resources