Skip to content

Commit ad0a17d

Browse files
committed
Fix cmd overwriting of unception config
in lua number if number will always be asserted as true ```lua if 0 then print("number is == true") end ``` And in viml boolean doesn't exit So for example this: nvim --cmd "let g:unception_disable=0" will still disable unception since in lua `if 0` == `if true` we could also do this instead ``` nvim --cmd "lua vim.g.unception_disable=false" ``` but i think it's better to also support viml
1 parent b9c17e7 commit ad0a17d

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

plugin/main.lua

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
print("OMG 2")
12
-------------------------------------------------------------------------------
23
-- Initialize all expected variables
34
-------------------------------------------------------------------------------
4-
if(vim.g.unception_delete_replaced_buffer == nil) then
5+
if(vim.g.unception_delete_replaced_buffer == nil or vim.g.unception_delete_replaced_buffer == 0) then
56
vim.g.unception_delete_replaced_buffer = false
67
end
78

8-
if(vim.g.unception_open_buffer_in_new_tab == nil) then
9+
if(vim.g.unception_open_buffer_in_new_tab == nil or vim.g.unception_open_buffer_in_new_tab == 0) then
910
vim.g.unception_open_buffer_in_new_tab = false
1011
end
1112

@@ -18,11 +19,11 @@ if(vim.g.unception_multi_file_open_method == nil) then
1819
vim.g.unception_multi_file_open_method = "argadd"
1920
end
2021

21-
if (vim.g.unception_enable_flavor_text == nil) then
22+
if (vim.g.unception_enable_flavor_text == nil or vim.g.unception_enable_flavor_text == 0) then
2223
vim.g.unception_enable_flavor_text = true
2324
end
2425

25-
if (vim.g.unception_block_while_host_edits == nil) then
26+
if (vim.g.unception_block_while_host_edits == nil or vim.g.unception_block_while_host_edits == 0) then
2627
vim.g.unception_block_while_host_edits = false
2728
end
2829

@@ -31,7 +32,7 @@ if (vim.g.unception_block_while_host_edits) then
3132
vim.g.unception_delete_replaced_buffer = false
3233
end
3334

34-
if (vim.g.unception_disable == nil) then
35+
if (vim.g.unception_disable == nil or vim.g.unception_disable == 0) then
3536
vim.g.unception_disable = false
3637
end
3738

0 commit comments

Comments
 (0)