Ctags for shell scripts without extensions

I am working on a Bash script that is designed to be run as a tool, so it has a name without extension and the line #!/usr/bin/bash at the top.

My script has a number of functions, so it would be nice if I could use Vim tag support to go through the code, but I can not get ctags to mark the file. ctags mytool creates a tag file that is empty, with the exception of the comment section at the top.

If I rename my file to mytool.sh, ctags mytool.sh works fine.

Is there a way to get ctags to mark a file without an extension? I tried a number of options that I found in ctags manual , which seem to apply to file extensions, but without joy.

+6
source share
2 answers

If you are using Exuberant Ctags , you can use the --language-force option:

 ctags --language-force=sh mytool 

This is explicitly described on the manual page.

+5
source

I use the command below to create a tag file for all files in my shell source directory tree

 ctags -R --language-force=sh 
+1
source

Source: https://habr.com/ru/post/921766/


All Articles