axring.vim icon indicating copy to clipboard operation
axring.vim copied to clipboard

:ring: Enhance `<c-a>`, `<c-x>` ability to switch keywords.

axring.vim

Build Status GitHub tag doc Vim Version

:ring: Enhance <c-a>, <c-x> ability to switch keywords.

Feature

  1. <c-a> to select next word on the ring.
  2. <c-x> to select previous word on the ring.
  3. Echo the ring when select a word.
  4. Support repeat.vim

Screenshot

axring

Install

I suggest you to use a plugin manager, such vim-plug or others.

Plug 'tenfyzhong/axring.vim'
  • Manual
git clone https://github.com/tenfyzhong/axring.vim.git ~/.vim/bundle/axring.vim
echo 'set rtp+=~/.vim/bundle/axring.vim' >> ~/.vimrc
vim -c 'helptag ~/.vim/bundle/axring.vim/doc' -c qa!

Example Configruation

let g:axring_rings = [
      \ ['&&', '||'],
      \ ['&', '|', '^'],
      \ ['&=', '|=', '^='],
      \ ['>>', '<<'],
      \ ['>>=', '<<='],
      \ ['==', '!='],
      \ ['>', '<', '>=', '<='],
      \ ['++', '--'],
      \ ['true', 'false'],
      \ ['verbose', 'debug', 'info', 'warn', 'error', 'fatal'], 
      \ ]

let g:axring_rings_go = [
      \ [':=', '='],
      \ ['byte', 'rune'],
      \ ['complex64', 'complex128'],
      \ ['int', 'int8', 'int16', 'int32', 'int64'],
      \ ['uint', 'uint8', 'uint16', 'uint32', 'uint64'],
      \ ['float32', 'float64'],
      \ ['interface', 'struct'],
      \ ]

Usage

  1. Configure option g:axring_ring
  2. Edit a file.
  3. Place you cursor on a word which is in the g:axring_ring
  4. type <c-a> or <c-x>