GithubHelp home page GithubHelp logo

xxiaoa / ns-textobject.nvim Goto Github PK

View Code? Open in Web Editor NEW
39.0 39.0 3.0 39 KB

Awesome textobject plugin works with nvim-surround

License: GNU General Public License v3.0

Lua 100.00%
lua neovim neovim-plugin nvim nvim-plugin vim

ns-textobject.nvim's Introduction

ns-textobject.nvim's People

Contributors

kylechui avatar xxiaoa avatar yutkat 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

Watchers

 avatar

ns-textobject.nvim's Issues

Visual mode not working?

I'm thinking something is wrong with the behavior in visual mode.

When editing the following text

end, { desc = "around the quote" })
-- current cursor position is | `"|around`

Execute the following commands in normal mode. viq

The execution result will look like this

end, { desc = ""inside the quote" })

My settings are as follows.

vim.keymap.set({ "x", "o" }, "aq", function()
	nstextobject.create_textobj("q", "a")
end, { desc = "around the quote" })
vim.keymap.set({ "x", "o" }, "iq", function()
	nstextobject.create_textobj("q", "i")
end, { desc = "inside the quote" })

Breaking Changes: Following `main`

Breaking commits will be flagged with a !, e.g. refactor!: something etc. Therefore, if you notice one of those commit messages when updating, refer to this issue.

Code Duplication

Hi there, author of nvim-surround here. It's very cool to see a project like this pop up as a result of nvim-surround! I was browsing through the codebase, and had a few questions/suggestions:

  • Is it necessary to have a modified version of get_nearest_selections? If possible, I think it would make more sense to use that directly from nvim-surround and just process the outputs of it
  • I would think that allowing the user to create their own, fully custom mappings would make more sense than restricting them to a[char] and i[char]. See this issue for more details

Overall this seems like a promising start; I also think that pulling out this functionality into a separate plugin makes quite a bit of sense. I'm excited to see where this ends up! If you ever have any questions about the codebase or just writing this plugin in general, feel free to tag me.

Unable to get it working with nvim-surround

Hi,

The plugin looks really cool, great work! I would like to give it a try, but I haven't been able to get it working. Is this the right setup?

require('nvim-surround').setup()
require('ns-textobject').setup()

The plugin seems to load, but trying the example from the README ysiwl only adds an l around the word, as if I was only using nvim-surround. Is this keymap something I need to manually configure?

Thanks.

conflict with `which-key.nvim`

minimal configuration

local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
    vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
    vim.fn.system({
        "git",
        "clone",
        "--filter=blob:none",
        "--single-branch",
        "https://github.com/folke/lazy.nvim.git",
        lazypath,
    })
end
vim.opt.runtimepath:prepend(lazypath)

local plugins = {
    {"XXiaoA/ns-textobject.nvim", config=true},
    {"kylechui/nvim-surround", config=true},
    {"folke/which-key.nvim", config=true},
}
require("lazy").setup(plugins, {
    root = root .. "/plugins",
})

Broken

It seems broken now. Do more test after going back

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.