InfoGrab DocsInfoGrab Docs

Neovim용 GitLab 플러그인 설치 및 설정

요약

GitLab Duo Code Suggestions 기능을 사용하려면 GitLab 버전 16.8 이상이 필요합니다. Neovim 버전 0.9 이상이 설치되어 있어야 합니다. NPM이 설치되어 있어야 합니다. 확장을 설치하려면 선택한 플러그인 관리자에 맞는 설치 단계를 따르세요:

사전 요구 사항:

  • GitLab.com과 GitLab Self-Managed 모두, GitLab 버전 16.1 이상이 필요합니다. 많은 확장 기능이 이전 버전에서도 작동할 수 있지만, 지원되지 않습니다.

GitLab Duo Code Suggestions 기능을 사용하려면 GitLab 버전 16.8 이상이 필요합니다.

  • Neovim 버전 0.9 이상이 설치되어 있어야 합니다.

  • NPM이 설치되어 있어야 합니다. NPM은 Code Suggestions 설치에 필요합니다.

확장을 설치하려면 선택한 플러그인 관리자에 맞는 설치 단계를 따르세요:

No plugin manager

Run this command to include this project with

packadd on startup:

git clone https://gitlab.com/gitlab-org/editor-extensions/gitlab.vim.git ~/.local/share/nvim/site/pack/gitlab/start/gitlab.vim

lazy.nvim

Add this plugin to your [lazy.nvim](https://github.com/folke/lazy.nvim) configuration:
{
  'https://gitlab.com/gitlab-org/editor-extensions/gitlab.vim.git',
  -- Activate when a file is created/opened
  event = { 'BufReadPre', 'BufNewFile' },
  -- Activate when a supported filetype is open
  ft = { 'go', 'javascript', 'python', 'ruby' },
  cond = function()
    -- Only activate if token is present in environment variable.
    -- Remove this line to use the interactive workflow.
    return vim.env.GITLAB_TOKEN ~= nil and vim.env.GITLAB_TOKEN ~= ''
  end,
  opts = {
    statusline = {
      -- Hook into the built-in statusline to indicate the status
      -- of the GitLab Duo Code Suggestions integration
      enabled = true,
    },
  },
}

packer.nvim

Declare the plugin in your [packer.nvim](https://github.com/wbthomason/packer.nvim) configuration:
use {
  "git@gitlab.com:gitlab-org/editor-extensions/gitlab.vim.git",
}

GitLab 인증#

이 확장을 GitLab 계정에 연결하려면 환경 변수를 구성하세요:

환경 변수 기본값 설명
GITLAB_TOKEN 해당 없음 인증된 요청에 사용할 기본 GitLab 개인 액세스 토큰입니다. 제공하면 대화형 인증을 건너뜁니다.
GITLAB_VIM_URL https://gitlab.com 연결할 GitLab 인스턴스를 재정의합니다. 기본값은 https://gitlab.com 입니다.

전체 환경 변수 목록은 확장의 도움말 텍스트 doc/gitlab.txt에서 확인할 수 있습니다.

확장 구성#

이 확장을 구성하려면:

원하는 파일 유형을 구성하세요. 예를 들어, 이 플러그인은 Ruby를 지원하므로 FileType ruby 자동 명령을 추가합니다. 더 많은 파일 유형에 이 동작을 구성하려면 code_suggestions.auto_filetypes 설정 옵션에 파일 유형을 추가하세요:

require('gitlab').setup({
  statusline = {
    enabled = false
  },
  code_suggestions = {
    -- For the full list of default languages, see the 'auto_filetypes' array in
    -- https://gitlab.com/gitlab-org/editor-extensions/gitlab.vim/-/blob/main/lua/gitlab/config/defaults.lua
    auto_filetypes = { 'ruby', 'javascript' }, -- Default is { 'ruby' }
    ghost_text = {
      enabled = false, -- ghost text is an experimental feature
      toggle_enabled = "<C-h>",
      accept_suggestion = "<C-l>",
      clear_suggestions = "<C-k>",
      stream = true,
    },
  }
})

Omni Completion 구성으로 Code Suggestions를 트리거하는 키 매핑을 설정하세요.

선택 사항. 키 매핑 구성.

선택 사항. :helptags ALL을 사용하여 helptags를 설정해 :help gitlab.txt에 접근하세요.

Omni Completion 구성#

Code Suggestions와 함께 Omni Completion을 활성화하려면:

api 범위로 개인 액세스 토큰을 생성하세요.

셸에 GITLAB_TOKEN 환경 변수로 토큰을 추가하세요.

:GitLabCodeSuggestionsInstallLanguageServer vim 명령을 실행하여 Code Suggestions 언어 서버를 설치하세요.

:GitLabCodeSuggestionsStart vim 명령을 실행하여 언어 서버를 시작하세요. 선택 사항으로, 키 매핑 구성으로 언어 서버를 전환할 수 있습니다.

선택 사항. 단일 제안에 대해서도 Omni Completion 대화 상자를 구성하는 것을 고려하세요:

vim.o.completeopt = 'menu,menuone'

지원되는 파일 유형에서 작업할 때 Control+x를 누른 후 Control+o를 눌러 Omni Completion 메뉴를 여세요.

키 매핑 구성#

편의를 위해 이 플러그인은 키 매핑을 제공합니다. (GitLab...) 키 매핑을 사용하려면 이를 참조하는 고유한 키 매핑을 포함해야 합니다:

-- Toggle Code Suggestions on/off with Control-G in normal mode:
vim.keymap.set('n', '<C-g>', '(GitLabToggleCodeSuggestions)')

확장 제거#

확장을 제거하려면 다음 명령으로 이 플러그인과 언어 서버 바이너리를 삭제하세요:

rm -r ~/.local/share/nvim/site/pack/gitlab/start/gitlab.vim
rm ~/.local/share/nvim/gitlab-code-suggestions-language-server-*

Neovim용 GitLab 플러그인 설치 및 설정

GitLab v19.1
Tier: [Free](/19.1/subscriptions/gitlab_credits/#for-the-free-tier), Premium, Ultimate
Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
원문 보기
요약

GitLab Duo Code Suggestions 기능을 사용하려면 GitLab 버전 16.8 이상이 필요합니다. Neovim 버전 0.9 이상이 설치되어 있어야 합니다. NPM이 설치되어 있어야 합니다. 확장을 설치하려면 선택한 플러그인 관리자에 맞는 설치 단계를 따르세요:

사전 요구 사항:

  • GitLab.com과 GitLab Self-Managed 모두, GitLab 버전 16.1 이상이 필요합니다. 많은 확장 기능이 이전 버전에서도 작동할 수 있지만, 지원되지 않습니다.

GitLab Duo Code Suggestions 기능을 사용하려면 GitLab 버전 16.8 이상이 필요합니다.

  • Neovim 버전 0.9 이상이 설치되어 있어야 합니다.

  • NPM이 설치되어 있어야 합니다. NPM은 Code Suggestions 설치에 필요합니다.

확장을 설치하려면 선택한 플러그인 관리자에 맞는 설치 단계를 따르세요:

No plugin manager

Run this command to include this project with

packadd on startup:

git clone https://gitlab.com/gitlab-org/editor-extensions/gitlab.vim.git ~/.local/share/nvim/site/pack/gitlab/start/gitlab.vim

lazy.nvim

Add this plugin to your [lazy.nvim](https://github.com/folke/lazy.nvim) configuration:
{
  'https://gitlab.com/gitlab-org/editor-extensions/gitlab.vim.git',
  -- Activate when a file is created/opened
  event = { 'BufReadPre', 'BufNewFile' },
  -- Activate when a supported filetype is open
  ft = { 'go', 'javascript', 'python', 'ruby' },
  cond = function()
    -- Only activate if token is present in environment variable.
    -- Remove this line to use the interactive workflow.
    return vim.env.GITLAB_TOKEN ~= nil and vim.env.GITLAB_TOKEN ~= ''
  end,
  opts = {
    statusline = {
      -- Hook into the built-in statusline to indicate the status
      -- of the GitLab Duo Code Suggestions integration
      enabled = true,
    },
  },
}

packer.nvim

Declare the plugin in your [packer.nvim](https://github.com/wbthomason/packer.nvim) configuration:
use {
  "git@gitlab.com:gitlab-org/editor-extensions/gitlab.vim.git",
}

GitLab 인증#

이 확장을 GitLab 계정에 연결하려면 환경 변수를 구성하세요:

환경 변수 기본값 설명
GITLAB_TOKEN 해당 없음 인증된 요청에 사용할 기본 GitLab 개인 액세스 토큰입니다. 제공하면 대화형 인증을 건너뜁니다.
GITLAB_VIM_URL https://gitlab.com 연결할 GitLab 인스턴스를 재정의합니다. 기본값은 https://gitlab.com 입니다.

전체 환경 변수 목록은 확장의 도움말 텍스트 doc/gitlab.txt에서 확인할 수 있습니다.

확장 구성#

이 확장을 구성하려면:

원하는 파일 유형을 구성하세요. 예를 들어, 이 플러그인은 Ruby를 지원하므로 FileType ruby 자동 명령을 추가합니다. 더 많은 파일 유형에 이 동작을 구성하려면 code_suggestions.auto_filetypes 설정 옵션에 파일 유형을 추가하세요:

require('gitlab').setup({
  statusline = {
    enabled = false
  },
  code_suggestions = {
    -- For the full list of default languages, see the 'auto_filetypes' array in
    -- https://gitlab.com/gitlab-org/editor-extensions/gitlab.vim/-/blob/main/lua/gitlab/config/defaults.lua
    auto_filetypes = { 'ruby', 'javascript' }, -- Default is { 'ruby' }
    ghost_text = {
      enabled = false, -- ghost text is an experimental feature
      toggle_enabled = "<C-h>",
      accept_suggestion = "<C-l>",
      clear_suggestions = "<C-k>",
      stream = true,
    },
  }
})

Omni Completion 구성으로 Code Suggestions를 트리거하는 키 매핑을 설정하세요.

선택 사항. 키 매핑 구성.

선택 사항. :helptags ALL을 사용하여 helptags를 설정해 :help gitlab.txt에 접근하세요.

Omni Completion 구성#

Code Suggestions와 함께 Omni Completion을 활성화하려면:

api 범위로 개인 액세스 토큰을 생성하세요.

셸에 GITLAB_TOKEN 환경 변수로 토큰을 추가하세요.

:GitLabCodeSuggestionsInstallLanguageServer vim 명령을 실행하여 Code Suggestions 언어 서버를 설치하세요.

:GitLabCodeSuggestionsStart vim 명령을 실행하여 언어 서버를 시작하세요. 선택 사항으로, 키 매핑 구성으로 언어 서버를 전환할 수 있습니다.

선택 사항. 단일 제안에 대해서도 Omni Completion 대화 상자를 구성하는 것을 고려하세요:

vim.o.completeopt = 'menu,menuone'

지원되는 파일 유형에서 작업할 때 Control+x를 누른 후 Control+o를 눌러 Omni Completion 메뉴를 여세요.

키 매핑 구성#

편의를 위해 이 플러그인은 키 매핑을 제공합니다. (GitLab...) 키 매핑을 사용하려면 이를 참조하는 고유한 키 매핑을 포함해야 합니다:

-- Toggle Code Suggestions on/off with Control-G in normal mode:
vim.keymap.set('n', '<C-g>', '(GitLabToggleCodeSuggestions)')

확장 제거#

확장을 제거하려면 다음 명령으로 이 플러그인과 언어 서버 바이너리를 삭제하세요:

rm -r ~/.local/share/nvim/site/pack/gitlab/start/gitlab.vim
rm ~/.local/share/nvim/gitlab-code-suggestions-language-server-*