|
31 | 31 | " If you don't like mixed spaces-and-tabs, stick this in your ~/.vimrc: |
32 | 32 | " let g:shitespaceMatch = '/\s\+$\| \+\t\+\|\t\+ \+/' |
33 | 33 | " |
34 | | -" Updated: 2021-01-18 |
| 34 | +" Updated: 2022-09-13 |
35 | 35 | " Version: 0.1.0 |
36 | 36 | " Source: https://github.com/h3xx/vim-shitespace |
37 | 37 | " Project: https://github.com/h3xx/vim-shitespace |
38 | 38 | " Author: Dan Church [ h3xx{azzat}gmx{dizzot}com; h3xx@GitHub ] |
39 | 39 | " License: GPLv3 (http://www.gnu.org/licenses/gpl.html) |
40 | 40 | " |
41 | | -" Copyright (C) 2015-2021 Dan Church |
| 41 | +" Copyright (C) 2015-2022 Dan Church |
42 | 42 | " License GPLv3+: GNU GPL version 3 or later (http://gnu.org/licenses/gpl.html). |
43 | 43 | " This is free software: you are free to change and redistribute it. There is |
44 | 44 | " NO WARRANTY, to the extent permitted by law. |
45 | 45 |
|
46 | 46 | if exists('g:shitespaceShortcut') |
47 | 47 | " e.g. let g:shitespaceShortcut = '<F5>' |
48 | | - exec 'imap <silent> ' . g:shitespaceShortcut . " <C-o>:call Shitespace_toggle()<cr>" |
49 | | - exec 'nmap <silent> ' . g:shitespaceShortcut . " :call Shitespace_toggle()<cr>" |
| 48 | + exec 'imap <silent> ' . g:shitespaceShortcut . " <C-o>:call shitespace#Toggle()<cr>" |
| 49 | + exec 'nmap <silent> ' . g:shitespaceShortcut . " :call shitespace#Toggle()<cr>" |
50 | 50 | endif |
51 | 51 |
|
52 | | -if exists('g:shitespaceColor') |
53 | | - let s:color = g:shitespaceColor |
54 | | -else |
55 | | - let s:color = 'red' |
56 | | -endif |
57 | | -if exists('g:shitespaceMatch') |
58 | | - let s:matchpat = g:shitespaceMatch |
59 | | -else |
60 | | - " Show trailing whitespace and spaces before a tab |
61 | | - let s:matchpat = '/\s\+$\| \+\ze\t/' |
62 | | -endif |
63 | | - |
64 | | - |
65 | | -let s:on = 0 |
66 | | -function! Shitespace_toggle() |
67 | | - let s:on = !s:on |
68 | | - if s:on |
69 | | - let l:matchcmd = 'match ExtraWhitespace ' . s:matchpat |
70 | | - let l:hlcmd = 'hi ExtraWhitespace term=reverse ctermbg=' . s:color . ' guibg=' . s:color |
71 | | - exe l:hlcmd |
72 | | - aug Shitespace |
73 | | - " If the user changes the colorscheme while Shitespace is on, keep |
74 | | - " highlights. |
75 | | - exe 'autocmd ColorScheme * ' . l:hlcmd |
76 | | - exe 'autocmd BufEnter,WinEnter * ' . l:matchcmd |
77 | | - aug END |
78 | | - else |
79 | | - hi clear ExtraWhitespace |
80 | | - aug Shitespace |
81 | | - au! |
82 | | - aug END |
83 | | - endif |
84 | | -endfunction |
85 | | - |
86 | 52 | if !exists('g:shitespaceDefaultOn') || g:shitespaceDefaultOn |
87 | | - call Shitespace_toggle() |
| 53 | + call shitespace#Toggle() |
88 | 54 | endif |
89 | 55 |
|
90 | 56 | " vi: noet sts=4 sw=4 ts=4 |
0 commit comments