Giter Club home page Giter Club logo

wordswitch.nvim's Introduction

WordSwitch.nvim

A simple word switch plugin with neovim

Example

WordSwitch.nvim is a simple plugin for Neovim

A rewrite of Antovim use Lua

Table of contents

Requirements

WordSwitch.nvim require Neovim version 0.7 or above

Installation

If you are using vim-plug or packer.nvim, then add one of the following line to your init.vim or init.lua file, correspodingly:

" vim-plug
Plug 'tandy1229/wordswitch.nvim'

" packer.nvim
use 'tandy1229/wordswitch.nvim'

For lazy.nvim:

-- lazy.nvim
{ 'tandy1229/wordswitch.nvim' },

Or you can use other plugin manager.

Quick Start

The plugin provides a single command WordSwitch, which will replace the word under the matching word within a list of substitutions. eg, with your cursor over the word true will switch to false.

Note

now you can also switch TRUE to FALSE and switch True to False!!

It works for all other dictionaries!

The default mapping is gs to switch the word.

Change keymap

You can change the default keymap gs to your prefer, for example:

For init.vim user, you can add it into your init.vim:

let g:wordswitch_keymap = '<Leader>s'

For init.lua user, you can add it to your init.lua:

vim.g.wordswitch_keymap = '<Leader>s'

Custom list

You can customize your own list, use g:custom_wordswitch_definitions to add your own list, for example:

For init.vim user, you can add it into your init.vim:

let g:custom_wordswitch_definitions = [
\  [ 'let', 'unlet' ],
\  [ 'thx', 'thank you'],
\  [ 'under', 'below', 'beneath']
]

For init.lua user, you can add it to your init.lua:

vim.g.custom_wordswitch_definitions = {
    { 'let', 'unlet' },
    { 'thx', 'thank you' },
    { 'under', 'below', 'beneath' }
}

Source Word

The default words list are beneath:

{ 'acquire'   , 'release'      }
{ 'add'       , 'remove'       }
{ 'advance'   , 'retreat'      }
{ 'allocate'  , 'deallocate'   }
{ 'allow'     , 'deny'         }
{ 'assemble'  , 'disassemble'  }
{ 'assign'    , 'deassign'     }
{ 'associate' , 'dissociate'   }
{ 'attach'    , 'detach'       }
{ 'begin'     , 'end'          }
{ 'bind'      , 'unbind'       }
{ 'commit'    , 'rollback'     }
{ 'compile'   , 'decompile'    }
{ 'compose'   , 'parse'        }
{ 'compress'  , 'decompress'   }
{ 'connect'   , 'disconnect'   }
{ 'construct' , 'destruct'     }
{ 'create'    , 'destroy'      }
{ 'do'        , 'undo'         }
{ 'enable'    , 'disable'      }
{ 'encode'    , 'decode'       }
{ 'encrypt'   , 'decrypt'      }
{ 'enqueue'   , 'dequeue'      }
{ 'enter'     , 'leave'        }
{ 'expand'    , 'collapse'     }
{ 'first'     , 'last'         }
{ 'freeze'    , 'unfreeze'     }
{ 'front'     , 'back'         }
{ 'get'       , 'set'          }
{ 'grant'     , 'revoke'       }
{ 'head'      , 'tail'         }
{ 'high'      , 'low'          }
{ 'import'    , 'export'       }
{ 'include'   , 'exclude'      }
{ 'increase'  , 'decrease'     }
{ 'increment' , 'decrement'    }
{ 'indent'    , 'dedent'       }
{ 'inflate'   , 'deflate'      }
{ 'inject'    , 'eject'        }
{ 'input'     , 'output'       }
{ 'insert'    , 'delete'       }
{ 'install'   , 'uninstall'    }
{ 'left'      , 'right'        }
{ 'Left'      , 'Right'        }
{ 'link'      , 'unlink'       }
{ 'load'      , 'unload'       }
{ 'lock'      , 'unlock'       }
{ 'max'       , 'min'          }
{ 'maximum'   , 'minimum'      }
{ 'new'       , 'old'          }
{ 'next'      , 'previous'     }
{ 'open'      , 'close'        }
{ 'off'       , 'on'           }
{ 'paste'     , 'cut'          }
{ 'push'      , 'pop'          }
{ 'read'      , 'write'        }
{ 'reference' , 'dereference'  }
{ 'register'  , 'deregister'   }
{ 'resume'    , 'suspend'      }
{ 'select'    , 'deselect'     }
{ 'send'      , 'receive'      }
{ 'serialize' , 'deserialize'  }
{ 'set'       , 'get'          }
{ 'show'      , 'hide'         }
{ 'start'     , 'stop'         }
{ 'true'      , 'false'        }
{ 'up'        , 'down'         }
{ 'upper'     , 'lower'        }

Star History

Star History Chart

Credit

LICENSE

MIT

wordswitch.nvim's People

Contributors

iamtm avatar tandy1229 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

iamtm

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.