Skip to content

Commit

Permalink
Add an option to define the line count parsed for the signature check
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeKar committed Sep 8, 2023
1 parent f1bcee8 commit 737e37f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 2 additions & 0 deletions internal/config/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ var optionValidators = map[string]optionValidator{
"fileformat": validateLineEnding,
"encoding": validateEncoding,
"multiopen": validateMultiOpen,
"detectlimit": validateNonNegativeValue,
}

func ReadSettings() error {
Expand Down Expand Up @@ -315,6 +316,7 @@ var defaultCommonSettings = map[string]interface{}{
"tabstospaces": false,
"useprimary": true,
"wordwrap": false,
"detectlimit": float64(100),
}

func GetInfoBarOffset() int {
Expand Down
17 changes: 11 additions & 6 deletions runtime/help/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,11 @@ Here are the available options:
default value: `true`

* `indentchar`: sets the indentation character. This will not be inserted into
files; it is only a visual indicator that whitespace is present. If set to a
printing character, it functions as a subset of the "show invisibles"
setting available in many other text editors. The color of this character is
determined by the `indent-char` field in the current theme rather than the
default text color.
files; it is only a visual indicator that whitespace is present. If set to a
printing character, it functions as a subset of the "show invisibles"
setting available in many other text editors. The color of this character is
determined by the `indent-char` field in the current theme rather than the
default text color.

default value: ` ` (space)

Expand Down Expand Up @@ -386,7 +386,7 @@ Here are the available options:
default value: `false`

* `tabhighlight`: inverts the tab characters' (filename, save indicator, etc)
colors with respect to the tab bar.
colors with respect to the tab bar.

default value: false

Expand All @@ -398,6 +398,11 @@ Here are the available options:

default value: `4`

* `detectlimit`: if this is not set to 0, it will limit the automatic parsed
lines of files to the given value.

default value: `100`

* `tabstospaces`: use spaces instead of tabs. Note: This option will be
overridden by [the `ftoptions` plugin](https://github.com/zyedidia/micro/blob/master/runtime/plugins/ftoptions/ftoptions.lua)
for certain filetypes. To disable this behavior, add `"ftoptions": false` to
Expand Down
2 changes: 1 addition & 1 deletion runtime/syntax/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Here are micro's syntax files.

Each yaml file specifies how to detect the filetype based on file extension or given signature. The signature can be matched to a maximum of 100 lines (to limit parse times) for a best "guess".
Each yaml file specifies how to detect the filetype based on file extension or given signature. The signature can be matched to all available lines of the file or to the value defined with the option `detectlimit` (to limit parse times) for a best "guess".
Then there are patterns and regions linked to highlight groups which tell micro how to highlight that filetype.

Making your own syntax files is very simple. I recommend you check the file after you are finished with the
Expand Down

0 comments on commit 737e37f

Please sign in to comment.