Conditional window split
Clash Royale CLAN TAG#URR8PPP
up vote
2
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 split 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
2
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 split 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
2
down vote
favorite
up vote
2
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 split 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 split 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
edited Sep 19 at 20:08
asked Sep 19 at 9:57
megas
1546
1546
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
7
down vote
accepted
Try moving the if
into the autocommand:
au VimEnter * if winwidth('%') >= 100 | vsplit | endif
add a comment |Â
up vote
6
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
7
down vote
accepted
Try moving the if
into the autocommand:
au VimEnter * if winwidth('%') >= 100 | vsplit | endif
add a comment |Â
up vote
7
down vote
accepted
Try moving the if
into the autocommand:
au VimEnter * if winwidth('%') >= 100 | vsplit | endif
add a comment |Â
up vote
7
down vote
accepted
up vote
7
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 Sep 19 at 10:23
Rich
13.6k11763
13.6k11763
add a comment |Â
add a comment |Â
up vote
6
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
6
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
6
down vote
up vote
6
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 Sep 19 at 10:22
JigglyNaga
31826
31826
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