Skip to content
프로젝트

NMAC427/guess-indent.nvim

GitHub에서 보기

소개

Neovim의 들여쓰기 스타일 자동 감지

개발 도구

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
+1
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

:GuessIndent

MIT License Tests

Blazing fast indentation style detection for Neovim written in Lua. The goal of this plugin is to automatically detect the indentation style used in a buffer and updating the buffer options accordingly. This mimics the "Guess Indentation Settings From Buffer" function built into Sublime Text.

How it works

Whenever you open a new buffer, guess-indent looks at the first few hundred lines and uses them to determine how the buffer should be indented. It then automatically updates the buffer options so that they match the opened file.

Installation

Install using your favorite package manager and then call the following setup function somewhere in your config:

require('guess-indent').setup {}

If you are using packer.nvim, you can install and set up guess-indent simultaneously:

-- using packer.nvim
use {
  'nmac427/guess-indent.nvim',
  config = function() require('guess-indent').setup {} end,
}

Usage

By default, guess-indent automatically runs whenever you open a new buffer. You can also run it manually using the :GuessIndent command.

Configuration

The plugin provides the following configuration options:

-- This is the default configuration
require('guess-indent').setup {
  auto_cmd = true,  -- Set to false to disable automatic execution
  override_editorconfig = false, -- Set to true to override settings set by .editorconfig
  filetype_exclude = {  -- A list of filetypes for which the auto command gets disabled
    "netrw",
    "tutor",
  },
  buftype_exclude = {  -- A list of buffer types for which the auto command gets disabled
    "help",
    "nofile",
    "terminal",
    "prompt",
  },
  on_tab_options = { -- A table of vim options when tabs are detected 
    ["expandtab"] = false,
  },
  on_space_options = { -- A table of vim options when spaces are detected 
    ["expandtab"] = true,
    ["tabstop"] = "detected", -- If the option value is 'detected', The value is set to the automatically detected indent size.
    ["softtabstop"] = "detected",
    ["shiftwidth"] = "detected",
  },
}

Normally it should not be necessary to disable the automatic execution of guess-indent, because it usually takes less than a millisecond to run, even for large files.

Alternatives

Licence

This project is licensed under the terms of the MIT license. For more detail check out the LICENSE file.

관련 프로젝트 살펴보기

불러오는 중…