Git Product home page Git Product logo

bullets.vim's Introduction

Bullets.vim

All Contributors

ℹ️ Looking for help/maintainers #126

Description

Bullets.vim is a Vim plugin for automated bullet lists.

Simple bullets:

demo

Wrapped text bullets: wrapped bullets

Renumbering lines: renumber demo

Installation

With Vim 8.1+ native package manager:

Clone into

.vim/pack/plugins/start

Make sure to include packloadall in your vimrc.

With VimPlug:

Plug 'bullets-vim/bullets.vim'

Then source your bundle file and run :PlugInstall.

Usage

In markdown or a text file start a bulleted list using - or *. Press return to go to the next line, a new list item will be created.

Configuration

Filetypes

You can choose which file types this plugin will work on:

" Bullets.vim
let g:bullets_enabled_file_types = [
    \ 'markdown',
    \ 'text',
    \ 'gitcommit',
    \ 'scratch'
    \]

You can disable this plugin for empty buffers (no filetype):

let g:bullets_enable_in_empty_buffers = 0 " default = 1

Enable/disable default key mappings:

let g:bullets_set_mappings = 0 " default = 1

Add a leader key before default mappings:

let g:bullets_mapping_leader = '<M-b>' " default = ''

Customize key mappings:

let g:bullets_set_mappings = 0 " disable adding default key mappings, default = 1

" default = []
" N.B. You can set these mappings as-is without using this g:bullets_custom_mappings option but it
" will apply in this case for all file types while when using g:bullets_custom_mappings it would
" take into account file types filter set in g:bullets_enabled_file_types, and also
" g:bullets_enable_in_empty_buffers option.
let g:bullets_custom_mappings = [
  \ ['imap', '<cr>', '<Plug>(bullets-newline)'],
  \ ['inoremap', '<C-cr>', '<cr>'],
  \
  \ ['nmap', 'o', '<Plug>(bullets-newline)'],
  \
  \ ['vmap', 'gN', '<Plug>(bullets-renumber)'],
  \ ['nmap', 'gN', '<Plug>(bullets-renumber)'],
  \
  \ ['nmap', '<leader>x', '<Plug>(bullets-toggle-checkbox)'],
  \
  \ ['imap', '<C-t>', '<Plug>(bullets-demote)'],
  \ ['nmap', '>>', '<Plug>(bullets-demote)'],
  \ ['vmap', '>', '<Plug>(bullets-demote)'],
  \ ['imap', '<C-d>', '<Plug>(bullets-promote)'],
  \ ['nmap', '<<', '<Plug>(bullets-promote)'],
  \ ['vmap', '<', '<Plug>(bullets-promote)'],
  \ ]

Enable/disable deleting the last empty bullet when hitting <cr> (insert mode) or o (normal mode):

let g:bullets_delete_last_bullet_if_empty = 0 " default = 1

Line spacing between bullets (1 = no blank lines, 2 = one blank line, etc.):

let g:bullets_line_spacing = 2 " default = 1

Don't/add extra padding between the bullet and text when bullets are multiple characters long:

let g:bullets_pad_right = 1 " default = 1
" I. text
" II. text
" III. text
" IV.  text
" V.   text
"     ^ extra spaces to align the text with the longest bullet

let g:bullets_pad_right = 0
" I. text
" II. text
" III. text
" IV. text
"    ^ no extra space between bullet and text

Indent new bullets when the previous bullet ends with a colon:

let g:bullets_auto_indent_after_colon = 1 " default = 1
" a. text
" b. text:
"   i. text

Maximum number of alphabetic characters to use for bullets:

let g:bullets_max_alpha_characters = 2 " default = 2
" ...
" y. text
" z. text
" aa. text
" ab. text

let g:bullets_max_alpha_characters = 1
" ...
" y. text
" z. text
" text

Nested outline bullet levels:

let g:bullets_outline_levels = ['ROM', 'ABC', 'num', 'abc', 'rom', 'std-', 'std*', 'std+'] " default
" Ordered list containing the heirarchical bullet levels, starting from the outer most level.
" Available bullet level options (cannot use the same marker more than once)
" ROM/rom = upper/lower case Roman numerals (e.g., I, II, III, IV)
" ABC/abc = upper/lower case alphabetic characters (e.g., A, B, C)
" std[-/*/+] = standard bullets using a hyphen (-), asterisk (*), or plus (+) as the marker.
" chk = checkbox (- [ ])

let g:bullets_outline_levels = ['num', 'abc', 'std-']
" Example [keys pressed to get this bullet]:
" 1. first parent
"   a. child bullet [ <cr><C-t> ]
"     - unordered bullet [ <cr><C-t> ]
"   b. second child bullet [ <cr><C-d> ]
" 2. second parent [ <cr><C-d> ]

Enable/disable automatically renumbering the current ordered bullet list when changing the indent level of bullets or inserting a new bullet:

let g:bullets_renumber_on_change = 1 " default = 1
" Example 1:
" 1. first existing bullet
"   a. second existing bullet [ hit <C-t> ]
" 2. third existing bullet [ this got renumbered 3 -> 2 when bullet 2 got demoted ]
"
" Example 2:
" 1. first existing bullet
" 2. second existing bullet [ use <cr>/o to add a new bullet below this ]
" 3. new bullet
" 4. third existing bullet [ this got renumbered 3 -> 2 when bullet 2 got demoted ]

let g:bullets_renumber_on_change = 0
" Example:
" 1. first existing bullet
"   a. second existing bullet [ hit <C-t> ]
" 3. third existing bullet [ no renumbering so this bullet remained `3` ]
"
" Example 2:
" 1. first existing bullet
" 2. second existing bullet [ use <cr>/o to add a new bullet below this ]
" 3. new bullet
" 3. third existing bullet [ no renumbering so this bullet remained `3` ]

Enable/disable toggling parent and child checkboxes to indicate "completion" of child checkboxes:

let g:bullets_nested_checkboxes = 1 " default = 1
" Example:
" - [ ] first bullet
"   - [ ] child bullet  [ type <leader>x ]
"     - [ ] sub-child
"   - [ ] child bullet
"
" Result:
" - [o] first bullet   [ <- indicates partial completion of sub-tasks ]
"   - [X] child bullet
"     - [X] sub-child  [ <- children get checked when parents get checked ]
"   - [ ] child bullet

Define the checkbox markers to use to indicate unchecked, checked, and "partially" checked. When only two marker characters are defined, the use of partial completion markers will be disabled. If more than two markers are defined, each character between the first and last characters will be used to indicate a percentage of the child checkboxes that are checked. Each marker corresponds to 1/n, where n is the number of partial completion markers. By default, there are three partial completion markers, ., o, and O, corresponding to 33%, 66%, and up to but less than 100%, respectively. Note that unchecked ([ ]) and checked ([x] or [X]) statuses using the default markers are always valid, even if you set custom markers for unchecked and checked.

let g:bullets_checkbox_markers = ' .oOX'
" Example:
" - [o] parent bullet  [ <- `o` indicates 66% - 99% of children are checked ]
"   - [ ] child bullet
"   - [.] child bullet [ <- partial completions don't count as complete ]
"     - [ ] sub-child bullet [ <- 1/4 of children checked so parent is `.` ]
"     - [ ] sub-child bullet
"     - [ ] sub-child bullet
"     - [X] sub-child bullet
"   - [X] child bullet
"   - [X] child bullet
"
" You can use fancy markers:
" let g:bullets_checkbox_markers = '✗○◐●✓'
" - [✗] unchecked
" - [○] partial
"   - [✓] checked
"   - [✗] unchecked
"   - [✗] unchecked
"   - [✗] unchecked

Define whether toggling partially complete checkboxes sets the checkbox to checked or unchecked:

" Example 1:
let g:bullets_checkbox_partials_toggle = 1 " default = 1
" - [o] partially checked  [ type <leader>x ]
"   - [x] sub bullet
"   - [ ] sub bullet
"
" Result:
" - [x] checked
"   - [x] sub bullet
"   - [x] sub bullet
"
" Example 2:
let g:bullets_checkbox_partials_toggle = 0
" - [o] partially checked  [ type <leader>x ]
"   - [x] sub bullet
"   - [ ] sub bullet
"
" Result:
" - [ ] checked
"   - [ ] sub bullet
"   - [ ] sub bullet

Mappings

  • Insert new bullet in INSERT mode: <cr> (Return key)
  • Same as in case you want to unmap in INSERT mode (compatibility depends on your terminal emulator): <C-cr>
  • Insert new bullet in NORMAL mode: o
  • Renumber current visual selection: gN
  • Renumber entire bullet list containing the cursor in NORMAL mode: gN
  • Toggle a checkbox in NORMAL mode: <leader>x
  • Demote a bullet (indent it, decrease bullet level, and make it a child of the previous bullet):
    • NORMAL mode: >>
    • INSERT mode: <C-t>
    • VISUAL mode: >
  • Promote a bullet (unindent it and increase the bullet level):
    • NORMAL mode: <<
    • INSERT mode: <C-d>
    • VISUAL mode: >

Disable default mappings:

let g:bullets_set_mappings = 0

Add a leader key before default mappings:

let g:bullets_mapping_leader = '<M-b>'
" Set <M-b> to the leader before all default mappings:
" Example: renumbering becomes `<M-b>gN` instead of just `gN`

Just add above to your .vimrc

Documentation

:h bullets

Testing

The test suite is written using vimrunner. It is known to run on macOS with MacVim installed, and on travis. Your vim must have +clientserver and either have its own GUI or in a virtual X11 window.

On your mac run:

bundle install
bundle exec rspec

On linux:

bundle install
xvfb-run bundle exec rspec

You should see a Vim window open which will run each test, same general idea as Capybara integration testing. ❤️

TODO

  • eliminate trailing bullet on previous line if user pressed twice
  • allow indenting while in insert mode (C-l: indent right, C-h: indent left)
  • scope the keybindings and functions to markdown and perhaps text
  • allow GFM-style checkbox auto bullet
  • prefix shortcuts and allow disabling them
  • add numbered list
  • reset numbers (user selects numbered bullets 3-5 and copies to middle of document, then reselects and resets them to 1-3)
  • check if plugin initialized and don't load if it did
  • allow for return without creating a bullet (only possible in GuiVim unfortunately)
  • check if user is at EOL before appending auto-bullet - they may just want to
  • attempt to keep the same total bullet width even as number width varies (right padding)
  • detect lists that have multiline bullets (should have no empty lines between lines).
  • add alphabetic list
  • support for intelligent alphanumeric indented bullets e.g. 1. \t a. \t 1.
  • change nested outline levels in visual mode
  • support renumbering of alphabetical, roman numerals, and nested lists
  • update documentation for nested bullets
  • support nested bullets with child and partial completion
  • support for nested numerical bullets, e.g., 1. -> 1.1 -> 1.1.1, 1.1.2
  • add option to turn non-bullet lines into new bullets with <C-t>/>>/>

About

Hashrocket logo

Bullets.vim is kindly supported by Hashrocket, a multidisciplinary design and development consultancy. If you'd like to work with us or join our team, don't hesitate to get in touch.

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Dorian Karter

💻 ⚠️ 📖 🚧

Cormac Relf

💻 🐛

Keith Miyake

💻 📖 🤔 🚧

Chayoung You

💻 📖

Adriaan Zonnenberg

💻

eater

💻

hut

💻 📖

mykoza

💻 🤔

noodlor

💻

Harshad Srinivasan

💻 🐛

Erick A. Chacón Montalván

🤔

Sam Griesemer

💻 🐛

Charles Pence

💻

Marko Stojanovic

📖

Clark

📖

Wenzel

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

bullets.vim's People

Contributors

adriaanzon avatar allcontributors[bot] avatar clarkshaeffer avatar cormacrelf avatar cpence avatar dependabot[bot] avatar dkarter avatar eater avatar harshad1 avatar hut avatar huynle avatar kaymmm avatar noodlor avatar samgriesemer avatar wenzel-hoffman avatar yous avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bullets.vim's Issues

Indent on <S-R>

When in insert mode, if the user types <S-R>, they likely still want to stay on the same indentation-depth as the text. So, it'd be ideal to indent to the width of the current node on <S-R>.

This would make the creation of multi-line bullet (or cleanly formatted bullet points) easier:

1. This is a very long bullet with
   multiple paragraphs.
2. That bullet was long! But this one is
   a bit shorter.
- [ ] Ideally, this would work with
      Checkboxes too!
  - [ ] It'd be cool if this works on
        children.
  - Even when those children might have
    different bullet types. 

Bullets is messing with the abbreviations

I have some abbreviations defined with new lines inside them and they work as expected when bullets is disabled, but totally different with the plugin.

Something like this:

ab artcl
\<CR>---
\<CR>title: ""
\<CR>description: ""
\<CR>---

Normal output should be:

---
title: ""
description: ""
---

But bullets transforms it into:

---title: ""description: ""---



(notice the inserted lines at the end).

Bullets is an amazing plugin for markdown and I would like to use it further, if this could be resolved.

[Feature Request] Add a flag to disable text object mappings

The default bullet text object mapping ab ib is conflict with vim default text object for parenthesis.
We only have a flag to disable all mappings g:bullets_set_mappings
Could you provide an extra flag to just disable text object mappings.

g:bullets_enable_in_empty_buffers keeps overwriting mappings after a filetype is set

Bullets adds

au Filetype markdown,text,gitcommit,etc nnoremap ... `

autocommands for all its configured mappings. If g:bullets_enable_in_empty_buffers is set, then it also adds

autocmd BufEnter * if bufname("") == "" | ' nnoremap ...

The desired effect is that :enew empty buffers will have bullets enabled even before you add a filetype. However, this affects the buffers some plugins create that they want to add their own special mappings to. Essentially, UI plugins. I am using git-messenger.vim, which does this:

  1. open a neovim popup window
  2. enew
  3. set the filetype to gitmessengerpopup
  4. add mappings

But being a popup window, you don't BufEnter immediately. You have to trigger git-messenger again to switch into the window.

Bullets.vim's unnamed-buffer autocommands use BufEnter, which fires:

After entering a buffer. Useful for setting options for a file type. Also executed when starting to edit a buffer, after the BufReadPost autocommands.

So Bullets.vim's autocommands fire twice: once after enew (step 2), and once again when you enter the popup buffer. Overwriting any configured mappings every time you enter an unnamed buffer. So Bullets.vim is forcing a race between plugins to be the last one to execute their mapping commands, and winning. This is the usual reason for plugins not working well together.

As for solutions? I don't think g:bullets_enable_in_empty_buffers should be enabled by default. I don't know if you agree. Either way, you have #4 and #44 specifically for buffers without a filetype, so it would be better not to check the buffer name (ie filename), but instead check whether filetype is empty. After all, we don't generally care whether a buffer has a filename or not when it comes to mappings. An example is in https://stackoverflow.com/a/46681816:

autocmd FileType markdown,text nnoremap <buffer> <leader>f :1,$! cat
autocmd BufNewFile,BufRead * if empty(&filetype) | execute 'nnoremap <buffer> <leader>f :1,$! cat' | endif

So git-messenger.vim buffers, having been given a filetype, would no longer trigger Bullets.vim's mapping autocommands, and could win the race to be last.

Feature request to toggle check box

A more advanced toggle check would be useful for this plugin. I think the three scenarios below are essential. However, I will understand it goes beyond the scope of the plugin.

  • First: Toggle all the children below the current checkbox. For example, if I mark checkbox b,
- [ ] a
- [x] b
  - [ ] b1
  - [ ] b2
- [ ] c

I expect that their children are also marked.

- [ ] a
- [x] b
  - [x] b1
  - [x] b2
- [ ] c

Similarly, in the case that I unmark a checkbox, I will expect that their children are also unmarked.

  • Second: Half-check the parent, if a subset of all the children is marked. For example, If I mark b1,
- [ ] a
- [ ] b
  - [x] b1
  - [ ] b2
- [ ] c

I expect that the parent is b is half-marked.

- [ ] a
- [o] b
  - [x] b1
  - [ ] b2
- [ ] c
  • Third: Parent should be updated as marked if all the children are marked. Continuing with the previous example, If I mark b2,
- [ ] a
- [o] b
  - [x] b1
  - [x] b2
- [ ] c

then b should be updated as `marked'.

- [ ] a
- [x] b
  - [x] b1
  - [x] b2
- [ ] c

<cr> conflicts with coc

I've been using this plugin for a long time. But I recently started using coc. The <cr> functionality of coc breaks if I allow bullets plugin as bullets maps the key.

Is it possible to enable this plugin while also not breaking coc?

Feature suggestion: Custom bullets

I use vim extensively to create JIRA description documents. While doing so, I often have to have custom indents like (**, *** etc.)

It would be great if we could add this as a configurable feature.

[Feature Request] Auto-Nested Bullets

This is an awesome plugin! I use it all the time for note-taking.

One style of note taking that I use a lot is:

- Top level
    * Sub point
        + Sub-sub point

It'd be great if, after starting a new bullet line, I could hit TAB to automatically indent the bullet point and change it to the next "sub-level type" of bullet. Additionally, I'd like to be able to Shift + TAB back to the original level of indentation and correct "bullet type". I know that these key mappings may not be what's wanted by the general community, but if they were remappable, that'd be awesome.

I don't have any free time to look into this at the moment, but in a few months, I may be able to come back to it. If you have any suggestions for implementing this, please leave them below.

bullets.vim is enabled in quickfix window

I'm trying to remap how o behaves in the quickfix window, aka when filetype=qf but I'm getting weird behaviour. When running :nmap o from the quickfix window I see that o is mapped to *@:call <SNR>110_insert_new_bullet()<CR>. I have not changed any default bullets.vim configuration.

Is this a bug? How do I disable bullets.vim in the quickfix window?

breaks completion if completeopt=noinsert

Minimal vimrc

cal plug#begin($XDG_DATA_HOME.'/nvim/plugins')
Plug 'dkarter/bullets.vim'
cal plug#end()
set completeopt=menu,noinsert

Steps to reproduce

  1. Start nvim
  2. Start insertmode and type /
  3. <c-x><c-f> should show a menu with suggested completions like /bin and /etc
  4. Press <cr> to accept first suggestion

Actual behavior

A new line is created instead accepting the first suggestion. This only happens when bullets is loaded.

Expected behavior

The first suggestion should be selected instead of creating a new line. This would also be vims default behavior with set completeopt=menu,noinsert.

Notes

This is probably the reason for issue #74. You said there that you select the completion manually with <c-p> and<c-n>. Many people just accept the first suggestion with .

bullets_outline_levels 'ABC' 'abc' malfunction starting at C

It's using the default outline levels. Seems like C and D consistently loops back to A, if the following item. Once it gets to E, it's normal again.
This problem persists, although in different ways, even if I change the outline-levels to a different order.
Update: 'abc' turns out to have the same issue. It's only when demoting, promoting works fine.

Screen Shot 2020-06-04 at 3 58 41 PM

Automatic Alphanumeric List Insertion Implementation Messes Up Unordered Lists

The new implementation of alphanumeric list insertion messes up indentation for regular, unordered lists. I want to keep using "-" or "*" for all indented levels in my markdown, but it's no obvious for users to configure this. See screenshot of the problem:

vim-list-indented

After reading the source code, I figured out a hacky fix that I've personally implemented:

let g:bullets_outline_levels = ['ROM', 'ABC', 'num', 'abc', 'rom']

This is a cludgy fix that may end up losing users whose editor expects a less-intrusive list indentation default. I'd suggest either fixing behavior for regular unordered lists or removing 'std-', 'std*', and 'std+' from the outline levels by default and documenting how a user can override this if need-be.

Not an editor command: SelectBulletText

When I try and run :SelectBulletText I get the error

Not an editor command: SelectBulletText

It doesn't work for :SelectBullet, but everything else in the plugin seems to work.

This is what my minimal .vimrc looks like:

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'dkarter/bullets.vim' 
call vundle#end()

Does not work in insert mode with paste enabled

This issue follows to the more general #29 where I could not use this plugin in insert mode.

The reason for this is that the setting set paste in my .vimrc prevented it. After removing set paste from it, it works.

Also when activating set paste to paste something, the plugin does not work.

I am not so fluent in ruby and vimscript, to propose a fix. But maybe a workaround to use paste and the plugin together is possible.

<cr> conflicts with coc

I've been using this plugin for a long time. But I recently started using coc. The <cr> functionality of coc breaks if I allow bullets plugin as bullets maps the key.

Is it possible to enable this plugin while also not breaking coc?

<CR> and TAB are inserted after deleting an empty bullet

Vim 8.2.50, latest version of bullets installed.
When I close the bullet list with Enter, Vim deletes the empty bullet point (as expected) and then inserts and TAB (as not expected), like this:

* line 1
* line 2

    <

This happens when plasticboy/vim-markdown is enabled and only for * bullets.
Any ideas how to modify this behavior?

E706: Variable type mismatch for: l:bullet

Installed the latest version of bullets.vim using Plug in Vim 7.4 on both Linux and macOS. Trying to create any kind of bullet list in a text or markdown file yields the following error:

Error detected while processing function <SNR>18_insert_new_bullet:
line 18:
E706: Variable type mismatch for: l:bullet

error

I also tried using a minimal vimrc to rule out any issues there, but the result is the same.

Add support for latex enumerate/itemize environemnts

Would you consider extending your plugin to support latex?

There would be following use case for latex documents:

\documentclass{article}

\begin{document}

\begin{itemize}
  \item First item
  \item Second item
  \item \ldots
\end{itemize}

\end{document}

Checkboxes only work on + and - bullets

- [X] foo
	* [X] foo
		a. [ ] foo
		b. [ ] foo
		- [X] foo
	+ [ ] foo
	- [X] foo
		1. [ ] foo
		2. [ ] foo
		3. [ ] foo
		- [X] foo
	- [X] foo
		i. [ ] foo
		ii. [ ] foo
		iii. [ ] foo
		- [X] foo

Toggling the parent checkbox only toggles the currently checked boxes. GFM is also able to handle starplus bullets and numbered lists.

  • foo
    • foo
      a. [ ] foo
      b. [ ] foo
      • foo
    • foo
    • foo
      1. foo
      2. foo
      3. foo
      • foo
    • foo
      i. [ ] foo
      ii. [ ] foo
      iii. [ ] foo
      • foo

Conflict with Code Block <CR>

I am using code block a lot when formatting the Markdown in Vim.

The code block rule is

imap <expr> <CR> ExpanderCR()

function! s:IsCodeBlock(line, ccol)
    return a:line[0:2] ==# "```" && a:line[a:ccol : a:ccol+2] ==# "```"
endfunction

function! ExpanderCR()
  if s:IsCodeBlock(line, currentCol)
    return "\<CR>\<Esc>O"
  endif
  return "\<CR>"
endfunction

The main idea is to inspect if you want to insert a block, then it will auto-insert the empty line for you to continue typing.

Your input pointer

I think is bellow in bullets.vim conflict with the above.

 488     let l:keys = l:send_return ? "\<CR>" : ''

Don't know how to solve the problem, anyone has ideas?

Bullets.vim breaks <CR> mappings from other plugins

I have the following plugins enabled:

ncm2
ncm2-ultisnips
ncm2-markdown-subscope
ultisnips
bullets.vim

When a fenced code block editing a markdown file, eg python, ncm2 provides completions some of which are snippets. When I select a snippet in the popup menu and hit Enter, I normally expect the snippet to expand. However, with bullets.vim enabled, the expansion does not happen.

Other plugins like endwise and autopairs append their mapping to the user's <CR> mapping.

I also tried to disable the <CR> mapping of bullets.vim and call some function from the plugin to trigger list completion, but the functions are not available as they are script local.

feature suggestion: keep indent from first list item

Thanks for this great plugin!

Like some others here, I also use pandoc. I've started using it via equalprg provided by the vim-pandoc plugin to format my own markdown as I write (see https://github.com/vim-pandoc/vim-pandoc/blob/e9a24376c17817632951088838a3c3bdc1c5da30/doc/pandoc.txt#L177).

Pandoc lines up its markdown lists with four spaces after the list marker (see https://github.com/vim-pandoc/vim-pandoc/blob/e9a24376c17817632951088838a3c3bdc1c5da30/doc/pandoc.txt#L177). It looks like:

*    Item 1
    *    Subitem 1a
    *    Subitem 1b
*    Item 2
*    Item 3
    *    Subitem 3a
         *    Subitem 3ai

It would be great if the indentation (no matter how long—four spaces or otherwise) of the first list item were preserved when this plugin adds the next list item with "<CR>" or "o"—just to keep it all consistent as I'm writing before I reformat the entire doc. This is possibly related to the other open feature request on indentation (#11). File under "would be nice" but of course not pressing.

Add support for AsciiDoc(tor) lists

Hi,
First, I have to say that this is very nice plugin. I have been using it for note-taking in Markdown, but recently decided to switch to AsciiDoc.

Would it be possible to add support for AsciiDoc lists to this plugin?

If you are not familiar with them, they are similar to OrgMode headings, in that item nesting is done by adding more "bullets". Unordered lists use * and ordered lists use ..

Example unordered list:

* Unordered item
** Nested item
** Next nested item
* Level 1 item again

Example ordered list:

. Ordered item
.. Nested item
.. Next nested item
. Level 1 item again

For more information you can check AsciiDoc Documentation or AsciiDoctor Documentation.

The plugin already has basic support for * lists thanks to #18 , but no support for . or nesting (i.e. indenting using mappings), unless I just wasn't able to figure it out, in which case I'm sorry for opening issue.

Bullets does not work for empty filetype

For some no extension text file. Vim will treat its filetype as 'empty'.

:set filetype?
> filetype=

I tried to add '' into let g:bullets_enabled_file_types

let g:bullets_enabled_file_types = {''}

But it doesn't work,
Can bullets be enabled for these empty filetype files?

delete_last_bullet suggestion

what I want to enter at "this is a markdown test 2" is :

* this is a test 1
    ```markdown
    this is a markdown test 1
    this is a markdown test 2
    ```
* this is a test 2

but the actually is :

* this is a test
    ```markdown
    ths is a markdown test 1
*
    ```
* this is a test 2

so how can I change it.

setting syntax for R markdown files

Hi, bullets.vim is awesome for markdown and vimwiki files, but I can't get it to work with R markdown files https://rmarkdown.rstudio.com/. Here is what I currently have on my init.vim file:

let g:bullets_enabled_file_types = [ 'markdown', 'text', 'gitcommit', 'rmarkdown', 'vimwiki', 'Rmd']
Any thoughts on how to get it to work? thanks

number 'c' is followed by 'ci' and not 'd' when let g:bullets_renumber_on_change = 0

I am using bullets in neovim. Installed with vim-plug. The only setting I have changed is let g:bullets_renumber_on_change = 0

If I have

a. foo
b. bar
c. baz <- <CR>

I expect the next number to be 'd'. However I get 'ci' (and then 'cii', 'ciii', 'civ' etc etc).

This also happens when block selecting and indenting:

1. foo
2. bar
3. baz
4. fee
5. fi
6. fo
7. fum

block selecting 2->6 and indenting gives me:

1. foo
    a. bar
    b. baz
    c. fee
    ci. fi
    cii. fo
7. fum

Do you really need <C-l> and <C-h>?

Nice plugin, I was looking for this.

One small question: do you really need to map <C-l> and <C-h> to indent? Vim can already do this out of the box with <C-d> and <C-t>. Or is there any difference?

Not working in insert mode

I've your plugin installed, but it only works in normal mode after hitting o
I hope you can give me some hint about what's wrong with my setup.

Some suggest about Renumbering lines

When I use :Renumbering to number these lines, give the result as follows.

1. ...
2. ...
        3. ...
        4. ...
5. ...

Actually,I want to the next result.

1. ...
2. ...
        i. ...
        ii. ...
3. ...

That is all. Thank you for your work.

indent after wrap with bullets

Referencing this issue and this comment -- does anything need to be done to activate this feature? I installed bullets.vim but the wrapping does not seem to work as described.

I also have set wrap linebreak nolist in my .vimrc, which I'd imagine could be the only other configuration that could affect this. I'm also pretty certain that this isn't an issue with the plugin installation / the plugin is installed, given the automated bullet lists feature does work.

Let me know if there's anything I can provide to help with this.

Markdown code block problems

When I insert a block of code into Markdown (e. g. R) and set the wraps as follows, the code is interpreted as a list:

df <-
    tibble(
        x = c(0.5, 0.25, 0.75),
        y = c(0.4, 0.1, 0.1)
    )

A 'CR' after the last bracket leads to a new line, in which 'i)` is automatically inserted. Is there a way to enable bullets.vim only outside of markdown codeblocks or at least for special characters (e.g. )).?

Anyway, thanks for the great plugin!

feature suggestion: indent after wrap, continue bullets

I ran across the plugin while looking for a solution for this use case: start a list with a asterisk, continue to type even after wrapping. What happens is the text after wrapping starts at column 1, and new lines are not bulletted anymore:

* first line blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah 
blah blah blah blah 
second line blah blah blah blah
third line blah blah blah

What I wish would happen is that it would treat the wrapped line as part of the first bullet, indenting it to indicate that, and continue to bullet new lines that were typed (instead of caused by wrapping).

* first line blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah 
  blah blah blah blah 
* second line blah blah blah blah
* third line blah blah blah

And it would be nice if it would withstand reflowing and not get screwed up. And I want a pony.

Error message when trying to indent checkbox item

Indentation works fine for most of the lists; however, it shows the following error messages when trying indentation (ctrl-t) on checkbox lists (- [ ]):

Error detected while processing function <SNR>11_bullet_demote[1]..<SNR>11_change_bullet_level:
line   33:
E716: Key not present in Dictionary: bullet ==# tolower(l:closest_bullet.bullet)
E15: Invalid expression: l:closest_bullet.bullet ==# tolower(l:closest_bullet.bullet)
line   34:
E121: Undefined variable: l:islower
E15: Invalid expression: l:islower ? l:closest_bullet.bullet_type : toupper(l:closest_bullet.bullet_type)
line   43:
E121: Undefined variable: l:closest_type
E116: Invalid arguments for function index
E15: Invalid expression: index(g:bullets_outline_levels, l:closest_type)
line   45:
E121: Undefined variable: l:closest_index
E15: Invalid expression: l:closest_index == -1
line   62:
E121: Undefined variable: l:closest_index
E15: Invalid expression: l:closest_index + 1 < len(g:bullets_outline_levels) || l:curr_indent < l:closest_indent
line  102:
E121: Undefined variable: l:next_bullet_str
E15: Invalid expression: l:next_bullet_str !=# ''

As you can see, the dictionary corresponding to chk does not have the key bullet:

https://github.com/dkarter/bullets.vim/blob/0976e8761f6dd1e2847714e61c3612ad2b666b7b/plugin/bullets.vim#L197-L203

The problem is actually here, after line 626, l:closest_bullet does not have the key bullet:

https://github.com/dkarter/bullets.vim/blob/0976e8761f6dd1e2847714e61c3612ad2b666b7b/plugin/bullets.vim#L625-L626

Support CommonMark nested lists

The current indent/dedent scheme in bullets.vim does not support the CommonMark spec for nested ordered lists.

The new CommonMark spec changes the way nested lists are handled beneath an ordered list. Originally, a nested list could just be indented by 2 spaces, but the updates require that there is one space in addition to the list marker: https://spec.commonmark.org/0.29/#list-items

For example, this code is valid in most markdown:

1. Ordered list item
  - sub item with 2 spaces
  - another 2 space item

CommonMark states that this must now be written with len("1.") + 1=3 indent:

1. Ordered list item
   - Now indented by 3 spaces
   - Another 3 space ident

Updating a list is quite slow (profile attached)

I have found that updating a list (for example, by indenting a line in the middle) is quite slow.

To test this I did the following:

  1. Created a file with 100 identical lines, numbered from 1 to 100 (attached number.txt)
  2. Started profiler
  3. Indented 10 lines (#40 -> #50) by 1 indent
  4. Paused profiler

The renumbering appears to have taken 3.8 seconds on my relatively fast laptop (i7-8850h). Several functions appeared to have been called > 2K times.

number.log
number.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.