Giter Club home page Giter Club logo

Comments (3)

AndrewRadev avatar AndrewRadev commented on July 3, 2024

because P can be remapped (for example in netrw buffers).

The problem is there's no way to keep the original mapping and stack them together. It would be possible to just not make the mapping if there already is one, but then the plugin wouldn't be able to work in combination with vim-pasta, for instance. Or at least that's what I remember, the situation with overrides is pretty confusing.

This is why I figured it's better to just allow the user to change the mapping. If you want, you can set separate mappings like so:

let g:whitespaste_before_mapping = ',P'
let g:whitespaste_after_mapping  = ',p'

Besides, how about only initializing the p and P mappings of Whitespaste and Pasta.vim for modifiable buffers?

That I can do, or at least I can do it for whitespaste, not sure if vim-pasta takes care of that. I've just pushed a commit that only sets the mappings for modifiable buffers. Could you try it out and let me know if it works for you? If vim-pasta still installs its mappings, you could add the netrw filetype to the list of filetypes to exclude, g:pasta_disabled_filetypes (check out the vim-pasta docs for details).

I should probably look into creating a list of disabled filetypes for whitespaste as well, but I'm not sure how useful it would be. For now, modifiability should be enough.

from whitespaste.vim.

Konfekt avatar Konfekt commented on July 3, 2024

Hello Andrew,

Now, after disabling it for nonmodifiable buffers and adding netrw to g:pasta_disabled_filetypes it works.

I looked into the pasta code, and it does not disable its mapping by default for nonmodifiable buffers. The g:pasta_disabled_filetypes is rather a hack, as you end up changing it for every nonmodifiable filetype.

Perhaps you should consider integrating whitespaste more tightly with pasta, and only then override the mapping if it came from pasta. Not sure if this is easy to check though.

from whitespaste.vim.

AndrewRadev avatar AndrewRadev commented on July 3, 2024

The g:pasta_disabled_filetypes is rather a hack, as you end up changing it for every nonmodifiable filetype.

Actually, I don't think it was ever meant for that purpose. The reason vim-pasta supports g:pasta_disabled_filetypes is because the plugin doesn't work well for indent-based languages like python or coffeescript, so there has to be some way to disable it for those. You could open an issue on vim-pasta's bugtracker as well for the non-modifiable stuff.

Perhaps you should consider integrating whitespaste more tightly with pasta, and only then override the mapping if it came from pasta. Not sure if this is easy to check though.

I'm not sure what you mean. Whitespaste should be capable of working without vim-pasta, so there isn't much sense to only make a mapping if vim-pasta is around.

In any case, I'm going to close the issue for now, since this is probably the best I can do with the override problem.

from whitespaste.vim.

Related Issues (3)

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.