Skip to content
Snippets Groups Projects
Commit ad95ede2 authored by Jerome Reybert's avatar Jerome Reybert
Browse files

plugin/magit.vim: dirty WIP for new display (horizontal lines)

parent 2bbe9d98
No related branches found
No related tags found
No related merge requests found
...@@ -115,10 +115,15 @@ endfunction ...@@ -115,10 +115,15 @@ endfunction
function! s:mg_get_info() function! s:mg_get_info()
silent put ='' silent put =''
silent put =g:magit_sections.info silent put =g:magit_sections.info
silent put =magit#utils#underline(g:magit_sections.info)
silent put ='' silent put =''
let branch=magit#utils#system("git rev-parse --abbrev-ref HEAD") let linenum = line('.')
let commit=magit#utils#system("git show -s --oneline") let bufnr = magit#utils#bufnr()
execute printf(
\ 'sign place %d line=%d name=GitaPseudoSeparatorSign buffer=%d',
\ linenum, linenum, bufnr,
\)
let branch=magit#git#current_branch()
let commit=magit#git#last_commit()
silent put =g:magit_section_info.cur_repo . ': ' . magit#git#top_dir() silent put =g:magit_section_info.cur_repo . ': ' . magit#git#top_dir()
silent put =g:magit_section_info.cur_branch . ': ' . branch silent put =g:magit_section_info.cur_branch . ': ' . branch
silent put =g:magit_section_info.cur_commit . ': ' . commit silent put =g:magit_section_info.cur_commit . ': ' . commit
...@@ -139,6 +144,7 @@ endfunction ...@@ -139,6 +144,7 @@ endfunction
" directory) " directory)
function! s:mg_display_files(mode, curdir, depth) function! s:mg_display_files(mode, curdir, depth)
let bufnr = magit#utils#bufnr()
" FIXME: ouch, must store subdirs in more efficient way " FIXME: ouch, must store subdirs in more efficient way
for filename in b:state.get_filenames(a:mode) for filename in b:state.get_filenames(a:mode)
let file = b:state.get_file(a:mode, filename, 0) let file = b:state.get_file(a:mode, filename, 0)
...@@ -182,9 +188,14 @@ endfunction ...@@ -182,9 +188,14 @@ endfunction
function! s:mg_get_staged_section(mode) function! s:mg_get_staged_section(mode)
put ='' put =''
put =g:magit_sections[a:mode] put =g:magit_sections[a:mode]
call <SID>mg_section_help(a:mode)
put =magit#utils#underline(g:magit_sections[a:mode])
put ='' put =''
let linenum = line('.')
let bufnr = magit#utils#bufnr()
execute printf(
\ 'sign place %d line=%d name=GitaPseudoSeparatorSign buffer=%d',
\ linenum, linenum, bufnr,
\)
call <SID>mg_section_help(a:mode)
call s:mg_display_files(a:mode, '', 0) call s:mg_display_files(a:mode, '', 0)
endfunction endfunction
...@@ -200,8 +211,13 @@ function! s:mg_get_stashes() ...@@ -200,8 +211,13 @@ function! s:mg_get_stashes()
if (!empty(stash_list)) if (!empty(stash_list))
silent put ='' silent put =''
silent put =g:magit_sections.stash silent put =g:magit_sections.stash
silent put =magit#utils#underline(g:magit_sections.stash)
silent put ='' silent put =''
let linenum = line('.')
let bufnr = magit#utils#bufnr()
execute printf(
\ 'sign place %d line=%d name=GitaPseudoSeparatorSign buffer=%d',
\ linenum, linenum, bufnr,
\)
for stash in stash_list for stash in stash_list
let stash_id=substitute(stash, '^\(stash@{\d\+}\):.*$', '\1', '') let stash_id=substitute(stash, '^\(stash@{\d\+}\):.*$', '\1', '')
...@@ -223,9 +239,14 @@ function! s:mg_get_commit_section() ...@@ -223,9 +239,14 @@ function! s:mg_get_commit_section()
if ( b:magit_current_commit_mode != '' ) if ( b:magit_current_commit_mode != '' )
silent put ='' silent put =''
silent put =g:magit_sections.commit_start silent put =g:magit_sections.commit_start
call <SID>mg_section_help('commit')
silent put =magit#utils#underline(g:magit_sections.commit_start)
silent put ='' silent put =''
let linenum = line('.')
let bufnr = magit#utils#bufnr()
execute printf(
\ 'sign place %d line=%d name=GitaPseudoSeparatorSign buffer=%d',
\ linenum, linenum, bufnr,
\)
call <SID>mg_section_help('commit')
let git_dir=magit#git#git_dir() let git_dir=magit#git#git_dir()
" refresh the COMMIT_EDITMSG file " refresh the COMMIT_EDITMSG file
......
...@@ -4,12 +4,22 @@ endif ...@@ -4,12 +4,22 @@ endif
execute 'source ' . resolve(expand('<sfile>:p:h')) . '/../common/magit_common.vim' execute 'source ' . resolve(expand('<sfile>:p:h')) . '/../common/magit_common.vim'
highlight GitaPseudoSeparatorDefault
\ term=undercurl
\ cterm=underline ctermfg=8
\ gui=underline guifg=#363636
sign define GitaPseudoSeparatorSign
\ texthl=SignColumn
\ linehl=GitaPseudoSeparator
highlight default link GitaPseudoSeparator GitaPseudoSeparatorDefault
syn case match syn case match
syn sync minlines=50 syn sync minlines=50
syn include @diff syntax/diff.vim syn include @diff syntax/diff.vim
execute 'syn match titleEntry "' . g:magit_section_re . '\n=\+"' execute 'syn match titleEntry "' . g:magit_section_re . '\n$"'
hi def link titleEntry Comment hi def link titleEntry Comment
execute 'syn match stashEntry "' . g:magit_stash_re . '"' execute 'syn match stashEntry "' . g:magit_stash_re . '"'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment