Giter Site home page Giter Site logo

template.nvim's Introduction

Hi πŸ‘‹ I'm Alper

Curious Frontend Developer

  • 🌍  I'm based in Istanbul, Turkey currently
  • βœ‰οΈΒ  You can contact me at [email protected]
  • 🧠  I'm learning Go and Typescript πŸ₯½
  • ⚑  I might bore you with my questions!

Skills

Javascript HTML5 React Vue Nuxtjs Sass TailwindCSS CSS3 NodeJS MongoDB

Socials

Badges

My GitHub Stats

Top Languages

template.nvim's People

Contributors

doganalper avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

template.nvim's Issues

An option to switch templates

  • User may switch templates if current filetype has multiple templates.
  • Switching template will cause to delete content of current buffer.
  • Possible telescope extension here would be good.

When I created the file and wrote the file template, an error occurred

Thank you for your work. This plugin is what I need, but I encountered the following error while using it:

msg_show.lua_error Error executing vim.schedule lua callback: ...share/nvim/lazy/template.nvim/lua/template/internals.lua:76: attempt to yield across C-call boundary
stack traceback:
[C]: in function 'yield'
...share/nvim/lazy/template.nvim/lua/template/internals.lua:76: in function 'cb'
...ocal/share/nvim/lazy/dressing.nvim/lua/dressing/util.lua:206: in function <...ocal/share/nvim/lazy/dressing.nvim/lua/dressing/util.lua:202>

Do I need to install other supporting plugins for this?

only the Vue filetype are triggered

Thank you so much for your help!
After fixing it, I found that when there are multiple file types, only the Vue files are triggered. Is it because my config file is not configured properly, or is there something else?

return {
  { "stevearc/dressing.nvim", event = "VeryLazy" },

  {
    "doganalper/template.nvim",
    event = "VeryLazy",
    config = function()
      require("template").setup({
        -- custom config
        mappings = {
          switch_template = "<leader>cg",
        },
        templates = {
          vue = {
            {
              name = "Vue 2 JS",
              template = {
                "<template>",
                "<div>",
                "</div>",
                "<template>",
                "",
                "<script>",
                "export default {}",
                "</script>",
              },
            },
            {
              name = "Vue 2 Ts",
              template = {
                "<template>",
                "<div>",
                "</div>",
                "</template>",
                "",
                '<script lang="ts">',
                "import Vue from 'vue';",
                "export default Vue.extend({})",
                "</script>",
              },
            },
            {
              name = "Vue 3",
              template = {
                '<script lang="ts" setup></script>',
                "",
                "<template></template>",
              },
            },
          },
          markdown = {
            {
              name = "bast template",
              template = {
                "---",
                "title:",
                "categories: [ ]",
                "tags: [ ]",
                "date:",
                "---",
              },
            },
            {
              name = "bas1 template",
              template = {
                "---",
                "title:",
                "categories: [ ]",
                "tags: [ ]",
                "date:",
                "---",
              },
            },
          },
          Java = {
          {
              name = "Java template",
              template = {
                "// java template",
              },
            }
          }
        },
      })
    end,
  },
}

Option for extending templates

  • Currently whenever user passes templates on options for plugin, it will replace any existing templates for that filetype.
  • Instead of replacing all, this feature will add given templates to existing templates on default opts.
  • If any names collides, user given template will be prioritized.

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.