Git Product home page Git Product logo

Comments (7)

Gelio avatar Gelio commented on May 29, 2024 1

Im unsure how the timestamp is served by cmp-natdat, but if it follows ISO 8601, i should just as easily be able to format a time into the YYYY-ww format, right?

Yeah, you could change it so that any date will turn to YYYY-{W}ww, so e.g. typing @today will give you the 2024-W12, but so would @yesterday, since they are both in the same week. I am not sure that it is too useful as an nvim-cmp source. If I were you and I needed a way to type the current YYYY-{W}ww quickly, I would probably add some snippet (e.g. using https://github.com/L3MON4D3/LuaSnip). I already have snippets for some date formats, e.g.:

image

Besides, if you wanted to have cmp-natdat print out dates in the YYYY-{W}ww format, it would be doing that all the time, until you call .setup again with a different formatter. If you wanted to hot-swap the formatter between ISO dates (YYYY-MM-DD) and ISO weeks (YYYY-{W}ww), you would have to re-register the source, which I am not sure is convenient.

All in all, I am not sure implementing this feature (#1) will solve your problems, but I don't mind you trying anyway 😄

Can you give me an example for the markdown solution? Thanks

I'm not following what you are asking for here 😅

from cmp-natdat.

chuan2984 avatar chuan2984 commented on May 29, 2024 1

Hey, thanks again for being so helpful. Your lua-snip suggestion makes a lot more sense. I didn't think about the snippet engine. And you are absolutely right about the formatter that once its set, you need to reload it. Dont worry about the followup, you answered it with luasnip. Thank you very much sir!

from cmp-natdat.

chuan2984 avatar chuan2984 commented on May 29, 2024

Hello @Gelio, is this still being worked on? I really need a way to auto-complete dates in a specific format for me since im using neovim with obsidian. I may be able to contribute since this seems entry level enough for me to learn when i get a chance

from cmp-natdat.

Gelio avatar Gelio commented on May 29, 2024

Hey hey, thanks for reaching out! I didn't plan on working on it since the existing features cover my use-cases (including Obsidian, which I am also using).

Feel free to create a PR if you manage to get it working. I can also fill in some bits that you are unsure about. Don't hesitate to ask questions.

By the way, what date format are you looking for when working with Obsidian? I'm asking since I'm curious and maybe I am missing some cool plugin 😄

from cmp-natdat.

chuan2984 avatar chuan2984 commented on May 29, 2024

Sure, once i put some time together this week or the next, ill see if i can put in the forrmatter. Thanks for being so responsive! Im not using any cool plugin. If anything im trying to keep it as the bare minimum since Im trying to use nvim to write those daily notes, already modified it to hide all the dataview stuff. Im just using YYYY-MM-DD-dddd as the daily title since i want to see what day of the week, guess i could also just alias my daily notes too. I also need the weekly dates like 2024-03-W10

from cmp-natdat.

Gelio avatar Gelio commented on May 29, 2024

I see. What are you looking to get from custom formatters in cmp-natdat?

I guess you could configure the day formatter to also output the dddd part, but I am not sure how you would get 2024-03-W10 from one of the existing completions.

I am asking to understand the problem you are having and to also understand whether adding custom formatters will help you solve it.

If you could add an example Markdown file and places where you expect these completions (whether they are inside [[ links, or inside headings), that would make it easier.

I wouldn't want to you spend time contributing a feature that ends up not solving your problem 🙂

from cmp-natdat.

chuan2984 avatar chuan2984 commented on May 29, 2024

Yes, the dddd part for sure. Im unsure how the timestamp is served by cmp-natdat, but if it follows ISO 8601, i should just as easily be able to format a time into the YYYY-ww format, right? This format is not going to be super helpful to me anyway, was just trying to get my feet wet into lua plugins for neovim, and this seems like a good opportunity thats not very overwhelming.

Can you give me an example for the markdown solution? Thanks

from cmp-natdat.

Related Issues (4)

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.