1
0
mirror of https://github.com/amix/vimrc synced 2025-06-16 01:25:00 +08:00

Updated vim plugins

This commit is contained in:
amix
2016-03-20 19:01:44 +01:00
parent 20729bff94
commit 6dcca46b4a
20 changed files with 504 additions and 113 deletions

View File

@ -85,6 +85,22 @@ function! go#util#Shelllist(arglist, ...)
endtry
endfunction
" Returns the byte offset for line and column
function! go#util#Offset(line, col)
if &encoding != 'utf-8'
let sep = go#util#LineEnding()
let buf = a:line == 1 ? '' : (join(getline(1, a:line-1), sep) . sep)
let buf .= a:col == 1 ? '' : getline('.')[:a:col-2]
return len(iconv(buf, &encoding, 'utf-8'))
endif
return line2byte(a:line) + (a:col-2)
endfunction
"
" Returns the byte offset for the cursor
function! go#util#OffsetCursor()
return go#util#Offset(line('.'), col('.'))
endfunction
" TODO(arslan): I couldn't parameterize the highlight types. Check if we can
" simplify the following functions