Neovim

[RockyOS9] Neovim typescript Tagbar 추가하기

_HelloWorld_ 2024. 12. 21. 23:19

EPEL 저장소 활성화

sudo apt install universal-ctags

Universal Ctags 설치

sudo dnf install universal-ctags -y

설치 확인

[jhkim@localhost ~]$ ctags --version
Universal Ctags 6.0.0, Copyright (C) 2015-2022 Universal Ctags Team
Universal Ctags is derived from Exuberant Ctags.
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
  Compiled: Feb  1 2023, 00:00:00
  URL: https://ctags.io/
  Output version: 0.0
  Optional compiled features: +wildcards, +regex, +gnulib_regex, +iconv, +option-directory, +xpath, +json, +interactive, +sandbox, +yaml, +packcc, +optscript
[jhkim@localhost ~]$

ctags 파일 설정하기

~/.ctags 또는 /etc/ctags.conf에 아래 내용을 추가

--langdef=typescript
--langmap=typescript:.ts.tsx
--regex-typescript=/class ([a-zA-Z0-9_]+)/\1/c,classes/
--regex-typescript=/interface ([a-zA-Z0-9_]+)/\1/i,interfaces/
--regex-typescript=/function ([a-zA-Z0-9_]+)/\1/f,functions/
--regex-typescript=/const ([a-zA-Z0-9_]+)/\1/c,consts/
--regex-typescript=/let ([a-zA-Z0-9_]+)/\1/l,lets/
--regex-typescript=/var ([a-zA-Z0-9_]+)/\1/v,vars/

Init.lua ( 적용이 안 된다면 )

vim.g.tagbar_type_typescript = {
    ctagstype = 'typescript',
    kinds = {
        'c:classes',
        'i:interfaces',
        'f:functions',
        'c:consts',
        'l:lets',
        'v:vars',
    },
    sro = '.',
    kind2scope = {
        c = 'class',
        i = 'interface',
    },
    scope2kind = {
        class = 'c',
        interface = 'i',
    },
    sort = 0,
}

'Neovim' 카테고리의 다른 글

nvim 버전 업그레이드 하기  (0) 2025.01.01
init.lua  (0) 2024.10.23