mirror of
https://github.com/starr-dusT/dotfiles.git
synced 2025-02-19 19:27:31 -08:00
Updates to vimrc for marks/signs in vim7
This commit is contained in:
parent
70024a7a9b
commit
162fb559c0
@ -1,4 +1,5 @@
|
|||||||
" designed for vim 8+ (and inspired by rwxrob)
|
" designed for vim 7+ (and inspired by rwxrob)
|
||||||
|
" tested with vim 7.4.629
|
||||||
" https://github.com/starr-dusT/dotfiles
|
" https://github.com/starr-dusT/dotfiles
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
@ -78,7 +79,7 @@ map <leader>e :Ex <cr> " open explorer
|
|||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
" automatically update marks with helper function
|
" automatically update marks with helper function
|
||||||
au CursorHold,CursorHoldI,CursorMoved,CursorMovedI,TextChanged,TextChangedP,CmdlineEnter,CmdlineLeave,CmdlineChanged * silent! call UpdateMarkSigns()
|
au CursorHold,CursorHoldI,CursorMoved,CursorMovedI,TextChanged * silent! call UpdateMarkSigns()
|
||||||
|
|
||||||
" allow only global marks
|
" allow only global marks
|
||||||
noremap <silent> <expr> ' "'".toupper(nr2char(getchar()))
|
noremap <silent> <expr> ' "'".toupper(nr2char(getchar()))
|
||||||
@ -182,9 +183,11 @@ endfunction
|
|||||||
" Place sign with particular symbol at line
|
" Place sign with particular symbol at line
|
||||||
" ChatGippity
|
" ChatGippity
|
||||||
"
|
"
|
||||||
function! PlaceSign(id, symbol, prio, line_number)
|
function! PlaceSign(id, symbol, line_number)
|
||||||
call sign_define(a:symbol, {'text': a:symbol})
|
let buff = bufnr('')
|
||||||
call sign_place(a:id, '', a:symbol, bufnr(''), {'lnum': a:line_number, 'priority': a:prio, 'text': a:symbol})
|
" For compatibility with vim7 can't use nice sign functions
|
||||||
|
exe "sign define " . a:symbol . " text=" . a:symbol
|
||||||
|
exe "sign place " . a:id . " line=" . a:line_number . " name=" . a:symbol . " buffer=" . buff
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Use signs to visualize marks and update for current buffer
|
" Use signs to visualize marks and update for current buffer
|
||||||
@ -198,14 +201,14 @@ function! UpdateMarkSigns()
|
|||||||
execute "sign unplace *"
|
execute "sign unplace *"
|
||||||
|
|
||||||
" get all marks
|
" get all marks
|
||||||
let lines = []
|
let lines = ""
|
||||||
redir => lines
|
redir => lines
|
||||||
silent marks
|
:silent marks
|
||||||
redir END
|
redir END
|
||||||
|
|
||||||
let lines = split(lines, "\n")[1:]
|
let linesList = split(lines, "\n")[1:]
|
||||||
for i in range(len(lines))
|
for i in range(len(linesList))
|
||||||
let line = lines[i]
|
let line = linesList[i]
|
||||||
let id = resvIDs[i]
|
let id = resvIDs[i]
|
||||||
|
|
||||||
let splitLine = split(line)
|
let splitLine = split(line)
|
||||||
@ -220,7 +223,7 @@ function! UpdateMarkSigns()
|
|||||||
|
|
||||||
" If marks is in another file we don't need to display it
|
" If marks is in another file we don't need to display it
|
||||||
if !IsValidFilename(file)
|
if !IsValidFilename(file)
|
||||||
call PlaceSign(id, name, 99, row)
|
call PlaceSign(id, name, row)
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
Loading…
x
Reference in New Issue
Block a user