Skip to content

Upstreaming 5/n - Cleanup syntax files #504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 1 addition & 22 deletions syntax/NeogitCommitView.vim
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,4 @@ endif
syn match NeogitDiffAdd /.*/ contained
syn match NeogitDiffDelete /.*/ contained

hi def link NeogitDiffAdd DiffAdd
hi def link NeogitDiffDelete DiffDelete

hi def NeogitFilePath guifg=#798bf2

hi def NeogitCommitViewHeader guifg=#ffffff guibg=#94bbd1

hi def NeogitDiffHeader gui=bold

sign define NeogitHunkHeader linehl=NeogitHunkHeader
sign define NeogitHunkHeader linehl=NeogitHunkHeader
sign define NeogitHunkHeaderHighlight linehl=NeogitHunkHeaderHighlight

sign define NeogitDiffHeader linehl=NeogitDiffHeader
sign define NeogitDiffContextHighlight linehl=NeogitDiffContextHighlight
sign define NeogitDiffAdd linehl=NeogitDiffAdd
sign define NeogitDiffAddHighlight linehl=NeogitDiffAddHighlight
sign define NeogitDiffDelete linehl=NeogitDiffDelete
sign define NeogitDiffDeleteHighlight linehl=NeogitDiffDeleteHighlight

sign define NeogitCommitViewHeader linehl=NeogitCommitViewHeader
sign define NeogitCommitViewDescription linehl=NeogitHunkHeader
let b:current_syntax = 1
4 changes: 0 additions & 4 deletions syntax/NeogitGitCommandHistory.vim

This file was deleted.

2 changes: 2 additions & 0 deletions syntax/NeogitLog.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ if exists("b:current_syntax")
endif

syn match Comment /^[a-z0-9]\{7}\ze/

let b:current_syntax = 1
1 change: 0 additions & 1 deletion syntax/NeogitLogView.vim

This file was deleted.

3 changes: 0 additions & 3 deletions syntax/NeogitNotification.vim

This file was deleted.

12 changes: 0 additions & 12 deletions syntax/NeogitPopup.vim

This file was deleted.

55 changes: 14 additions & 41 deletions syntax/NeogitStatus.vim
Original file line number Diff line number Diff line change
@@ -1,58 +1,31 @@
if exists("b:current_syntax")
finish
endif

" Support the rebase todo highlights
source $VIMRUNTIME/syntax/gitrebase.vim

syn match NeogitObjectId /^[a-z0-9]\{7,}\>/
syn match NeogitCommitMessage /.*/ contained
syn match NeogitBranch /\S\+/ contained nextgroup=NeogitCommitMessage
syn match NeogitRemote /\S\+/ contained nextgroup=NeogitCommitMessage
syn match NeogitDiffAdd /.*/ contained
syn match NeogitDiffDelete /.*/ contained
syn match NeogitStash /stash@{[0-9]*}\ze/
syn match NeogitUnmergedInto /Unmerged into/ contained
syn match NeogitUnpulledFrom /Unpulled from/ contained
syn match NeogitCommitMessage /.*/ contained
syn match NeogitBranch /\S\+/ contained nextgroup=NeogitCommitMessage
syn match NeogitRemote /\S\+/ contained nextgroup=NeogitCommitMessage
syn match NeogitDiffAdd /.*/ contained
syn match NeogitDiffDelete /.*/ contained
syn match NeogitUnmergedInto /Unmerged into/ contained
syn match NeogitUnpulledFrom /Unpulled from/ contained
syn match NeogitStash /stash@{[0-9]*}\ze/
syn match NeogitObjectId /^[a-z0-9]\{7,}\>\s/

let b:sections = ["Untracked files", "Unstaged changes", "Unmerged changes", "Unpulled changes", "Recent commits", "Staged changes", "Stashes", "Rebasing"]

for section in b:sections
let id = join(split(section, " "), "")
execute 'syn match Neogit' . id . ' /^' . section . '/ contained'
execute 'syn region Neogit' . id . 'Region start=/^' . section . '\ze.*/ end=/./ contains=Neogit' . id
execute 'hi def link Neogit' . id . ' Function'
endfor

syn region NeogitHeadRegion start=/^Head: \zs/ end=/$/ contains=NeogitBranch
syn region NeogitPushRegion start=/^Push: \zs/ end=/$/ contains=NeogitRemote
syn region NeogitHeadRegion start=/^Head: \zs/ end=/$/ contains=NeogitBranch
syn region NeogitPushRegion start=/^Push: \zs/ end=/$/ contains=NeogitRemote
syn region NeogitUnmergedIntoRegion start=/^Unmerged into .*/ end=/$/ contains=NeogitRemote,NeogitUnmergedInto
syn region NeogitUnpulledFromRegion start=/^Unpulled from .*/ end=/$/ contains=NeogitRemote,NeogitUnpulledFrom
syn region NeogitDiffAddRegion start=/^+.*$/ end=/$/ contains=NeogitDiffAdd
syn region NeogitDiffDeleteRegion start=/^-.*$/ end=/$/ contains=NeogitDiffDelete

hi def link NeogitBranch Macro
hi def link NeogitRemote SpecialChar
hi def link NeogitObjectId Comment

hi def link NeogitDiffAdd DiffAdd
hi def link NeogitDiffDelete DiffDelete

hi def link NeogitUnmergedInto Function
hi def link NeogitUnpulledFrom Function

hi def link NeogitStash Comment
hi def link NeogitRebaseDone Comment

hi def NeogitFold guifg=None guibg=None

sign define NeogitDiffContextHighlight linehl=NeogitDiffContextHighlight
sign define NeogitRebaseDone linehl=NeogitRebaseDone
sign define NeogitHunkHeader linehl=NeogitHunkHeader
sign define NeogitHunkHeaderHighlight linehl=NeogitHunkHeaderHighlight
sign define NeogitDiffAdd linehl=NeogitDiffAdd
sign define NeogitDiffAddHighlight linehl=NeogitDiffAddHighlight
sign define NeogitDiffDelete linehl=NeogitDiffDelete
sign define NeogitDiffDeleteHighlight linehl=NeogitDiffDeleteHighlight


"TODO: find a better way to do this
syn region NeogitDiffAddRegion start=/^+.*$/ end=/$/ contains=NeogitDiffAdd
syn region NeogitDiffDeleteRegion start=/^-.*$/ end=/$/ contains=NeogitDiffDelete