Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ok97465/spyder_okvim

A plugin for Spyder to enable Vim keybindings
https://github.com/ok97465/spyder_okvim

easymotion plugin python spyder spyder-plugin vim

Last synced: 12 days ago
JSON representation

A plugin for Spyder to enable Vim keybindings

Awesome Lists containing this project

README

        

# Spyder Okvim

![Linux tests](https://github.com/ok97465/spyder_okvim/workflows/Linux%20tests/badge.svg)
![Macos tests](https://github.com/ok97465/spyder_okvim/workflows/Macos%20tests/badge.svg)
![Window tests](https://github.com/ok97465/spyder_okvim/workflows/Windows%20tests/badge.svg)
[![codecov](https://codecov.io/gh/ok97465/spyder_okvim/branch/main/graph/badge.svg?token=7JIIKTOZMO)](https://codecov.io/gh/ok97465/spyder_okvim)

Spyder Plugin for executing Vim commands inside the code editor.
This repository is reusing some codes of [spyder-ide/spyder-vim](https://github.com/spyder-ide/spyder-vim)

```text
Don't make an issue to spyder github after install okvim.
```

If you have a problem after installing this, please retry after uninstalling okvim.

## Known Issues

- Okvim is not working when the spyder editor is undocked from mainwindow.

## Overview

This plugin supports movements.

- hjkl, ^u, %, iw, i(, /, n, N, ;, ...

This plugin supports a combination of operators and motions

- diw, di(, c%, c/foo, cn, ygg, d2w, 2d2W ...

This plugin supports spyder command.

- run selection, formatting, toggle break, toggle comment, ...

This plugin support macro(experimental).

| Movements | Combination | Spyder command |
|------|-------------|----------------|
|![movement gif](/doc/ex_movement.gif) | ![combination gif](/doc/ex_combination.gif)| ![spyder cmd gif](/doc/ex_spyder_cmd.gif) |

## Installation

To install this plugin, you can install the package locally using pip as it follows.

```text
pip install -U .
```

If spyder-vim is installed, you need to uninstall it.

## Modes

The following modes are supported:

- Normal
- Visual
- Visual Line

## Actions

The following actions are supported:

- x, s, r
- C, D, S
- dd, cc, yy
- <<, >>
- p, P
- d{motion}, c{motion}
- <{motion}, >{motion}
- gu{motion}, gU{motion} g~{motion}, ~
- u, ^R
- J
- .

## Motions

The following motions are supported:

- hjkl
- 0, ^, $
- w, W, b, e
- iwW, i()[]{}bB, i'"
- G, g
- ^D, ^U, ^F, ^B
- HLM
- %
- f, F, t, T, ;, ,
- /, N, n
- Enter, Space, Backspace
- easymotion

## Vim keys

- ^A : Add [count] to number
- ^X : Subtract [count] to number
- K : Inspect current object
- gd : Go to definition.
- gt, gT : Cycle to next/previous file.
- zz, zt, tb : Cursor line to some locations of screen.
- ZZ : Save and close current file.
- q, @: macro

## Special keys

- \f : autoformatting
- \b : Toggle break point
- \r : run selected text or current line in console.
- \enter : run cell and advance
- \p : spyder switcher
- \s : spyder symbol switcher
- [d : goto previous warning/error
- ]d : goto next warning/error
- gc{motion} : toggle comment (support visual mode)
- gcc : toggle comment of current line

## Vim Surround

- surroundings : '"()[]{}bB

The following action are supported:

- ys{motion}{surroundings} in normal mode: add surroundings in pairs.
- ds{surroundings} in normal mode: delete surroundings in pairs.
- cs{surroundings}{surroundings} in normal mode: change surroundings in pairs.
- S{surroundings} in visual mode: add surroundings in pairs.

## Fuzzy path finder

The shortcut to invoke the fuzzy path finder is Ctrl+p.
You can use ^p, ^n, ^f, ^b, ^u, ^d to navigate the path list.

![fuzzy path finder](/doc/path_finder.gif)

## Config page

![config page](/doc/config_page.png)

## Easymotion

![easymotion](/doc/easymotion.gif)

You can use EasyMotion commands as an argument for d, c, or any other command that takes motion as an argument.

| Motion Command | Description |
| ----------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| ` w` | Start of word forwards |
| ` b` | Start of word backwards |
| ` j` | Start of line forwards |
| ` k` | Start of line backwards |
| ` f ` | Find character forwards |
| ` F ` | Find character backwards |

## Search 2ch(like vim-sneak)

Jump to any location specified by two characters.

It works with multiple lines, operators (including repeat .) motion-repeat (; and ,), visual mode.

This search is invoked with s by exactly two characters.
This search is invoked with operators via z (because s is taken by vim surround)

After searching for two characters, if there are the characters in another group, a comment is displayed around the group.
![sneak](/doc/sneak.gif)