Coder Social home page Coder Social logo

Comments (13)

Hdoc1509 avatar Hdoc1509 commented on June 1, 2024 3

I´m using this in my init.vim, and it´s working fine for jsx and tsx.

let g:closetag_filenames = '*.html,*.xhtml,*.jsx,*.tsx'
let g:closetag_xhtml_filenames = '*.xhtml,*.jsx,*.tsx'
let g:closetag_filetypes = 'html,js'
let g:closetag_xhtml_filetype = 'xhtml,jsx,tsx'
let g:closetag_emptyTags_caseSensitive = 1
let g:closetag_regions = {
  \ 'typescript.tsx': 'jsxRegion,tsxRegion',
  \ 'javascript.jsx': 'jsxRegion',
  \ }
let g:closetag_shortcut = '>'

from vim-closetag.

wenanoshe avatar wenanoshe commented on June 1, 2024 2

For me only works in html files, doesn't work for js and jsx files

from vim-closetag.

northnSouth avatar northnSouth commented on June 1, 2024 2

In my init.lua this works

vim.cmd([[
let g:closetag_filenames = '*.html,*.xhtml,*.jsx,*.tsx'
let g:closetag_xhtml_filenames = '*.xhtml,*.jsx,*.tsx'
let g:closetag_filetypes = 'html,js'
let g:closetag_xhtml_filetype = 'xhtml,jsx,tsx'
let g:closetag_emptyTags_caseSensitive = 1
let g:closetag_regions = {
  \ 'typescript.tsx': 'jsxRegion,tsxRegion',
  \ 'javascript.jsx': 'jsxRegion',
  \ }
let g:closetag_shortcut = '>'
]])

from vim-closetag.

linrongbin16 avatar linrongbin16 commented on June 1, 2024 1

I also have this issue but with any filetype different than html. I'm currently trying to use this with eelixir and eruby, but it just does not work, don't know why. This is my whole init.lua right now:

local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    'git',
    'clone',
    '--filter=blob:none',
    'https://github.com/folke/lazy.nvim.git',
    '--branch=stable', -- latest stable release
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)

require('lazy').setup({
  {
    'alvan/vim-closetag',
    lazy = false,
    config = function()
      vim.cmd("let g:closetag_filetypes='html,eelixir,eruby'")
    end,
    },
})

If I manually change the filetype of any file to html, it starts working 😅

I have tried the same configs shown in this thread and it just does not work for any of those filetypes (js, jsx etc), nor it works for erb and eex when I add it to closetag_filetypes. I have also tried to add *.erb and *.eex to closetag_filenames but to no avail. This plugin just suddenly stopped working )):: Which is really sad, since it is a very good plugin!

Edit: I have also tried to run the command :CloseTagEnableBuffer inside a .eex file (eelixir filetype), but it still does not activate it.

In lazy, you need to specify these global variables in init, so this plugin will recognize them when loading.

from vim-closetag.

JakeElder avatar JakeElder commented on June 1, 2024 1

For me this seems to be the minimal config to get this working Neovim v0.8.3

vim.g.closetag_filetypes = 'html,js,typescriptreact'
vim.g.closetag_emptyTags_caseSensitive = 1
vim.g.closetag_regions = {
  ['typescript.tsx'] = 'jsxRegion,tsxRegion',
  ['javascript.jsx'] = 'jsxRegion',
}

from vim-closetag.

RedRx avatar RedRx commented on June 1, 2024

I'm using in my init.lua with nvim but some feature is not work. Please help me.

HTML = WORK
JSX = WORK
TSX = NOT WORK !! <<<<

-- set vim options here (vim.<first_key>.<second_key> = value)
options = {
opt = {
-- set to true or false etc.
relativenumber = true, -- sets vim.opt.relativenumber
number = true, -- sets vim.opt.number
spell = false, -- sets vim.opt.spell
signcolumn = "auto", -- sets vim.opt.signcolumn to auto
wrap = false, -- sets vim.opt.wrap
},
g = {
mapleader = " ", -- sets vim.g.mapleader
autoformat_enabled = true, -- enable or disable auto formatting at start (lsp.formatting.format_on_save must be enabled)
cmp_enabled = true, -- enable completion at start
autopairs_enabled = true, -- enable autopairs at start
diagnostics_enabled = true, -- enable diagnostics at start
status_diagnostics_enabled = true, -- enable diagnostics in statusline
icons_enabled = true, -- disable icons in the UI (disable if no nerd font is available, requires :PackerSync after changing)
ui_notifications_enabled = true, -- disable notifications when toggling UI elements
transparent_enabled = true, -- enable transparent background
closetag_filenames = ".html,.xhtml,.phtml",
closetag_xhtml_filenames = "
.xhtml,*.{t,j}sx",
closetag_filetypes = "html,xhtml,phtml",
closetag_xhtml_filetypes = "xhtml,{t,j}sx",
closetag_shortcut = ">",
closetag_close_shortcut = ">",
closetag_enable_react_fragment = 1,
},
},

from vim-closetag.

bkerz avatar bkerz commented on June 1, 2024

@northnSouth Thanks, I experienced the same problem in TSX files, I had my configs in a .vim file but I tried using your solution and it worked,

from vim-closetag.

lucassperez avatar lucassperez commented on June 1, 2024

I also have this issue but with any filetype different than html. I'm currently trying to use this with eelixir and eruby, but it just does not work, don't know why. This is my whole init.lua right now:

local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    'git',
    'clone',
    '--filter=blob:none',
    'https://github.com/folke/lazy.nvim.git',
    '--branch=stable', -- latest stable release
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)

require('lazy').setup({
  {
    'alvan/vim-closetag',
    lazy = false,
    config = function()
      vim.cmd("let g:closetag_filetypes='html,eelixir,eruby'")
    end,
    },
})

If I manually change the filetype of any file to html, it starts working 😅

I have tried the same configs shown in this thread and it just does not work for any of those filetypes (js, jsx etc), nor it works for erb and eex when I add it to closetag_filetypes. I have also tried to add *.erb and *.eex to closetag_filenames but to no avail. This plugin just suddenly stopped working )):: Which is really sad, since it is a very good plugin!

Edit: I have also tried to run the command :CloseTagEnableBuffer inside a .eex file (eelixir filetype), but it still does not activate it.

from vim-closetag.

linrongbin16 avatar linrongbin16 commented on June 1, 2024

I´m using this in my init.vim, and it´s working fine for jsx and tsx.

let g:closetag_filenames = '*.html,*.xhtml,*.jsx,*.tsx'
let g:closetag_xhtml_filenames = '*.xhtml,*.jsx,*.tsx'
let g:closetag_filetypes = 'html,js'
let g:closetag_xhtml_filetype = 'xhtml,jsx,tsx'
let g:closetag_emptyTags_caseSensitive = 1
let g:closetag_regions = {
  \ 'typescript.tsx': 'jsxRegion,tsxRegion',
  \ 'javascript.jsx': 'jsxRegion',
  \ }
let g:closetag_shortcut = '>'

Hi @Hdoc1509 , I'm quite confusing on this configuration. Why remove

    \ 'typescriptreact': 'jsxRegion,tsxRegion',
    \ 'javascriptreact': 'jsxRegion',

from g:closetag_regions ?

from vim-closetag.

linrongbin16 avatar linrongbin16 commented on June 1, 2024

I cannot make the configuration work for all of js/jsx/ts/tsx at the same time.
Could anyone help me?

from vim-closetag.

GZLiew avatar GZLiew commented on June 1, 2024

anyone solve the problem where the the auto close tag is applying outside the region??

from vim-closetag.

Related Issues (20)

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.