Skip to content
This repository was archived by the owner on May 29, 2023. It is now read-only.

Commit 1b0246a

Browse files
committed
Separate indent guides feature into its own plugin.
1 parent 7f6034b commit 1b0246a

File tree

3 files changed

+1
-93
lines changed

3 files changed

+1
-93
lines changed

README.md

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,7 @@ let g:workspace_autosave_ignore = ['gitcommit']
8080
```
8181

8282
## Indent Guides
83-
Add the following if you would like to have indent guides for your files:
84-
```
85-
let g:workspace_indentguides = 1
86-
```
87-
Manually calling the command `ToggleIndentGuides` will toggle indent guides scoped to a specific buffer.
88-
89-
Space indents are visually identified by the "┆" character, while tabs are distinguished by "|".
90-
91-
#### Ignore List
92-
If there are any files you would like to not add indent guides for, add the filetype to a list:
93-
```
94-
let g:workspace_indentguides_ignore = []
95-
```
83+
This feature has been moved to its own plugin [vim-indentguides](https://github.com/thaerkh/vim-indentguides).
9684

9785
# Installation
9886
This plugin requires Vim 8.0, follows the standard runtime path structure, and can be installed with a variety of plugin managers.

doc/workspace.txt

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ Table of Contents *workspace-contents*
1313
3. Autosave |workspace-autosave|
1414
3.1. Untrailing Spaces |workspace-untrailing-spaces|
1515
3.2. Ignore List |workspace-autosave-ignorelist|
16-
4. Indent Guides |workspace-indentguides|
17-
4.1. Ignore List |workspace-indentguides-ignorelist|
1816

1917
==============================================================================
2018
1. Sensible Settings *workspace-sensible-settings*
@@ -118,22 +116,3 @@ Git commit filetypes won't autosave (or trim trailing spaces) by default.
118116

119117
You can customize the ignore list as follows:
120118
`let g:workspace_autosave_ignore = ['gitcommit']`
121-
122-
==============================================================================
123-
4. Indent Guides *workspace-indentguides*
124-
125-
Add the following if you would like to have indent guides for your files:
126-
`let g:workspace_indentguides = 1`
127-
128-
Manually calling the command `ToggleIndentGuides` will toggle indent guides
129-
scoped to a specific buffer.
130-
131-
Space indents are visually identified by the "┆" character, while tabs are
132-
distinguished by "|".
133-
134-
------------------------------------------------------------------------------
135-
4.1. Ignore List *workspace-indentguides-ignorelist*
136-
137-
If there are any files you would like to not add indent guides for, add the
138-
filetype to a list:
139-
`let g:workspace_indentguides_ignore = []`

plugin/workspace.vim

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ let g:workspace_autosave_untrailspaces = get(g:, 'workspace_autosave_untrailspac
1313
let g:workspace_autosave_au_updatetime = get(g:, 'workspace_autosave_au_updatetime', 4)
1414
let g:workspace_sensible_settings = get(g:, 'workspace_sensible_settings', 0)
1515
let g:workspace_autocreate = get(g:, 'workspace_autocreate', 0)
16-
let g:workspace_indentguides = get(g:, 'workspace_indentguides', 0)
17-
let g:workspace_indentguides_firstlevel = get(g:, 'workspace_indentguides_firstlevel', 0)
18-
let g:workspace_indentguides_ignore = get(g:, 'workspace_indentguides_ignore', [])
1916

2017

2118
function! s:SetSensibleSettings()
@@ -217,66 +214,11 @@ function! s:SetUndoDir()
217214
endif
218215
endfunction
219216

220-
function! s:SetIndentGuideHighlights(user_initiated)
221-
if (g:workspace_indentguides && index(g:workspace_indentguides_ignore, &filetype) == -1) || a:user_initiated
222-
if !a:user_initiated
223-
silent! syntax clear IndentGuideSpaces
224-
silent! syntax clear IndentGuideDraw
225-
endif
226-
execute "highlight Conceal ctermfg=238 ctermbg=NONE guifg=Grey27 guibg=NONE"
227-
execute "highlight SpecialKey ctermfg=238 ctermbg=NONE guifg=Grey27 guibg=NONE"
228-
229-
if g:workspace_indentguides_firstlevel
230-
execute printf('syntax match IndentGuideDraw /^\zs\ \ze\ \{%i}/ containedin=ALL conceal cchar=┆', &l:shiftwidth - 1)
231-
endif
232-
execute 'syntax match IndentGuideSpaces /^\ \+/ containedin=ALL contains=IndentGuideDraw keepend'
233-
execute printf('syntax match IndentGuideDraw /\ \{%i}\zs \ze/ contained conceal cchar=┆', &l:shiftwidth - 1)
234-
endif
235-
endfunction
236-
237-
function! s:ToggleIndentGuides(user_initiated)
238-
let b:toggle_indentguides = get(b:, 'toggle_indentguides', 1)
239-
240-
if !a:user_initiated
241-
if !g:workspace_indentguides || index(g:workspace_indentguides_ignore, &filetype) != -1 || !b:toggle_indentguides
242-
" skip if not user initiated, and is either disabled, an ignored filetype, or already toggled on
243-
return
244-
endif
245-
endif
246-
247-
if b:toggle_indentguides
248-
call s:SetIndentGuideHighlights(a:user_initiated)
249-
250-
" TODO-TK: local and global listchars are the same, and s: variables are failing (??)
251-
let g:original_listchars = get(g:, 'original_listchars', &g:listchars)
252-
253-
let listchar_guides = ',tab:| ,trail:·'
254-
if &g:listchars !~ listchar_guides
255-
let &g:listchars = &g:listchars . listchar_guides
256-
endif
257-
setlocal concealcursor=inc
258-
setlocal conceallevel=2
259-
setlocal list
260-
let b:toggle_indentguides = 0
261-
else
262-
syntax clear IndentGuideSpaces
263-
syntax clear IndentGuideDraw
264-
265-
let &l:conceallevel = &g:conceallevel
266-
let &l:concealcursor = &g:concealcursor
267-
let &g:listchars = g:original_listchars
268-
setlocal nolist
269-
let b:toggle_indentguides = 1
270-
endif
271-
endfunction
272-
273217
function! s:PostLoadCleanup()
274218
if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
275219
endfunction
276220

277221
augroup Workspace
278-
au! BufRead,ColorScheme * call s:SetIndentGuideHighlights(0)
279-
au! BufWinEnter * call s:ToggleIndentGuides(0)
280222
au! VimEnter * nested call s:LoadWorkspace()
281223
au! VimLeave * call s:MakeWorkspace(0)
282224
au! InsertLeave * if pumvisible() == 0|pclose|endif
@@ -288,7 +230,6 @@ augroup WorkspaceAutosave
288230
augroup END
289231

290232
command! ToggleAutosave call s:ToggleAutosave()
291-
command! ToggleIndentGuides call s:ToggleIndentGuides(1)
292233
command! ToggleWorkspace call s:ToggleWorkspace()
293234
command! CloseHiddenBuffers call s:CloseHiddenBuffers()
294235

0 commit comments

Comments
 (0)