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

Scrollbar on fixed column #4

Closed
YodaEmbedding opened this issue Dec 14, 2020 · 3 comments
Closed

Scrollbar on fixed column #4

YodaEmbedding opened this issue Dec 14, 2020 · 3 comments
Assignees

Comments

@YodaEmbedding
Copy link

Is it possible to configure the scrollbar to always appear on a fixed column, e.g. at 80 characters?

This should occur regardless of how wide the window is.

@dstein64 dstein64 self-assigned this Dec 15, 2020
dstein64 added a commit that referenced this issue Dec 17, 2020
@dstein64
Copy link
Owner

@YodaEmbedding, thanks for the idea!

This is now implemented (23fdffb).

After updating the plugin, the g:scrollview_base and g:scrollview_column variables can be used to control the scrollbar placement. The base specifies where the scrollbar is anchored. This can be 'left', 'right', or 'buffer'. 'left' and 'right' anchor the scrollbar at the corresponding window edge ('right' is the default value). 'buffer' anchors the scrollbar to the buffer. g:scrollview_column specifies the position (1-indexed) relative to the base.

The following settings correspond to the example you gave ("scrollbar to always appear on a fixed column, e.g. at 80 characters").

let g:scrollview_base = 'buffer'  " or 'left' to position relative to window edge
let g:scrollview_column = 80

@YodaEmbedding
Copy link
Author

YodaEmbedding commented Dec 19, 2020

Using g: makes it difficult to set per-buffer. For example, consider a vim help window (80 columns) and a python file (79 columns) open in two split windows.

vim_help_python_file

Perhaps better is b: so that users can set per filetype:

autocmd FileType python let b:scrollview_column=79 | let b:scrollview_base = 'buffer'
autocmd FileType rust   let b:scrollview_column=80 | let b:scrollview_base = 'buffer'

An alternative method of configuration is to depend on the buffer's colorcolumn:

let g:scrollview_column = 'colorcolumn'  "  default

...though with multi-colorcolumns, the correct choice is undefined -- and requires manual control with b:scrollview_column.

dstein64 added a commit that referenced this issue Dec 20, 2020
In addition to the existing global configuration.

(Issue #4)
@dstein64
Copy link
Owner

dstein64 commented Dec 20, 2020

@YodaEmbedding, thanks again! I hadn't considered that.

It's now possible to configure scrollview's settings specifically per-window, per-tab, and/or per-buffer, in addition to globally.

For example, let w:scrollview_base = 'buffer' would apply only for the window it's defined in. let b:scrollview_base = 'left' would apply only for the buffer.

98bd3e5

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

No branches or pull requests

2 participants