GithubHelp home page GithubHelp logo

nvim-toggler's People

Contributors

jgollenz avatar mosheavni avatar nguyenvukhang avatar wansmer 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

nvim-toggler's Issues

support the third string

Is it possible to support three string to switch each other, like vim -> emacs -> vscode -> vim

Inverse matching inconsistent

cword

Currently the plugin checks for the <cword> under the cursor. This will not work for e.g. == inside this line if (foo == bar) {. The detected cword when on the equality operator is bar. I have not yet completely understood the behavior. From :h word:

A word consists of a sequence of letters, digits and underscores, or a
sequence of other non-blank characters, separated with white space (spaces,
tabs, <EOL>).  This can be changed with the 'iskeyword' option.  An empty line
is also considered to be a word.

So I guess when there is an alphanum+underscore word after == it will detect that, otherwise it falls back to a sequence of non-blank characters and finds ==.

There is also <cWORD> which will detect ==, but also fails to detect true when e.g. wrapped like this: "true". That's because cWORD only takes non-blank character sequences (see :h WORD).

One idea would be to first match against cword and then against cWORD, but this will fail in a situation like the following: if (my_var == true). Here cword will match with true and replace the equality operator with the inverse, false (as can be seen in the video).

Another one would be to match each key in the lookup-table against cWORD and only toggle the matched part of the cWORD. But again, what about a situation where one has < and << in the lookup table? Would it toggle the first occurrence? All occurrences? Is it correct by accident?

Finally, it is possible to modify what counts as a word via the iskeyword option. However, this may have unwanted side-effects and should therefore probably only be done by the users themselves.

I have no solution for this yet, will investigate further.

PS: @nguyenvukhang I will continue posting issues that others might encounter here if you don't mind, for documentation purposes. Of course, only issues that happen with the base repo, not just in my fork 👍

Remapping does not work

There is currently no way to truly remap the default keybinding of <Leader>i. The option mentioned in the README will create an additional keybinding, but the default one will still persist.

Letter Cases (title/upper/lower)

I recommend support the letters case of the word

E.g. in Python you wish to switch between True and False, in javascript its true, and false, in some other cases its TRUE and FALSE.
One could added extra pairs for each situation, but I think the following would be better:

  • If all lower case, switch answer to all lower case
  • If all upper case, switch answer to all upper case
  • If the first letter is uppercase, and the remining letters lower case, switch answer such that the first letter is uppercase only.
  • One defines the pairs in lower case.
  • If a pair has some weird casing, e.g. stANge and weIRD, then not handle toggling casing

[bug]: toggling fails when inverses are side-by-side

If a user has inverses

!=    and  ==
true  and  false

then toggling on = in

SWITCH==true

will result in

SWITCHfalsetrue

This is currently because nvim-toggler recognizes all characters in an user's inverse table as a valid character for a vim word. So commands like cw acts differently based on the user's inverse table.

[Suggestion] new project name!

The project name should be self-explanatory, in my opinion. Because of this I propose to you a project name that I had come up with while watching the demonstration video found in the README of this project:

  1. nvim-antonym
  2. antonym.nvim

or something of that sort.

Error after the latest update

Hi, love the plugin! However, after the latest update, I start getting the following error:

/Users/nmadnani/work/nlpdemos/showcase                                                                                                                    
Error detected while processing /Users/nmadnani/.config/nvim/init.lua:                                                                                                        
E5113: Error while calling lua chunk: ...pack/packer/start/nvim-toggler/lua/nvim-toggler/init.lua:20: attempt to index local 'opts' (a nil value)                             
stack traceback:                                                                                                                                                              
        ...pack/packer/start/nvim-toggler/lua/nvim-toggler/init.lua:20: in function 'setup'                                                                                   
        /Users/nmadnani/.config/nvim/lua/user/toggler.lua:6: in main chunk                                                                                                    
        [C]: in function 'require'                                                                                                                                            
        /Users/nmadnani/.config/nvim/init.lua:39: in main chunk   

I tried reinstalling and installing the plugin but it's the same issue. I am using neovim 0.7.2 on macOS 12.5.1.

Here's what my nvim-toggler configuration looks like (I am using the default options):

local status_ok, toggler = pcall(require, "nvim-toggler")
if not status_ok then
	return
end

toggler.setup()

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.