Skip to content

Commit 1402c12

Browse files
authored
Merge pull request bruderstein#82 from Lucas-C/master
Adding scripts/Samples/CTags Based Autocompletion.py
2 parents 77a365b + 603676b commit 1402c12

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# You can for example bound this script to CTRL+SHIFT+C in Settings > Shortcut Mapper > Plugins Commands > Run Previous Script
2+
# It will show a typical Notepad++/Scintilla autocompletion list, but based on the content of the `tags` file in the current file directory
3+
4+
# The CTags format is described there: http://ctags.sourceforge.net/FORMAT
5+
# But this script will also work if the `tags` file simply contains one word per line
6+
7+
import os
8+
ctags_filepath = os.path.join(os.path.dirname(notepad.getCurrentFilename()), 'tags')
9+
if os.path.exists(ctags_filepath):
10+
with open(ctags_filepath) as ctags_file:
11+
ctags = set(line.split('\t')[0] for line in ctags_file.readlines() if not line.startswith('!'))
12+
editor.autoCShow(0, ' '.join(sorted(ctags)))

0 commit comments

Comments
 (0)