Plugin stuff
This commit is contained in:
@ -9,6 +9,7 @@ local cmd = vim.cmd -- Execute Vim commands
|
||||
local exec = vim.api.nvim_exec -- Execute Vimscript
|
||||
local g = vim.g -- Global variables
|
||||
local opt = vim.opt -- Set options (global/buffer/windows-scoped)
|
||||
local o = vim.o
|
||||
|
||||
-----------------------------------------------------------
|
||||
-- General
|
||||
@ -100,3 +101,14 @@ local disabled_built_ins = {
|
||||
for _, plugin in pairs(disabled_built_ins) do
|
||||
vim.g["loaded_" .. plugin] = 1
|
||||
end
|
||||
|
||||
--[[
|
||||
Deletes all trailing whitespaces in a file if it's not binary nor a diff.
|
||||
]]--
|
||||
function _G.trim_trailing_whitespaces()
|
||||
if not o.binary and o.filetype ~= 'diff' then
|
||||
local current_view = fn.winsaveview()
|
||||
cmd([[keeppatterns %s/\s\+$//e]])
|
||||
fn.winrestview(current_view)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user