Advertisement
voyeg3r

preserve.lua

Aug 18th, 2021
1,402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.25 KB | None | 0 0
  1. -- lua preserve function to neovim
  2. function _G.preserve(cmd)
  3.     local cmd = string.format('keepjumps keeppatterns execute %q', cmd)
  4.     local original_cursor = vim.fn.winsaveview()
  5.     vim.api.nvim_command(cmd)
  6.     vim.fn.winrestview(original_cursor)
  7. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement