Skip to content

Commit

Permalink
Adding sublime-syntax for ST3
Browse files Browse the repository at this point in the history
  • Loading branch information
aziz committed May 12, 2016
1 parent 4b7599a commit a28e4e5
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 3 deletions.
26 changes: 26 additions & 0 deletions dired-help.sublime-syntax
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
%YAML 1.2
---
name: dired help
hidden: true
scope: text.dired_help
contexts:
main:
- match: ^\s.+:$
scope: dired.help.header
- match: ^(:)(.+?)(:)(.+?)(:)$
scope: dired.table.th
captures:
1: dired.table.punctuations
2: title
3: dired.table.punctuations
4: title
5: dired.table.punctuations
- match: '^(\|)(.+?)(\|)\s*(?:([^,]+?)(?:\sor\s|,\s)?(\S+?)?)?\s*(\|)$'
scope: dired.table.tr
captures:
1: dired.table.punctuations
2: command_desc
3: dired.table.punctuations
4: command_shortcut
5: command_shortcut
6: dired.table.punctuations
37 changes: 37 additions & 0 deletions dired.sublime-syntax
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
%YAML 1.2
---
name: dired
hidden: true
file_extensions:
- dired
scope: text.dired
contexts:
main:
- match: '^(\s*)([▸▾] )([^\\/]*)(\\|/)?(.*)?$'
scope: dired.item.directory
captures:
1: indent
2: punctuation.definition.directory.symbol.dired
3: string.name.directory.dired
4: punctuation.definition.directory.slash.dired
5: string.error.dired
- match: '^(\s*)(≡ )(\S.*?(\.[^\.\n]+)?)$'
scope: dired.item.file
captures:
1: indent
2: punctuation.definition.file.symbol.dired
3: string.name.file.dired
4: string.name.file.extension.dired
- match: '^⠤(\s*\[.+\]){0,1}$'
scope: dired.item.parent_dir
captures:
1: punctuation.definition.rename_mode.dired
- match: (\S(.+)?$)
push:
- meta_scope: header.dired
- match: '^(—+)(\[RENAME MODE\]){0,1}(—*)\n'
captures:
1: punctuation.definition.separator.dired
2: punctuation.definition.rename_mode.dired
3: punctuation.definition.separator.dired
pop: true
23 changes: 23 additions & 0 deletions dired_jumplist.sublime-syntax
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
%YAML 1.2
---
name: dired jump list
hidden: true
scope: text.dired_jump_list
contexts:
main:
- match: ^(★ )(\S.*)(→\s*)(.+)$
scope: dired.item.projects
captures:
1: punctuation.definition.projects.star.symbol.dired
2: string.name.project.dired
3: punctuation.definition.projects.chevron.symbol.dired
4: string.name.project_path.dired
- match: (\S(.+)?$)
push:
- meta_scope: header.dired
- match: '^(—+)(\[RENAME MODE\]){0,1}(—*)\n'
captures:
1: punctuation.definition.separator.dired
2: punctuation.definition.rename_mode.dired
3: punctuation.definition.separator.dired
pop: true
4 changes: 3 additions & 1 deletion dired_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
if ST3:
from .common import DiredBaseCommand, set_proper_scheme, hijack_window, NT, OSX
MARK_OPTIONS = sublime.DRAW_NO_OUTLINE
SYNTAX_EXTENSION = '.sublime-syntax'
else: # ST2 imports
import locale
from common import DiredBaseCommand, set_proper_scheme, hijack_window, NT, OSX
MARK_OPTIONS = 0
SYNTAX_EXTENSION = '.hidden-tmLanguage'


class DiredFindInFilesCommand(TextCommand, DiredBaseCommand):
Expand All @@ -45,7 +47,7 @@ def run(self, edit):
view.set_name("Browse: shortcuts")
view.set_scratch(True)
view.settings().set('rulers', [])
view.settings().set('syntax', 'Packages/FileBrowser/dired-help.hidden-tmLanguage')
view.settings().set('syntax', 'Packages/FileBrowser/dired-help' + SYNTAX_EXTENSION)
view.settings().set('margin', 16)
view.settings().set('line_numbers', False)
view.settings().set('gutter', False)
Expand Down
4 changes: 3 additions & 1 deletion jumping.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
from .common import DiredBaseCommand
from .show import show
from .show import set_proper_scheme
SYNTAX_EXTENSION = '.sublime-syntax'
else:
from common import DiredBaseCommand
from show import show
from show import set_proper_scheme
SYNTAX_EXTENSION = '.hidden-tmLanguage'


def unicodify(name):
Expand Down Expand Up @@ -186,7 +188,7 @@ def run(self, edit, reuse=False):

view.set_name("FileBrowser: Jump List")
view.set_scratch(True)
view.set_syntax_file('Packages/FileBrowser/dired_jumplist.hidden-tmLanguage')
view.set_syntax_file('Packages/FileBrowser/dired_jumplist' + SYNTAX_EXTENSION)
view.settings().set('line_numbers', False)
view.settings().set('draw_centered', True)
view.run_command('dired_jump_list_render')
Expand Down
4 changes: 3 additions & 1 deletion show.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@

if ST3:
from .common import first, set_proper_scheme, calc_width, get_group
SYNTAX_EXTENSION = '.sublime-syntax'
else:
from common import first, set_proper_scheme, calc_width, get_group
SYNTAX_EXTENSION = '.hidden-tmLanguage'


def set_active_group(window, view, other_group):
Expand Down Expand Up @@ -53,7 +55,7 @@ def set_view(view_id, window, ignore_existing, path, single_pane):
if not view:
view = window.new_file()
view.settings().add_on_change('color_scheme', lambda: set_proper_scheme(view))
view.set_syntax_file('Packages/FileBrowser/dired.hidden-tmLanguage')
view.set_syntax_file('Packages/FileBrowser/dired' + SYNTAX_EXTENSION)
view.set_scratch(True)
reset_sels = True
else:
Expand Down

0 comments on commit a28e4e5

Please sign in to comment.