All Projects → monaqa → dps-dial.vim

monaqa / dps-dial.vim

Licence: MIT license
Increment/decrement plugin using denops.vim

Programming Languages

typescript
32286 projects
Vim Script
2826 projects

Projects that are alternatives of or similar to dps-dial.vim

denops-docker.vim
Manage Docker in Vim/Neovim
Stars: ✭ 48 (+128.57%)
Mutual labels:  vim-plugin, vim-denops
dps-ghosttext.vim
GhostText plugin powered by denops.vim
Stars: ✭ 20 (-4.76%)
Mutual labels:  vim-plugin, vim-denops
denops-deno
🐜 Deno module for denops.vim
Stars: ✭ 16 (-23.81%)
Mutual labels:  deno, vim-denops
denops-gh.vim
Vim/Neovim plugin for GitHub
Stars: ✭ 27 (+28.57%)
Mutual labels:  vim-plugin, vim-denops
fzf-preview.vim
fzf ❤️ preview
Stars: ✭ 49 (+133.33%)
Mutual labels:  vim-plugin
Dot-It-Up
A collection of dotfile scripts, plugins, and clever hacks so that you can become the master of your own OS! 🚀
Stars: ✭ 254 (+1109.52%)
Mutual labels:  vim-plugin
vim-rec
GNU Recutils syntax highlighting support for Vim
Stars: ✭ 30 (+42.86%)
Mutual labels:  vim-plugin
vim-terminal
A Vim plugin that opens an interactive terminal in a buffer for running programs
Stars: ✭ 45 (+114.29%)
Mutual labels:  vim-plugin
crux.land
crux.land is a free registry service meant for hosting small (≤ 20kB) single deno scripts.
Stars: ✭ 50 (+138.1%)
Mutual labels:  deno
create-xc-app
⚡️ Create a project in seconds!
Stars: ✭ 15 (-28.57%)
Mutual labels:  deno
cache
🥌 Deno cache library
Stars: ✭ 38 (+80.95%)
Mutual labels:  deno
pgsql-ast-parser
Yet another simple Postgres SQL parser
Stars: ✭ 152 (+623.81%)
Mutual labels:  deno
SimpleSnippets.vim
Simple snippet support for your Vim and Neovim
Stars: ✭ 86 (+309.52%)
Mutual labels:  vim-plugin
publish
Publish your module with one command in Deno.
Stars: ✭ 16 (-23.81%)
Mutual labels:  deno
vim-high
Vim plugin: All-in-one highlighter, highlight custom pattern like indentation, inactive window, word under the cursor
Stars: ✭ 20 (-4.76%)
Mutual labels:  vim-plugin
vim-lamp
💡Language Server Protocol client for Vim.
Stars: ✭ 34 (+61.9%)
Mutual labels:  vim-plugin
depsbot
⚙️ GitHub action to check freshness of your deno dependencies
Stars: ✭ 28 (+33.33%)
Mutual labels:  deno
monkey-master
A deno tool for buying hot GPUs in JD, such as RTX3080 rx6800, a thick-skinned orange!
Stars: ✭ 180 (+757.14%)
Mutual labels:  deno
wocket
A WebSocket library for Deno
Stars: ✭ 103 (+390.48%)
Mutual labels:  deno
lisan
🌈i18n, Reimagined! 🚀A blazing fast and super small i18n library for Javascript
Stars: ✭ 85 (+304.76%)
Mutual labels:  deno

dps-dial.vim: Extended increment/decrement plugin

日本語版はこちら

NOTICE: This plugin is work-in-progress yet. User interface is subject to change without notice.

Extended increment/decrement plugin for Vim/Neovim. Written in Deno, using denops.vim.

This plugin is a reimplementation of dial.nvim plugin for the following purposes:

  • To support both Vim and Neovim
  • For ease of development and debugging

Installation

This plugin depends on Deno and denops.vim.

Plug 'vim-denops/denops.vim'
Plug 'monaqa/dps-dial.vim'

Usage

By adding the following description to the configuration file, you can change the behavior of <C-a> and <C-x>:

nmap  <C-a>  <Plug>(dps-dial-increment)
nmap  <C-x>  <Plug>(dps-dial-decrement)
xmap  <C-a>  <Plug>(dps-dial-increment)
xmap  <C-x>  <Plug>(dps-dial-decrement)
xmap g<C-a> g<Plug>(dps-dial-increment)
xmap g<C-x> g<Plug>(dps-dial-decrement)

Features

Increment/Decrement/Toggle Non-Numeric Strings

You can perform string operations according to the following rules:

  • Date Increase/Decrease

    • If you press 7<C-a> on 25 in 2021/08/25, you will get the date one week later, 2021/09/01.
    • For the same string as above, pressing 7<C-a> on 08, then you will get the date seven months later, 2022/03/25.
  • Toggle between camelCase and snake_case

    • You can toggle the notation (camelCase, snake_case, etc.) of identifier under the cursor.
    • You need to tweak the configuration values such as g:dps_dial#augends.
  • Switch arbitrary words

    • You can switch between words with a several number of candidates, such as ['true', 'false'] or [ 'Mon', 'Tue', ..., 'Sun' ].
    • You need to tweak the configuration values such as g:dps_dial#augends.
  • User extension

    • You can create arbitrary rule with Vim script.

Dot-Repeat

Unlike the standard dot repeating in <C-a> / <C-x>, dps-dial.vim provides dot repeating with a fixed increment/decrement rule. For example, suppose you have a buffer like the following, and you want to move all due dates back one month:

date: 2020/11/08
...
due date of 1st report: 2020/11/23
...
due date of 2nd report: 2020/12/21
...
date of exam: 2021/01/14

In dps-dial.vim, it can be achieved by the following simple operations:

  1. Move the 11 in the first line 2020/11/08 and press <C-a> (this will change the date in the first line to 2020/12/08)
  2. Search for date and jump to the third line at date
  3. Do dot-repeat . (this will change the date in the third line to 2020/12/23)
  4. Do n.n. (the date will be incremented by one month for line 5 and 7 as well)

Note that if you press <C-a> at step3, the 1 part of 1st will be incremented. Dot-repeat remembers that the previous operation was to increment the month of the date by one, so you can skip the number 1st and just increment the date.

Configure Augend Rules

The increment/decrement is done according to the rules set in g:dps_dial#augends.

function! s:dps_dial_settings() abort
  let g:dps_dial#augends += ['boolean']
  call extend(g:dps_dial#aliases, {
  \   'boolean': {
  \     'kind': 'constant',
  \     'opts': {
  \       'elements': ['true', 'false'],
  \       'word': v:true,
  \       'cyclic': v:true,
  \     },
  \   },
  \ })
endfunction

autocmd User DenopsPluginPost:dial call <SID>dps_dial_settings()

Note that if there is a buffer-local variable b:dps_dial_augends, it will be used as the configuration.

autocmd FileType python let b:dps_dial#augends = ['decimal', {'kind': 'constant', 'opts': {'elements': ['True', 'False']}}]

Specify Augend Rules with Register Name

  • If you type "x<C-a> instead of <C-a>, the increment will be performed according to the rules written in g:dps_dial#augends#register#x instead of g:dps_dial#augends.
  • If you type "1<C-a> instead of <C-a>, the behavior of subsequent dot-repeat will be cumulative. That is, each time a dot-repeat is executed, the addend is increased by one.
  • If you type "X<C-a> instead of <C-a>, the increment will be performed according to the rules written in g:dps_dial#augends#register#x instead of g:dps_dial#augends, and the behavior of subsequent dot-repeat will be cumulative.

Other Features

See vim help for a list of augend and aliases (currently only Japanese).

:help dps-dial.txt

LICENSE

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].