1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

Compare commits

..

No commits in common. "6b59c268f9a75cfbd3e9c87853c6686d2f07fc2c" and "bcdc8d3f663f85b2f1c0071200d9a972455ad74d" have entirely different histories.

2 changed files with 6 additions and 22 deletions

View File

@ -1,8 +0,0 @@
" Disable inserting comment leader after hitting o or O or <Enter>
set formatoptions-=o
set formatoptions-=r
set tabstop=2 " number of visual spaces per TAB
set softtabstop=2 " number of spaces in tab when editing
set shiftwidth=2 " number of spaces to use for autoindent
set expandtab " expand tab to spaces so that tabs are spaces

View File

@ -21,22 +21,14 @@ local function ime_state()
end end
local function trailing_space() local function trailing_space()
local line_num = nil -- Get the positions of trailing whitespaces from plugin 'jdhao/whitespace.nvim'.
local trailing_space_pos = vim.b.trailing_whitespace_pos
for i=1, fn.line('$') do
local linetext = fn.getline(i)
-- To prevent invalid escape error, we wrap the regex string with `[[]]`.
local idx = fn.match(linetext, [[\v\s+$]])
if idx ~= -1 then
line_num = i
break
end
end
local msg = "" local msg = ""
if line_num ~= nil then if #trailing_space_pos > 0 then
msg = string.format("[%d]trailing", line_num) -- Note that lua index is 1-based, not zero based!!!
local line = trailing_space_pos[1][1]
msg = string.format("[%d]trailing", line)
end end
return msg return msg