Compare commits

..

No commits in common. "d5d81793831f474283e95b7f08f11e2c4d59ce28" and "e606979a16dd0b583e33ee27a3cd711bc23468d4" have entirely different histories.

4 changed files with 19 additions and 31 deletions

View File

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

View File

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