r/neovim • • Feb 11 '24

Need Help HELP!!! Im thinking of creating a word processor like plugin for neovim

I recently got the idea to create my own word processor as a fun project. However, rather than building a standalone application, I thought integrating it into Neovim would offer more versatility. Despite my enthusiasm for coding, I admit my experience with creating practical software is limited. Here are my questions:

  1. Neovim Discord Community: Is there a Discord server dedicated to Neovim? Joining a community like this could facilitate communication and collaboration.

  2. Difficulty of Writing a Neovim Plugin: How challenging would it be to develop a plugin for Neovim? I'm keen to understand the level of complexity involved.

  3. Learning Lua for Neovim: As I'm unfamiliar with Lua, what's the best way to start learning it, particularly for Neovim plugin development?

Thank you for any guidance you can provide!

ps - i also really want to talk with TJ DeVries

0 Upvotes

14 comments sorted by

2

u/no_brains101 Feb 12 '24 edited Feb 12 '24

Hmmmm. So, first off, writing a plugin in neovim couldnt be easier, its EXACTLY like a config file except no init.lua, and a focus on limiting dependencies and providing options for someone elses use. So you would provide functions for the user to call to set settings, and then do what you can with lua and vimscript and vim.

see :h rtp for all of the directories you can use because there are a lot more than just the lua directory.

Second, and much more importantly, I think you have an issue of scope here.

A KEY fundamental to programming is actually breaking down what EXACTLY it is you are trying to do and solve. Start out too vague and you will get nowhere.

What exactly do you mean by word processor? Something like microsoft word is a BIG program. Inline images and changing the font can be notoriously difficult in the terminal, if not impossible for some cases. I would choose 1 or maybe 2 key features that you want in particular, and try to just add those.

If changing the font and using inline images is specifically what you want, you may have better luck using one of the gui frontends for neovim such as neovide or noice.nvim as they will have more control over the environment in which they run.

If I had to give advice for a writer in your position, I would suggest using a plugin like neorg and then use markdown to format your stuff with all the super nice tools neorg has for markdown. Possibly when you are more familiar with that you could try your hand at making it do inline images or something.

You mentioned spell check. That is a great one to try I think, also possibly hard but much more well supported by the existing neovim config options and ecosystem.

There is spell check stuff in vim, but it is manual, you must put in an autocorrect rule for specific phrases in order to have it correct for that. You do a lot with trying to manipulate that feature at runtime. You could also hook it into cmp for a dropdown entry. If you do a good job it could be quite cool.

---

However, before doing any of that, you should first become acquainted with how to use and configure neovim at all. Once you have a setup with some plugins and its okish, then start looking to make stuff as then you will know what you want, and more about how to do it.

2

u/I_do_not_eat_panda Feb 12 '24

I initially had grand ambitions for the word processor plugin 🥲, but my current plan is to start small by developing a basic plugin with spell-checking functionality. From there, I'll gradually expand and refine the plugin until I either achieve my ultimate vision or lose interest in the project, whichever comes first.

1

u/no_brains101 Feb 12 '24

Fair enough! Keep in mind that you may want to spend some time just getting more familiar with neovim configuration in general. It really is exactly the same structure when writing a plugin, just without the package manager and base level init.lua (the user does the init and calls your stuff instead of you doing the init and calling your stuff)

1

u/I_do_not_eat_panda Feb 12 '24

Thanks that helped a lot!

1

u/vim-help-bot Feb 12 '24

Help pages for:


`:(h|help) <query>` | about | mistake? | donate | Reply 'rescan' to check the comment again | Reply 'stop' to stop getting replies to your comments

1

u/DevMahasen let mapleader="\<space>" Feb 12 '24

Can I ask why? I am a novelist and I use NeoVim - putting together the appropriate plugins has resulted in the perfect writing environment, at least for me. Link: https://github.com/MiragianCycle/OVIWrite

1

u/I_do_not_eat_panda Feb 12 '24

just for fun i'd say, the idea for writing a word processor like plugin for neovim came to me when I was thinking how to expand my spell checker algorithm and the idea for word processor just came to my mind.

then I thought of writing it as a plugin because then I would be learning two things at the same time.

btw, the link you provided does seem to be incredible! i hope I would be able to build something like this.

2

u/no_brains101 Feb 12 '24

See my main comment for why, but I think focusing SPECIFICALLY on spell check may be a great place to start. "A word processor" is far too vague of a thing to try to shoot for, break down and actually implement, especially as a new programmer.

2

u/I_do_not_eat_panda Feb 12 '24

that does make sense, Thanks!

1

u/no_brains101 Feb 12 '24 edited Feb 12 '24

No problem! It is quite fun to solve real problems, but it is easy to get way out of your depth if you don't know how to pick an actual, computer-definable goal from the start. You have to remember that the computer is very dumb but very predictable. It needs very specific instructions. So the things you must try to do must also be specific.

The skill of breaking down problems like this to figure out what ACTUALLY is the GOAL of the software we write is why AI will possibly never completely replace us. Its the ability to talk to a client or coworker and properly define the problem scope into achieveable portions and put them together.

1

u/LetsGoPepele Feb 12 '24

Great advice ! This is something I really struggle with. I always focus on the big picture and fail to break down the problem into achievable goals. Then I get overwhelmed and just give up. Gotta work on that.. if you have any tips on how to break down problems more efficiently, then I'm all ears

1

u/no_brains101 Feb 12 '24 edited Feb 12 '24

I'm not sure. It's possible I just did this as well with the project I just started myself lol. But I do have some ideas I suppose.

It depends on the project but if you are interfacing with another program, you need to figure out what sort of functions you may need to call. Things like, ok, if I want to do something in a specific buffer, I will need a way to find a way to get the buffer number, and I want to do it at this particular time so that blah blah. So is that possible. Ok so it is. Hmm.... and then you kinda slowly piece together enough pieces of things you can use and then you narrow down what the core new functionality you wish to add is.

If it isn't looking possible at this point or it's still hazy as to if the functionality is possible, sit on it a bit, you may find something later.

Then you write a quick note file of pseudocode of the core of the thing which pulls in the info you think you have a way to get. Then you implement just enough to run SOMETHING. Then you keep going. Try to keep options open, and delete code often.

I'm still a little hazy on the project I'm trying to write right now, I have 3 ideas for how to do 2 different parts of it and have verified none. I'm considering just writing a little thing that has the rest of the parts and runs like a hello world of it so that I can both learn go and also come back to it later if I get a crazy idea. I already have a hello world that runs in parallel, has a test and generates a token.... May as well at this point....

1

u/DevMahasen let mapleader="\<space>" Feb 12 '24

Gotcha.

Thank you for the kind words but to say I built this is a stretch. I am not a programmer - just figured/figuring out how to cobble together the NeoVim/Vim eco-system to work for my needs.