Shobhit-Nagpal / nvim-rafce

Neovim plugin to create RAFCE snippets.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nvim-Rafce

Write boilerplate React components with one command

Lua Neovim

Nvim-Rafce Logo

TOC

Problem

  1. You left behind VSCode and installed Neovim and are new to learning Vim motions, remaps, plugins, etc. You saw either yourself or other people using the RAFCE snippet to create boilerplate React component code. You want to save time by having something similar for Neovim.

Solution

  1. The ability to write a command in Neovim and have boilerplate component code on the fly.

Installation

Installation can be done in 2 ways:

1. Manually

Run the following commands to add nvim-rafce manually

  1. Clone repository
git clone git@github.com:Shobhit-Nagpal/nvim-rafce.git
  1. Navigate to your neovim config directory

  2. In your init.lua or if you have a after/plugin directory, create a file called rafce.lua and add the following lines:

vim.opt.runtimepath:append('/path/to/nvim-rafce')
local rafce = require('rafce')
  1. Source the file
:so

2. Plugin manager

--Packer:

use 'Shobhit-Nagpal/nvim-rafce'

--Vim-plug:

Plug 'Shobhit-Nagpal/nvim-rafce'

Commands

There are 3 different commands to use depending on your needs:

i. Rafce (React functional component with arrow function and export at bottom)

:Rafce
import React from "react";

const Component = () => {
  return <div>Component</div>;
};

export default Component;

ii. Rfce (React functional component with export at bottom)

:Rfce
import React from "react";

function Component() {
  return <div>Component</div>;
}

export default Component;

iii. Rfc (React functional component)

:Rfc
import React from "react";

export default function Component() {
  return <div>Component</div>;
}

Socials

About

Neovim plugin to create RAFCE snippets.


Languages

Language:Lua 100.0%