• Stars
    star
    148
  • Rank 244,679 (Top 5 %)
  • Language
    Lua
  • License
    Do What The F*ck ...
  • Created over 2 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Plugin that adds a 'cut' operation separate from 'delete'

✂️ cutlass.nvim

Lua GitHub Workflow Status

Cutlass overrides the delete operations to actually just delete and not affect the current yank.

✨ Features

It overrides the following keys to always use the black hole register: c, C, s, S, d, D, x, X.

Note that if you have already mapped these keys to something else (like we do below with x) then it will not change it again.

🤔 Why would you want to do this?

See here. This plugin already exists in vimscript. I hope this version in lua will be more efficient :)

⚡️ Requirements

  • Neovim >= 0.7.0

(For Neovim 0.5 compatibility, you can use the compat-0.5 branch)

📦 Installation

Install the plugin with your preferred package manager:

lazy

-- Lua
{
  "gbprod/cutlass.nvim",
  opts = {
      -- your configuration comes here
      -- or don't set opts to use the default settings
      -- refer to the configuration section below
    }
}

packer

-- Lua
use({
  "gbprod/cutlass.nvim",
  config = function()
    require("cutlass").setup({
      -- your configuration comes here
      -- or leave it empty to use the default settings
      -- refer to the configuration section below
    })
  end
})

vim-plug

" Vim Script
Plug 'gbprod/cutlass.nvim'
lua << EOF
  require("cutlass").setup({
    " your configuration comes here
    " or leave it empty to use the default settings
    " refer to the configuration section below
  })
EOF

⚙️ Configuration

Cutlass comes with the following defaults:

{
  cut_key = nil,
  override_del = nil,
  exclude = {},
  registers = {
    select = "_",
    delete = "_",
    change = "_",
  },
}

cut_key

Default : nil

After setting up this plugin, all of these operations will simply delete and not cut. However, you will still want to have a key for 'cut', which you can add by setting the cut_key value when setting up the plugin. (m or x are recommended)

This will create those bindings :

nnoremap m d
xnoremap m d
nnoremap mm dd
nnoremap M D

override_del

Default : nil

By default, this plugin doesn't remap the <Del> key to use the blackhole register (and it will work as the old x key). By setting override_del to true, <Del> key will not cut any more and not affect your current yank.

exclude

Default: {}

For some reason, you may doesn't want cutlass to override some keys, you can exclude mappings to be set by adding this to the exclude option using format "{mode}{key}".

Eg. If you want to exclude s key in normal mode, sets exclude option to { "ns" } ; If you want to exclude <bs> key in select mode, sets exclude option to { "s<bs>" }.

registers

Default:

{
  select = "_",
  delete = "_",
  change = "_",
}

Installing cutlass.nvim will use blackhole register for delete, change and select actions. But maybe you want to redirect to a specific register, this option allows you to choose the register to use for each action.

E.g. using configuration above will use s register for select, d for delete and c for change:

{
  registers = {
    select = "s",
    delete = "d",
    change = "c",
  },
}

🤝 Integration

svermeulen/vim-yoink

If you have svermeulen/vim-yoink installed, it will work seemlessly as original svermeulen/vim-cutlass. Just follow the integration instructions.

ggandor/lightspeed.nvim and ggandor/leap.nvim

When you're using plugins like ggandor/lightspeed.nvim or ggandor/leap.nvim, you should not want cutlass to remap the s key. You can do this using the exclude option:

use({
  "gbprod/cutlass.nvim",
  config = function()
    require("cutlass").setup({
        exclude = { "ns", "nS" },
    })
  end
})

🎉 Credits

This plugin is a lua version of svermeulen/vim-cutlass (based off of vim-easyclip and also Drew Neil's ideas)

Credit to m00qek lua plugin template

More Repositories

1

yanky.nvim

Improved Yank and Put functionalities for Neovim
Lua
603
star
2

substitute.nvim

Neovim plugin introducing a new operators motions to quickly replace and exchange text.
Lua
387
star
3

nord.nvim

An arctic, north-bluish clean and elegant Neovim theme.
Lua
109
star
4

stay-in-place.nvim

Neovim plugin that prevent cursor from moving when using shift and filter actions.
Lua
75
star
5

tree-sitter-gitcommit

A tree-sitter grammar for gitcommit messages
C
45
star
6

phpactor.nvim

Lua version of the Phpactor vim plugin to take advantage of the latest Neovim features
Lua
41
star
7

tree-sitter-twig

Twig grammar for Tree-sitter
C
31
star
8

uuid-normalizer

Normalizer to serialize Ramsey Uuid with Symfony Serializer
PHP
31
star
9

conf-makefile

PHP
11
star
10

gbvim

my neovim setup
Lua
9
star
11

sass-trigonometry

Sass trigonometry and inverse trigonometry functions
SCSS
7
star
12

open-related.nvim

A Neovim plugin to quickly open related files
Lua
7
star
13

doctrine-specification-bundle

This bundle provides integration with doctrine-specification with Symfony
PHP
6
star
14

doctrine-specification

This library allow you to write Doctrine ORM queries using the Specification pattern
PHP
6
star
15

specification

Yet another specification pattern implementation in PHP
PHP
5
star
16

php-enhanced-treesitter.nvim

Improve default php treesitter grammar using grammar injections
Scheme
4
star
17

elastica-bundle

Really simple bundle to use Elastica within Symfony applications
PHP
4
star
18

icantdecide

JavaScript
4
star
19

domain-event

Library to manage domain events in a DDD application
PHP
2
star
20

stars

2
star
21

vimium-nord-theme

Nord theme for vimium
CSS
2
star
22

domain-event-bundle

Integrates domain event library to a Symfony app
PHP
1
star
23

montmartre

PHP
1
star
24

elastica-provider-bundle

Bundle that can easely provide data in ElasticSearch using Elastica
PHP
1
star
25

elasticsearch-dataprovider-bundle

[deprecated] Bundle that allow easy data providing elasticsearch indices in Symfony
PHP
1
star
26

elastica-specification

This library allows to write Elastica queries using the Specification pattern
PHP
1
star
27

cours

1
star
28

gbprod.github.io

http://gb-prod.fr
HTML
1
star
29

algolia-specification

This library allows to write Algolia queries using the Specification pattern
PHP
1
star
30

elasticsearch-extra-bundle

[deprecated] Extra tools for m6web/elasticsearch-bundle
PHP
1
star
31

elastica-specification-bundle

This bundle integrates elastica-specification with Symfony
PHP
1
star
32

webhook-commander

Allows to trigger commands on github webhook calls
PHP
1
star
33

elastica-extra-bundle

Extra tools for index management with Elastica client
PHP
1
star
34

none-ls-luacheck.nvim

Luacheck diagnostics plugin for none-ls.nvim
Lua
1
star
35

none-ls-psalm.nvim

Psalm diagnostics plugin for none-ls.nvim
Lua
1
star