Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global variables override by buffer variables (#80) #137

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

rockandska
Copy link

@rockandska rockandska commented Dec 19, 2018

Hi,

Not a vim expert but seems to do the job requested by #80 and had personally the same needs.

It should allow users to be able to :

  • enable/disable indent-guides at the buffer level
  • tweak indent-guides at filetype / buffer level

For example, if you want :

  • only tab indentation inside sh files
  • only enable/show indent-guides for sh files
$ cat vimrc
let g:indent_guides_enable_on_vim_startup = 0
let g:indent_guides_tab_guides = 0
let g:indent_guides_space_guides = 1
let g:indent_guides_soft_pattern = ' '
$ cat after/ftplugin/sh.vim 
setlocal noexpandtab
setlocal softtabstop=0
setlocal shiftwidth=4
setlocal tabstop=4

let b:indent_guides_enable_on_vim_startup=1
let b:indent_guides_tab_guides = 1  
let b:indent_guides_space_guides = 0
let b:indent_guides_soft_pattern = '\t'

If you want enable indent-guides for all filetype / buffers except for sh filetype

$ cat vimrc
let g:indent_guides_enable_on_vim_startup = 1
$ cat after/ftplugin/sh.vim 
let b:indent_guides_enable_on_vim_startup=0

Comments / suggestions welcome

Edit: update example to reflect new commit

Copy link
Member

@alerque alerque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this covers some of the same ground as #68 (to address
#61) but covers other areas as well and with a different solution.

I'm fine with working with one or both of these PRs to get them mergable.
Buffer local overrides are a good thing in my book as long as global
defaults are honored first.

That being said this will need some merge conflict resolution or rebasing
now. Any chance you are still around to handle that?

@rockandska
Copy link
Author

Will try to resolve merge conflicts soon

autoload/indent_guides.vim Outdated Show resolved Hide resolved
@rockandska rockandska force-pushed the buffer_local_variables branch from de15457 to 6efa633 Compare February 24, 2023 14:01
@rockandska
Copy link
Author

Rebased and fix applied

@rockandska rockandska force-pushed the buffer_local_variables branch from 6efa633 to 22157bf Compare February 24, 2023 14:07
@rockandska rockandska requested a review from alerque March 1, 2023 12:41
@alerque alerque force-pushed the buffer_local_variables branch from 6a01f3e to 30ce443 Compare March 1, 2023 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants