Compare commits

..

2 Commits

Author SHA1 Message Date
Andrew d5d8179383
Add release documentation 2022-05-14 00:15:15 +04:00
Andrew 8efc86279f
Багфикс переключения не в списке 2022-05-13 21:04:10 +04:00
4 changed files with 31 additions and 19 deletions

6
CHANGELOG.md Normal file
View File

@ -0,0 +1,6 @@
2022-05-13 Version 0.1.0
------------------------
- Add: creating checkboxes and radio buttons
- Add: toggle checkboxes and radio buttons
- Add: setting indents

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) <year> <copyright holders>
Copyright (c) 2022 Andrew Nechaev
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

View File

@ -1,21 +1,21 @@
Vim Markdown
============
ftplugin для работы c markdown разметкой.
ftplugin to work with markdown.
Возможности
-----------
Features
--------
- Фолдинг и установка чекбоксов и радиокнопок
- Creating and toggle checkboxes and radio buttons
Установка
---------
Install
-------
```shell
mkdir ~/.vim/ftplugin
curl https://code.geekfrom.ru/i/vim-md/raw/branch/master/ftplugin/markdown.vim > ~/.vim/ftplufin/markdown.vim
curl https://code.geekfrom.ru/i/vim-md/raw/branch/master/ftplugin/markdown.vim > ~/.vim/ftplugin/markdown.vim
```
@ -23,7 +23,13 @@ Mappings
--------
| description | modes | mapping |
|-----------|-----|-------|
|Установить/убрать радиокнопку|normal, visual|`<leader>r`|
|Установить/убрать чекбокс|normal, visual|`<leader>c`|
|Переключить чекбокс/радиокнопку|normal, visual|`<leader>t`|
|------------------------------|----------------|-------------|
| Set/remove radio button | normal, visual | `<leader>r` |
| Set/remove checkbox | normal, visual | `<leader>c` |
| Toggle checkbox/radio button | normal, visual | `<leader>t` |
License
-------
MIT License. See `LICENSE` for more information.

View File

@ -1,13 +1,13 @@
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" File: ftplugin/markdown.vim
" Maintainer: Andrew Nechaev <i@geekfrom.ru>
" Version: 0.0.1
" Modified: 2022-05-13 18:30+0400
" Version: 0.1.0
" Modified: 2022-05-13 21:00+0400
" License: MIT
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
nnoremap <buffer> <silent> <Leader>t :call winrestview(<SID>toggle('^\s*[-+*]\s*[\[(]\zs.\ze[\])]', {' ': 'x', 'x': '-', '-': ' '}))<cr>
vnoremap <buffer> <silent> <Leader>t :call winrestview(<SID>toggle('^\s*[-+*]\s*[\[(]\zs.\ze[\])]', {' ': 'x', 'x': '-', '-': ' '}))<cr>
nnoremap <buffer> <silent> <Leader>t :call winrestview(<SID>toggle({' ': 'x', 'x': '-', '-': ' '}))<cr>
vnoremap <buffer> <silent> <Leader>t :call winrestview(<SID>toggle({' ': 'x', 'x': '-', '-': ' '}))<cr>
nnoremap <buffer> <silent> <Leader>r :call winrestview(<SID>toggleState('(', '( ) '))<cr>
vnoremap <buffer> <silent> <Leader>r :call winrestview(<SID>toggleState('(', '( ) '))<cr>
@ -16,9 +16,9 @@ vnoremap <buffer> <silent> <Leader>c :call winrestview(<SID>toggleState('[', '[
set tabstop=2 softtabstop=2 shiftwidth=2 expandtab
function s:toggle(pattern, dict, ...)
function s:toggle(dict)
let view = winsaveview()
execute 'keeppatterns s/' . a:pattern . '/\=get(a:dict, submatch(0), a:0 ? a:1 : " ")/e'
execute 'keeppatterns s/^\s*\(-\s*\|+\s*\|*\s\)\?\s*[\[(]\zs.\ze[\])]/\=get(a:dict, submatch(0), a:0 ? a:1 : " ")/e'
return view
endfunction