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

Add option to select side of Toc window location #656

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,16 @@ Try `:help concealcursor` and `:help conceallevel` for details.

let g:vim_markdown_toc_autofit = 1

### Choose TOC window location

- `g:vim_markdown_toc_location`

Choose location of the TOC window: left or right.
By default it's `left`

let g:vim_markdown_toc_location = 'right'


### Text emphasis restriction to single-lines

- `g:vim_markdown_emphasis_multiline`
Expand Down
6 changes: 5 additions & 1 deletion ftplugin/markdown.vim
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,11 @@ function! s:Toc(...)
if l:window_type ==# 'horizontal'
lopen
elseif l:window_type ==# 'vertical'
vertical lopen
if exists('g:vim_markdown_toc_location') && g:vim_markdown_toc_location ==# 'right'
vertical botright lopen
else
vertical topleft lopen
endif
" auto-fit toc window when possible to shrink it
if (&columns/2) > l:header_max_len && l:vim_markdown_toc_autofit == 1
" header_max_len + 1 space for first header + 3 spaces for line numbers
Expand Down
Loading