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

move whitespace utility into separate plugins

This commit is contained in:
jdhao 2021-11-01 23:38:44 +08:00
parent 2d27a699dc
commit 8ebbec29d6
3 changed files with 4 additions and 9 deletions

View File

@ -1,11 +1,3 @@
" Remove trailing white space, see https://vi.stackexchange.com/a/456/15292
function! utils#StripTrailingWhitespaces() abort
let l:save = winsaveview()
" vint: next-line -ProhibitCommandRelyOnUser -ProhibitCommandWithUnintendedSideEffect
keeppatterns %s/\v\s+$//e
call winrestview(l:save)
endfunction
" Create command alias safely, see https://stackoverflow.com/q/3878692/6064933 " Create command alias safely, see https://stackoverflow.com/q/3878692/6064933
" The following two functions are taken from answer below on SO: " The following two functions are taken from answer below on SO:
" https://stackoverflow.com/a/10708687/6064933 " https://stackoverflow.com/a/10708687/6064933

View File

@ -128,7 +128,7 @@ nnoremap cc "_cc
xnoremap c "_c xnoremap c "_c
" Remove trailing whitespace characters " Remove trailing whitespace characters
nnoremap <silent> <leader><Space> :<C-U>call utils#StripTrailingWhitespaces()<CR> nnoremap <silent> <leader><Space> :<C-U>StripTrailingWhitespace<CR>
" check the syntax group of current cursor position " check the syntax group of current cursor position
nnoremap <silent> <leader>st :<C-U>call utils#SynGroup()<CR> nnoremap <silent> <leader>st :<C-U>call utils#SynGroup()<CR>

View File

@ -312,6 +312,9 @@ require("packer").startup({
-- showing keybindings -- showing keybindings
use {"folke/which-key.nvim", event = "VimEnter", config = [[require('config.which-key')]]} use {"folke/which-key.nvim", event = "VimEnter", config = [[require('config.which-key')]]}
-- show and trim trailing whitespaces
use {'jdhao/whitespace.nvim', event = 'VimEnter'}
end, end,
config = { config = {
max_jobs = 16, max_jobs = 16,