Ryan Rueger

ryan@rueg.re / picture / key / home
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrrueger <rrueger@ethz.ch>2020-07-23 11:25:03 +0200
committerrrueger <rrueger@ethz.ch>2020-07-23 11:25:03 +0200
commitb20c29c906e03bbe483c86013eb3ee5fec4881a4 (patch)
tree02feaedfca1aa8e88690f6ec1d31cdef0c55409b
parentb039ee8ccbe6bd4920e78fd7f67671a11390f2d9 (diff)
downloadstatusryne-b20c29c906e03bbe483c86013eb3ee5fec4881a4.tar.gz
statusryne-b20c29c906e03bbe483c86013eb3ee5fec4881a4.tar.bz2
statusryne-b20c29c906e03bbe483c86013eb3ee5fec4881a4.zip
Correctly identify size of the current split
Until now, I was using &columns to determine the width of available space for the statusline. However, when using a vertical split, &columns would still report the full vim window width, not the split width. The `winwidth(0)` (0 = current window) function returns the correct value.
-rw-r--r--plugin/statusryne.vim6
1 files changed, 3 insertions, 3 deletions
diff --git a/plugin/statusryne.vim b/plugin/statusryne.vim
index 48f63d4..6e84966 100644
--- a/plugin/statusryne.vim
+++ b/plugin/statusryne.vim
@@ -221,12 +221,12 @@ function! FileName()
" 2) Show only first character of every directory in path.
" 3) Show only basename.
- if (&columns > len(fullname) + remainder)
+ if (winwidth(0) > len(fullname) + remainder)
let shortpath = substitute(fullname, $HOME, '~', "")
return ' ' . shortpath
- elseif (&columns > len(pathshorten(fullname)) + remainder)
+ elseif (winwidth(0) > len(pathshorten(fullname)) + remainder)
let home = pathshorten($HOME . '/')
let shortpath = substitute(pathshorten(fullname), home, '~/', "")
@@ -358,7 +358,7 @@ function! TabLine()
" For equal with tabs, fitted to longest tab label.
let g:maxlabellen = max([g:mintablabellen, MaxLen(g:tablabels)])
" For full screen width equal width tabs.
- " let g:maxlabellen = &columns / tabpagenr('$')
+ " let g:maxlabellen = winwidth(0) / tabpagenr('$')
" }}}