Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

pianocomposer321
pianocomposer321

Posted on • Edited on

     

project-templates.nvim

A Neovim Project Management Pluginhttps://github.com/pianocomposer321/project-templates.nvim

project-templates.nvim

I made this plugin mainly out of pure frustration. I had been using the extensionProject Templates back when I used VSCode as my IDE, and I had come to rely on it. When I migrated to Neovim, I thought "this extension was sooo helpfull! Clearly theremust be an equivialent for vim, right?" I went searching and searching, but I couldn't findanything. There were plugins that created templates for individual files, and even multiple related files, liketemplator_vim, but nothing that creates templates for an entire project, that defines the project structure and boilerplate code for each necessary file. In most IDEs, the IDE will take care of these things for you automatically when you start a new project. But with vim, you have to create each individual file and folder yourself. This plugin aims to fix that.

Demo

demo.gif

Quick Start

Requirements

You will need neovim compiled with python3 support. To determine whether or not your neovim has python support, type:echo has('python3') and press enter. If it outputs1, you have python3 support, otherwise you will need to run the commandpip install pynvim.

You will also need to run the commandpip install binaryornot.

Installation

Add this to your init.vim:

  • vim-plug:

    • Plug 'pianocomposer321/project-templates.nvim', { 'do': ':UpdateRemotePlugins' }
  • Vundle:

    • Plugin 'pianocomposer321/project-templates.nvim', { 'do': ':UpdateRemotePlugins'}

etc, etc.

Then run:PlugInstall (vim-plug) or:PluginInstall (Vundle).

Finally, restart Neovim.

Usage

  • :LoadTemplate - Load a template into a new project. The plugin will look for placeholders (e.g.#{PLACEHOLDER}), and ask for values to replace them in each non-binary file
  • :DeleteTemplate - Delete a template
  • :SaveAsTemplate - Save the current folder and all files and subfolders as a new template

The plugin will look for templates in ~/.templates. Sample templates can be found athttps://github.com/pianocomposer321/project-template-samples. If you want to create your own templates, simply create a new project, add the placeholders you want, and save it in ~/.templates, or use the:SaveAsTemplate command.

Credits

Finder.vim -https://vim.fandom.com/wiki/Implement_your_own_interactive_finder_without_plugins

Inspired byThis Sublime text plugin andthis VS Code Extension.

Top comments(4)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
muhimen123 profile image
Muhimen
Nothing more than a programmer nothing less than a programmer. Loves to solve Rubik's cubes in spare time.
  • Location
    Bangladesh
  • Work
    Student
  • Joined

I am a nvim user too. Talking about templates, I have written a simple Python script with some file operations that can generate templates for me.
The extension looks good too. I'l check it out. Thanks.

CollapseExpand
 
pianocomposer321 profile image
pianocomposer321
  • Joined

Thanks for the feedback!

Have you posted your script on GitHub? I'd love to take a look!

CollapseExpand
 
muhimen123 profile image
Muhimen
Nothing more than a programmer nothing less than a programmer. Loves to solve Rubik's cubes in spare time.
  • Location
    Bangladesh
  • Work
    Student
  • Joined

Sorry, it's for personal use only. 😋

CollapseExpand
 
pianocomposer321 profile image
pianocomposer321
  • Joined

Have you tried the extension yet? What did you think? Do you have any suggestions as to how it could be improved?

Thanks in advance,
pianocomposer321

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

  • Joined

More frompianocomposer321

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp