Utility functions for NeoVim #2975
danielo515
started this conversation in
Show and tell
Replies: 2 comments 1 reply
-
Very neat, thanks for sharing! |
Beta Was this translation helpful? Give feedback.
0 replies
-
What is different between |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey guys! As a NeoVim and Chezmoi user, I've created a little Lua module that I'd like to share with you. This module contains some utility functions that allow you to execute Chezmoi from NeoVim, as well as re-add files that have been edited outside of the Chezmoi root from NeoVim.
Here's a brief overview of what each function does:
executeChezmoi
: This function allows you to execute Chezmoi from Vim. Simply call this function and pass in the Chezmoi command you'd like to execute, and it will run in the terminal.re_add
: This function allows you to re-add files that have been edited outside of the Chezmoi root. Simply call this function and pass in the path to the file you'd like to re-add, and it will be added back to Chezmoi.get_chezmoi_dir
: returns the root directory of chezmoi. Useful if you want to setup autocomands that only happen within the root directory chezmoi uses.It also has a little boolean flag to help you determine if chezmoi is available as an executable command or not. It requires
plenary
, but most of the plugins you are probably using already requie it.The way I use this is generally through some autocommands that execute the different functions when needed. Here you have one example:
Beta Was this translation helpful? Give feedback.
All reactions