diff --git a/.config/nvim/lua/key/Common.lua b/.config/nvim/lua/key/Common.lua index 39fb3e0..212a444 100644 --- a/.config/nvim/lua/key/Common.lua +++ b/.config/nvim/lua/key/Common.lua @@ -1,15 +1,21 @@ require('key/Rekey') -rekey_normal('.', '@:') -- repeat command. -rekey_visual('.', '@:') -- repeat command. -rekey_normal('zz', 'wa') -- save all files. -rekey_normal('z', 'wqa') -- save & quit all. -rekey_normal('v', 'v') -- visual select (duplicate). -rekey_normal('gh', '0') -- go left. -rekey_normal('gl', '$') -- go right. -rekey_normal('gj', 'G') -- go bottom. -rekey_normal('gk', 'gg') -- go top. -rekey_normal('U', '') -- redo. +-- Write all we can and exit. Created this to drop non-writable stuff when piping to nvim. +function bye() + pcall(vim.cmd, "wa") + vim.cmd[[qa!]] +end + +rekey_normal('.', '@:') -- repeat command. +rekey_visual('.', '@:') -- repeat command. +rekey_normal('zz', 'wa') -- save all files. +rekey_normal('z', 'lua bye()') -- save & quit all. +rekey_normal('v', 'v') -- visual select (duplicate). +rekey_normal('gh', '0') -- go left. +rekey_normal('gl', '$') -- go right. +rekey_normal('gj', 'G') -- go bottom. +rekey_normal('gk', 'gg') -- go top. +rekey_normal('U', '') -- redo. rekey_normal(';', ':') -- remap ; to :. rekey_visual(';', ':') -- remap ; to :.