mirror of
https://github.com/dhruvasagar/vim-table-mode.git
synced 2025-11-08 11:03:47 -05:00
Fix #156, improved cursor column detection
This commit is contained in:
@@ -181,6 +181,11 @@ function! tablemode#spreadsheet#Average(range, ...) abort "{{{2
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! tablemode#spreadsheet#Sort(bang, ...) range "{{{2
|
function! tablemode#spreadsheet#Sort(bang, ...) range "{{{2
|
||||||
|
if exists('*getcurpos')
|
||||||
|
let col = getcurpos()[4] " curswant
|
||||||
|
else
|
||||||
|
let col = col('.')
|
||||||
|
endif
|
||||||
let opts = a:0 ? a:1 : ''
|
let opts = a:0 ? a:1 : ''
|
||||||
let bang = a:bang ? '!' : ''
|
let bang = a:bang ? '!' : ''
|
||||||
if a:firstline == a:lastline
|
if a:firstline == a:lastline
|
||||||
@@ -189,5 +194,5 @@ function! tablemode#spreadsheet#Sort(bang, ...) range "{{{2
|
|||||||
let [firstRow, lastRow] = [a:firstline, a:lastline]
|
let [firstRow, lastRow] = [a:firstline, a:lastline]
|
||||||
endif
|
endif
|
||||||
call tablemode#spreadsheet#MoveToStartOfCell()
|
call tablemode#spreadsheet#MoveToStartOfCell()
|
||||||
exec ':undojoin | '.firstRow.','.lastRow . 'sort'.bang opts '/.*\%'.col('.').'v/'
|
exec ':undojoin | '.firstRow.','.lastRow . 'sort'.bang opts '/.*\%'.col.'v/'
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
Reference in New Issue
Block a user