Conditional window split
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I have line to split window at start:
au VimEnter * vsplit
But sometimes it's annoying because I'm opening vim in small terminal, in this case I'd like to not spit my window. I've tried this construction but it's not executing at start
if winwidth('%') >= 100
au VimEnter * vsplit
endif
Is there a way to execute spit window depending on window size?
neovim vim-windows
add a comment |Â
up vote
1
down vote
favorite
I have line to split window at start:
au VimEnter * vsplit
But sometimes it's annoying because I'm opening vim in small terminal, in this case I'd like to not spit my window. I've tried this construction but it's not executing at start
if winwidth('%') >= 100
au VimEnter * vsplit
endif
Is there a way to execute spit window depending on window size?
neovim vim-windows
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have line to split window at start:
au VimEnter * vsplit
But sometimes it's annoying because I'm opening vim in small terminal, in this case I'd like to not spit my window. I've tried this construction but it's not executing at start
if winwidth('%') >= 100
au VimEnter * vsplit
endif
Is there a way to execute spit window depending on window size?
neovim vim-windows
I have line to split window at start:
au VimEnter * vsplit
But sometimes it's annoying because I'm opening vim in small terminal, in this case I'd like to not spit my window. I've tried this construction but it's not executing at start
if winwidth('%') >= 100
au VimEnter * vsplit
endif
Is there a way to execute spit window depending on window size?
neovim vim-windows
neovim vim-windows
asked 1 hour ago
megas
1495
1495
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
3
down vote
accepted
Try moving the if
into the autocommand:
au VimEnter * if winwidth('%') >= 100 | vsplit | endif
add a comment |Â
up vote
3
down vote
You need to check the 'winwidth' result at the time the hook is run, not when it's defined. You can do this by putting it in a new function and calling that from the hook:
function Widevsplit()
if winwidth('%') >= 100
vsplit
endif
endfunction
au VimEnter * call Widevsplit()
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
Try moving the if
into the autocommand:
au VimEnter * if winwidth('%') >= 100 | vsplit | endif
add a comment |Â
up vote
3
down vote
accepted
Try moving the if
into the autocommand:
au VimEnter * if winwidth('%') >= 100 | vsplit | endif
add a comment |Â
up vote
3
down vote
accepted
up vote
3
down vote
accepted
Try moving the if
into the autocommand:
au VimEnter * if winwidth('%') >= 100 | vsplit | endif
Try moving the if
into the autocommand:
au VimEnter * if winwidth('%') >= 100 | vsplit | endif
answered 1 hour ago
Rich
13.5k11761
13.5k11761
add a comment |Â
add a comment |Â
up vote
3
down vote
You need to check the 'winwidth' result at the time the hook is run, not when it's defined. You can do this by putting it in a new function and calling that from the hook:
function Widevsplit()
if winwidth('%') >= 100
vsplit
endif
endfunction
au VimEnter * call Widevsplit()
add a comment |Â
up vote
3
down vote
You need to check the 'winwidth' result at the time the hook is run, not when it's defined. You can do this by putting it in a new function and calling that from the hook:
function Widevsplit()
if winwidth('%') >= 100
vsplit
endif
endfunction
au VimEnter * call Widevsplit()
add a comment |Â
up vote
3
down vote
up vote
3
down vote
You need to check the 'winwidth' result at the time the hook is run, not when it's defined. You can do this by putting it in a new function and calling that from the hook:
function Widevsplit()
if winwidth('%') >= 100
vsplit
endif
endfunction
au VimEnter * call Widevsplit()
You need to check the 'winwidth' result at the time the hook is run, not when it's defined. You can do this by putting it in a new function and calling that from the hook:
function Widevsplit()
if winwidth('%') >= 100
vsplit
endif
endfunction
au VimEnter * call Widevsplit()
answered 1 hour ago


JigglyNaga
28826
28826
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fvi.stackexchange.com%2fquestions%2f17418%2fconditional-window-split%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password