Documentation
¶
Index ¶
Constants ¶
const ( // Mode "enum" values Blank = iota Git // Git commits and interactive rebases Markdown // Markdown (and asciidoctor and rst files) Makefile // Makefiles Shell // Shell scripts and PKGBUILD files Config // Config like yaml, yml, toml, and ini files Assembly // Assembly GoAssembly // Go-style Assembly Go // Go Haskell // Haskell OCaml // OCaml StandardML // Standard ML Python // Python Text // plain text documents CMake // CMake files Vim // Vim or NeoVim configuration, or .vim scripts V // V programming language Clojure // Clojure Lisp // Common Lisp and Emacs Lisp Zig // Zig Kotlin // Kotlin Java // Java HIDL // the Android-related Hardware Abstraction Layer Interface Definition Language SQL // Structured Query Language Oak // Oak Rust // Rust Lua // Lua Crystal // Crystal Nim // Nim ObjectPascal // Object Pascal and Delphi Bat // DOS batch files Cpp // C++ C // C Ada // Ada HTML // HTML Odin // Odin XML // XML PolicyLanguage // SE Linux configuration files Nroff // editing man pages Scala // Scala JSON // JSON and iPython notebooks Battlestar // Battlestar CS // C# JavaScript // JavaScript TypeScript // TypeScript ManPage // viewing man pages Amber // Amber templates Bazel // Bazel and Starlark D // D Perl // Perl M4 // M4 macros )
Variables ¶
var DefaultTabsSpaces = TabsSpaces{4, true}
DefaultTabsSpaces is the default setting: 4 spaces
Functions ¶
This section is empty.
Types ¶
type Mode ¶
type Mode int
Mode is a per-filetype mode, like for Markdown
func Detect ¶
Detect looks at the filename and tries to guess what could be an appropriate editor mode.
func DetectFromContents ¶ added in v0.1.0
DetectFromContents takes the first line of a file as a string, and a function that can return the entire contents of the file as a string, which will only be called if needed. Based on the contents, a Mode is detected and returned.
func (Mode) Spaces ¶ added in v0.2.0
Spaces returns true if spaces should be used for the current mode
func (Mode) TabsSpaces ¶ added in v0.2.0
func (m Mode) TabsSpaces() TabsSpaces
TabsSpaces tries to return the appropriate settings for tabs and spaces as a TabsSpaces struct
type TabsSpaces ¶ added in v0.2.0
type TabsSpaces struct {
PerTab int // number of spaces per tab/indentation
Spaces bool // use spaces, or tabs?
}
TabsSpaces contains all info needed about tabs and spaces for a file
func (TabsSpaces) String ¶ added in v0.2.0
func (ts TabsSpaces) String() string
String returns the string for one indentation
func (TabsSpaces) WSLen ¶ added in v0.2.0
func (ts TabsSpaces) WSLen(whitespaceString string) int
WSLen will count the length of the given whitespace string, in terms of spaces