Giter VIP home page Giter VIP logo

zsh-vimode-visual's Introduction

zsh-vimode-visual

zsh-vimode-visual provides visual mode in Zsh Line Editer

Description

Zsh Line Editer has two vi-like editing mode (viins, vicmd), but Vim has three or more major editing mode such as insert, command, visual and so on. Let's implement visual mode in Zsh Line Editer.

Installation

If you use zplug as a plugin manager for zsh, all you have to do is to put something like this to your .zshrc.

zplug "b4b4r07/zsh-vimode-visual"

Also, if you want to use it without conflict with zsh-users/zsh-syntax-highlighting, please set as follows.

zplug "zsh-users/zsh-syntax-highlighting", defer:2
zplug "b4b4r07/zsh-vimode-visual", defer:3

You can order the loading by setting the defer tag. In addition, if the defer tag is set to 2 or more, it's load after running compinit.

Otherwise, to install manually:

$ git clone https://github.com/b4b4r07/zsh-vimode-visual
$ source ./zsh-vimode-visual/zsh-vimode-visual.zsh

Configuration

zsh-vimode-visual is implemented with vivis that emulates Vim visual mode and vivli mode.

bindkey -M vicmd 'V'  vi-vlines-mode
bindkey -M vicmd 'v'  vi-visual-mode
bindkey -M vivis ' '  vi-visual-forward-char
bindkey -M vivis ','  vi-visual-rev-repeat-find
bindkey -M vivis '0'  vi-visual-bol
bindkey -M vivis ';'  vi-visual-repeat-find
bindkey -M vivis 'B'  vi-visual-backward-blank-word
bindkey -M vivis 'C'  vi-visual-substitute-lines
bindkey -M vivis 'D'  vi-visual-kill-and-vicmd
bindkey -M vivis 'E'  vi-visual-forward-blank-word-end
bindkey -M vivis 'F'  vi-visual-find-prev-char
bindkey -M vivis 'G'  vi-visual-goto-line
bindkey -M vivis 'I'  vi-visual-insert-bol
bindkey -M vivis 'J'  vi-visual-join
bindkey -M vivis 'O'  vi-visual-exchange-points
bindkey -M vivis 'R'  vi-visual-substitute-lines
bindkey -M vivis 'S ' vi-visual-surround-space
bindkey -M vivis "S'" vi-visual-surround-squote
bindkey -M vivis 'S"' vi-visual-surround-dquote
bindkey -M vivis 'S(' vi-visual-surround-parenthesis
bindkey -M vivis 'S)' vi-visual-surround-parenthesis
bindkey -M vivis 'T'  vi-visual-find-prev-char-skip
bindkey -M vivis 'U'  vi-visual-uppercase-region
bindkey -M vivis 'V'  vi-visual-exit-to-vlines
bindkey -M vivis 'W'  vi-visual-forward-blank-word
bindkey -M vivis 'Y'  vi-visual-yank
bindkey -M vivis '^M' vi-visual-yank
bindkey -M vivis '^[' vi-visual-exit
bindkey -M vivis 'b'  vi-visual-backward-word
bindkey -M vivis 'c'  vi-visual-change
bindkey -M vivis 'd'  vi-visual-kill-and-vicmd
bindkey -M vivis 'e'  vi-visual-forward-word-end
bindkey -M vivis 'f'  vi-visual-find-next-char
bindkey -M vivis 'gg' vi-visual-goto-first-line
bindkey -M vivis 'h'  vi-visual-backward-char
bindkey -M vivis 'j'  vi-visual-down-line
bindkey -M vivis 'jj' vi-visual-exit
bindkey -M vivis 'k'  vi-visual-up-line
bindkey -M vivis 'l'  vi-visual-forward-char
bindkey -M vivis 'o'  vi-visual-exchange-points
bindkey -M vivis 'p'  vi-visual-put
bindkey -M vivis 'r'  vi-visual-replace-region
bindkey -M vivis 't'  vi-visual-find-next-char-skip
bindkey -M vivis 'u'  vi-visual-lowercase-region
bindkey -M vivis 'v'  vi-visual-eol
bindkey -M vivis 'w'  vi-visual-forward-word
bindkey -M vivis 'y'  vi-visual-yank

License

MIT @b4b4r07

zsh-vimode-visual's People

Contributors

b4b4r07 avatar babarot avatar nyquase avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

zsh-vimode-visual's Issues

How to install with Oh My Zsh

I have tried the manual step but that didn't work for me. I am using oh-my-zsh and cloned it under ~/.oh-my-zsh/custom/plugins/zsh-vimode-visual

Here is my .zshrc configuration

plugins=(
    vi-mode
    zsh-vimode-visual
)

I have also tried to use source command on terminal but it still didn't work.

can't bind keys in vivis mode

Hi Masaki, thanks so much for creating this, it's awesome.
I promise and assure you that I read all the relevant docs and manuals before opening this issue.
I tried just binding o to what l does, with:
bindkey -M vivis 'o' vi-visual-forward-char
and it didn't work, I tried unbinding it first

bindkey -M vivis -r 'o'
bindkey -M vivis 'o' vi-visual-forward-char

and it still doesn't work, how do I know that it's not binded? I ran:
bindkey -M vivis and found in the output that o is still in it's default binding ("o" vi-visual-exchange-points).

How to copy the selection into system clipboard?

Is there a way to yank the text into the system clipboard?

I saw the system clipboard setting in

set-x-clipboard() {
    if which pbcopy >/dev/null 2>&1; then
        clipcopy='pbcopy'
    elif which xsel >/dev/null 2>&1; then
        clipcopy='xsel --clipboard --input'
    else
        return 1
    fi

    (( ! $+DISPLAY )) ||
        print -rn -- "$1" | eval "$clipcopy"
}

But I have no idea about how to enable it.

But zsh already has a visual mode...

You reference http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html in your documentation. If you go there and search for the word "visual", you'll find that zsh already has a visual mode. In addition to viins and vicmd, visual and viopp keymaps were added three years ago. Are you perhaps stuck using an ancient release of zsh? Or has oh-my-zsh tricked you because it stupidly rebinds v to edit-command-line? Zsh also comes with functions for implementing the surround plugin which you seem to have duplicated.

Or have I somehow misunderstood what this plugin is going?

Installing plugin on Alacritty terminal emulator

Hey guys, I'm having a hard time here to get zsh-vimode-visual to work with my new alacritty terminal. I think I'm missing something. Is there any prerequisite before install through zplug?

Thanks for the help!

Highlight visually

I installed the plugin in my oh-my-zsh configuration.

I notice I can select things in visual mode, but there is no visual indication of the selected text being highlighted. It's as if I am in insert mode and the cursor walks around when I press the navigation keys.

Another plugin that I used that offered a visual mode did offer such visual highlighting.

Now, I don't know if this is a problem with my configuration or intended behavior. What is it?

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.