mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
refactor: disable showing trailing space and mix indent for non-modifiable buffers
This commit is contained in:
parent
54908dfe9f
commit
369687b047
@ -21,6 +21,10 @@ local function ime_state()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function trailing_space()
|
local function trailing_space()
|
||||||
|
if not vim.o.modifiable then
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
local line_num = nil
|
local line_num = nil
|
||||||
|
|
||||||
for i=1, fn.line('$') do
|
for i=1, fn.line('$') do
|
||||||
@ -43,6 +47,10 @@ local function trailing_space()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function mixed_indent()
|
local function mixed_indent()
|
||||||
|
if not vim.o.modifiable then
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
local space_pat = [[\v^ +]]
|
local space_pat = [[\v^ +]]
|
||||||
local tab_pat = [[\v^\t+]]
|
local tab_pat = [[\v^\t+]]
|
||||||
local space_indent = fn.search(space_pat, 'nwc')
|
local space_indent = fn.search(space_pat, 'nwc')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user