GithubHelp home page GithubHelp logo

Comments (8)

kvalv avatar kvalv commented on July 29, 2024 1

Hey, yes you are right about that. I added this to the config:

 mappings = {
    org = {
      org_increase_date = '+',
      org_decrease_date = '+'
    }

and after removing that mapping it works as expected. Really nice, thank you very much! I guess this can be closed then.

from orgmode.

kvalv avatar kvalv commented on July 29, 2024

If you think it's worth fixing, I could actually try to fix it myself. I don't have much experience with lua, but this doesn't seem to be too hard to fix.

from orgmode.

kristijanhusak avatar kristijanhusak commented on July 29, 2024

Idea is to have / increment/decrement date by one day when used within date context. Anything outside of it fallback to the default behavior.

As you said, Vim automatically finds first number and increases it. I don't think there's a way to prevent it from doing that.

Workaround is to bind date increment/decrement to another mapping, for example +/-:

require('orgmode').setup({
  mappings = {
    org = {
      org_increase_date = '+',
      org_decrease_date = '+'
    }
  }
})

That way / will work by default everywhere.

from orgmode.

kvalv avatar kvalv commented on July 29, 2024

Workaround is to bind date increment/decrement to another mapping, for example +/-:

I tried what you suggested, but it seemed to give the same behaviour as <C-a> / <C-x>, probably because the fallback is sent to nvim here: https://github.com/kristijanhusak/orgmode.nvim/blob/master/lua/orgmode/org/mappings.lua#L118

So I guess what I'm asking for is that <C-a> will first move to the date context (similar to how <C-a> is moving to the closest number) and then increase the date by one. Alternatively, it does not do anything if it's not on a date context. I think the current behaviour is not so intuitive, even though it makes sense by how vim's <C-a> and org-mode's <C-a> work

from orgmode.

kristijanhusak avatar kristijanhusak commented on July 29, 2024

Oh, right, I need to fix that fallback to fallback to the defined mapping.

We could handle it by jumping to next number manually and then re-checking if it's date or not. Thanks for suggestion, I'll try to fix it.

from orgmode.

kristijanhusak avatar kristijanhusak commented on July 29, 2024

@kvalv I pushed a fix for this.

  1. Different mappings are now properly falling back to the ones defined
  2. / Behaves as you suggested. It should properly jump to the date and increase it by a day.

Let me know if it works as expected.

from orgmode.

kvalv avatar kvalv commented on July 29, 2024

Hey, nice to hear you worked on this!

  1. OK, so the way I understood it, if the cursor is on the beginning of the line and I hit <C-a> it should move to the next date object and increase it by 1 day. On the video, if I hit do that, nothing happens. (which is still much better than increasing the year)

  2. Perhaps an unexpected side-effect of the change is that if I now type <C-a> without next dates, it moves to the nearest number (in this case 2), which I think also is not intended.

simplescreenrecorder-.39.mp4

from orgmode.

kristijanhusak avatar kristijanhusak commented on July 29, 2024

Do you have default mappings set for this? It's not behaving same for you like it is for me. Here's gif how it works for me:

date-increase

from orgmode.

Related Issues (20)

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.