mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-09 20:44:03 -08:00
feat(iterm): add iTerm features to the root configuration
BREAKING CHANGE: The iTerm segment has been removed and its features have been added to the root configuration. To re-enable the iTerm features, remove the iTerm segment and add the following to your oh-my-posh configuration: ```json { "iterm_features": ["prompt_mark", "current_dir", "remote_host"] } ``` Choose this option if you want to enable the prompt mark for shell integration and/or enable current directory and remote host in the iTerm status bar.
This commit is contained in:
parent
391ceaf5f0
commit
e7a10ac029
|
@ -114,6 +114,10 @@ type Writer struct {
|
|||
hyperlinkStart string
|
||||
hyperlinkCenter string
|
||||
hyperlinkEnd string
|
||||
|
||||
iTermPromptMark string
|
||||
iTermCurrentDir string
|
||||
iTermRemoteHost string
|
||||
}
|
||||
|
||||
func (w *Writer) Init(shellName string) {
|
||||
|
@ -137,6 +141,9 @@ func (w *Writer) Init(shellName string) {
|
|||
w.osc99 = "\\[\x1b]9;9;%s\x1b\\\\\\]"
|
||||
w.osc7 = "\\[\x1b]7;file://%s/%s\x1b\\\\\\]"
|
||||
w.osc51 = "\\[\x1b]51;A;%s@%s:%s\x1b\\\\\\]"
|
||||
w.iTermPromptMark = "\\[$(iterm2_prompt_mark)\\]"
|
||||
w.iTermCurrentDir = "\\[\x1b]1337;CurrentDir=%s\x07\\]"
|
||||
w.iTermRemoteHost = "\\[\x1b]1337;RemoteHost=%s@%s\x07\\]"
|
||||
case shell.ZSH, shell.TCSH:
|
||||
w.format = "%%{%s%%}"
|
||||
w.linechange = "%%{\x1b[%d%s%%}"
|
||||
|
@ -154,6 +161,9 @@ func (w *Writer) Init(shellName string) {
|
|||
w.osc99 = "%%{\x1b]9;9;%s\x1b\\%%}"
|
||||
w.osc7 = "%%{\x1b]7;file://%s/%s\x1b\\%%}"
|
||||
w.osc51 = "%%{\x1b]51;A%s@%s:%s\x1b\\%%}"
|
||||
w.iTermPromptMark = "%{$(iterm2_prompt_mark)%}"
|
||||
w.iTermCurrentDir = "%%{\x1b]1337;CurrentDir=%s\x07%%}"
|
||||
w.iTermRemoteHost = "%%{\x1b]1337;RemoteHost=%s@%s\x07%%}"
|
||||
default:
|
||||
w.linechange = "\x1b[%d%s"
|
||||
w.left = "\x1b[%dD"
|
||||
|
@ -171,6 +181,9 @@ func (w *Writer) Init(shellName string) {
|
|||
w.osc99 = "\x1b]9;9;%s\x1b\\"
|
||||
w.osc7 = "\x1b]7;file://%s/%s\x1b\\"
|
||||
w.osc51 = "\x1b]51;A%s@%s:%s\x1b\\"
|
||||
w.iTermPromptMark = "$(iterm2_prompt_mark)"
|
||||
w.iTermCurrentDir = "\x1b]1337;CurrentDir=%s\x07"
|
||||
w.iTermRemoteHost = "\x1b]1337;RemoteHost=%s@%s\x07"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
32
src/ansi/iterm.go
Normal file
32
src/ansi/iterm.go
Normal file
|
@ -0,0 +1,32 @@
|
|||
package ansi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type iTermFeature string
|
||||
|
||||
const (
|
||||
PromptMark iTermFeature = "prompt_mark"
|
||||
CurrentDir iTermFeature = "current_dir"
|
||||
RemoteHost iTermFeature = "remote_host"
|
||||
)
|
||||
|
||||
type ITermFeatures []iTermFeature
|
||||
|
||||
func (w *Writer) RenderItermFeatures(features ITermFeatures, pwd, user, host string) string {
|
||||
var result strings.Builder
|
||||
for _, feature := range features {
|
||||
switch feature {
|
||||
case PromptMark:
|
||||
result.WriteString(w.iTermPromptMark)
|
||||
case CurrentDir:
|
||||
result.WriteString(fmt.Sprintf(w.iTermCurrentDir, pwd))
|
||||
case RemoteHost:
|
||||
result.WriteString(fmt.Sprintf(w.iTermRemoteHost, user, host))
|
||||
}
|
||||
}
|
||||
|
||||
return result.String()
|
||||
}
|
|
@ -31,27 +31,28 @@ const (
|
|||
|
||||
// Config holds all the theme for rendering the prompt
|
||||
type Config struct {
|
||||
Version int `json:"version" toml:"version"`
|
||||
FinalSpace bool `json:"final_space,omitempty" toml:"final_space,omitempty"`
|
||||
ConsoleTitleTemplate string `json:"console_title_template,omitempty" toml:"console_title_template,omitempty"`
|
||||
TerminalBackground string `json:"terminal_background,omitempty" toml:"terminal_background,omitempty"`
|
||||
AccentColor string `json:"accent_color,omitempty" toml:"accent_color,omitempty"`
|
||||
Blocks []*Block `json:"blocks,omitempty" toml:"blocks,omitempty"`
|
||||
Tooltips []*Segment `json:"tooltips,omitempty" toml:"tooltips,omitempty"`
|
||||
TransientPrompt *Segment `json:"transient_prompt,omitempty" toml:"transient_prompt,omitempty"`
|
||||
ValidLine *Segment `json:"valid_line,omitempty" toml:"valid_line,omitempty"`
|
||||
ErrorLine *Segment `json:"error_line,omitempty" toml:"error_line,omitempty"`
|
||||
SecondaryPrompt *Segment `json:"secondary_prompt,omitempty" toml:"secondary_prompt,omitempty"`
|
||||
DebugPrompt *Segment `json:"debug_prompt,omitempty" toml:"debug_prompt,omitempty"`
|
||||
Palette ansi.Palette `json:"palette,omitempty" toml:"palette,omitempty"`
|
||||
Palettes *ansi.Palettes `json:"palettes,omitempty" toml:"palettes,omitempty"`
|
||||
Cycle ansi.Cycle `json:"cycle,omitempty" toml:"cycle,omitempty"`
|
||||
ShellIntegration bool `json:"shell_integration,omitempty" toml:"shell_integration,omitempty"`
|
||||
PWD string `json:"pwd,omitempty" toml:"pwd,omitempty"`
|
||||
Var map[string]any `json:"var,omitempty" toml:"var,omitempty"`
|
||||
DisableCursorPositioning bool `json:"disable_cursor_positioning,omitempty" toml:"disable_cursor_positioning,omitempty"`
|
||||
PatchPwshBleed bool `json:"patch_pwsh_bleed,omitempty" toml:"patch_pwsh_bleed,omitempty"`
|
||||
DisableNotice bool `json:"disable_notice,omitempty" toml:"disable_notice,omitempty"`
|
||||
Version int `json:"version" toml:"version"`
|
||||
FinalSpace bool `json:"final_space,omitempty" toml:"final_space,omitempty"`
|
||||
ConsoleTitleTemplate string `json:"console_title_template,omitempty" toml:"console_title_template,omitempty"`
|
||||
TerminalBackground string `json:"terminal_background,omitempty" toml:"terminal_background,omitempty"`
|
||||
AccentColor string `json:"accent_color,omitempty" toml:"accent_color,omitempty"`
|
||||
Blocks []*Block `json:"blocks,omitempty" toml:"blocks,omitempty"`
|
||||
Tooltips []*Segment `json:"tooltips,omitempty" toml:"tooltips,omitempty"`
|
||||
TransientPrompt *Segment `json:"transient_prompt,omitempty" toml:"transient_prompt,omitempty"`
|
||||
ValidLine *Segment `json:"valid_line,omitempty" toml:"valid_line,omitempty"`
|
||||
ErrorLine *Segment `json:"error_line,omitempty" toml:"error_line,omitempty"`
|
||||
SecondaryPrompt *Segment `json:"secondary_prompt,omitempty" toml:"secondary_prompt,omitempty"`
|
||||
DebugPrompt *Segment `json:"debug_prompt,omitempty" toml:"debug_prompt,omitempty"`
|
||||
Palette ansi.Palette `json:"palette,omitempty" toml:"palette,omitempty"`
|
||||
Palettes *ansi.Palettes `json:"palettes,omitempty" toml:"palettes,omitempty"`
|
||||
Cycle ansi.Cycle `json:"cycle,omitempty" toml:"cycle,omitempty"`
|
||||
ShellIntegration bool `json:"shell_integration,omitempty" toml:"shell_integration,omitempty"`
|
||||
PWD string `json:"pwd,omitempty" toml:"pwd,omitempty"`
|
||||
Var map[string]any `json:"var,omitempty" toml:"var,omitempty"`
|
||||
DisableCursorPositioning bool `json:"disable_cursor_positioning,omitempty" toml:"disable_cursor_positioning,omitempty"`
|
||||
PatchPwshBleed bool `json:"patch_pwsh_bleed,omitempty" toml:"patch_pwsh_bleed,omitempty"`
|
||||
DisableNotice bool `json:"disable_notice,omitempty" toml:"disable_notice,omitempty"`
|
||||
ITermFeatures ansi.ITermFeatures `json:"iterm_features,omitempty" toml:"iterm_features,omitempty"`
|
||||
|
||||
// Deprecated
|
||||
OSC99 bool `json:"osc99,omitempty" toml:"osc99,omitempty"`
|
||||
|
|
|
@ -132,6 +132,10 @@ func (e *Engine) isWarp() bool {
|
|||
return e.Env.Getenv("TERM_PROGRAM") == "WarpTerminal"
|
||||
}
|
||||
|
||||
func (e *Engine) isIterm() bool {
|
||||
return e.Env.Getenv("TERM_PROGRAM") == "iTerm.app"
|
||||
}
|
||||
|
||||
func (e *Engine) shouldFill(filler string, remaining, blockLength int) (string, bool) {
|
||||
if len(filler) == 0 {
|
||||
return "", false
|
||||
|
|
|
@ -68,6 +68,11 @@ func (e *Engine) Primary() string {
|
|||
e.currentLineLength++
|
||||
}
|
||||
|
||||
if e.Config.ITermFeatures != nil && e.isIterm() {
|
||||
host, _ := e.Env.Host()
|
||||
e.write(e.Writer.RenderItermFeatures(e.Config.ITermFeatures, e.Env.Pwd(), e.Env.User(), host))
|
||||
}
|
||||
|
||||
if e.Config.ShellIntegration && e.Config.TransientPrompt == nil {
|
||||
e.write(e.Writer.CommandStart())
|
||||
}
|
||||
|
|
|
@ -160,8 +160,6 @@ const (
|
|||
HELM SegmentType = "helm"
|
||||
// IPIFY segment
|
||||
IPIFY SegmentType = "ipify"
|
||||
// ITERM inserts the Shell Integration prompt mark on iTerm zsh/bash/fish
|
||||
ITERM SegmentType = "iterm"
|
||||
// JAVA writes the active java version
|
||||
JAVA SegmentType = "java"
|
||||
// JULIA writes which julia version is currently active
|
||||
|
@ -307,7 +305,6 @@ var Segments = map[SegmentType]func() SegmentWriter{
|
|||
HASKELL: func() SegmentWriter { return &segments.Haskell{} },
|
||||
HELM: func() SegmentWriter { return &segments.Helm{} },
|
||||
IPIFY: func() SegmentWriter { return &segments.IPify{} },
|
||||
ITERM: func() SegmentWriter { return &segments.ITerm{} },
|
||||
JAVA: func() SegmentWriter { return &segments.Java{} },
|
||||
JULIA: func() SegmentWriter { return &segments.Julia{} },
|
||||
KOTLIN: func() SegmentWriter { return &segments.Kotlin{} },
|
||||
|
|
|
@ -200,6 +200,7 @@ type Shell struct {
|
|||
Var SimpleMap
|
||||
|
||||
cwd string
|
||||
host string
|
||||
cmdCache *commandCache
|
||||
fileCache *fileCache
|
||||
tmplCache *TemplateCache
|
||||
|
@ -496,13 +497,20 @@ func (env *Shell) User() string {
|
|||
|
||||
func (env *Shell) Host() (string, error) {
|
||||
defer env.Trace(time.Now())
|
||||
if len(env.host) != 0 {
|
||||
return env.host, nil
|
||||
}
|
||||
|
||||
hostName, err := os.Hostname()
|
||||
if err != nil {
|
||||
env.Error(err)
|
||||
return "", err
|
||||
}
|
||||
|
||||
hostName = cleanHostName(hostName)
|
||||
env.Debug(hostName)
|
||||
env.host = hostName
|
||||
|
||||
return hostName, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
package segments
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/jandedobbeleer/oh-my-posh/src/platform"
|
||||
"github.com/jandedobbeleer/oh-my-posh/src/properties"
|
||||
"github.com/jandedobbeleer/oh-my-posh/src/shell"
|
||||
)
|
||||
|
||||
type ITerm struct {
|
||||
props properties.Properties
|
||||
env platform.Environment
|
||||
}
|
||||
|
||||
func (i *ITerm) Template() string {
|
||||
return "{{ .PromptMark }}"
|
||||
}
|
||||
|
||||
func (i *ITerm) Enabled() bool {
|
||||
return i.env.Getenv("TERM_PROGRAM") == "iTerm.app"
|
||||
}
|
||||
|
||||
func (i *ITerm) PromptMark() string {
|
||||
// Check to ensure the user has squelched the default mark for BASH and ZSH
|
||||
if i.env.Getenv("ITERM2_SQUELCH_MARK") != "1" {
|
||||
i.env.Debug("iTerm default mark enabled, adjust using export ITERM2_SQUELCH_MARK=1")
|
||||
return ""
|
||||
}
|
||||
|
||||
sh := i.env.Shell()
|
||||
if sh != shell.ZSH && sh != shell.BASH {
|
||||
i.env.Debug("Shell is not ZSH or BASH, cannot set prompt mark")
|
||||
return ""
|
||||
}
|
||||
|
||||
return i.format("$(iterm2_prompt_mark)")
|
||||
}
|
||||
|
||||
func (i *ITerm) CurrentDir() string {
|
||||
dir := fmt.Sprintf("\x1b]1337;CurrentDir=%s\x07", i.env.Pwd())
|
||||
return i.format(dir)
|
||||
}
|
||||
|
||||
func (i *ITerm) RemoteHost() string {
|
||||
host, err := i.env.Host()
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
remoteHost := fmt.Sprintf("\x1b]1337;RemoteHost=%s@%s\x07", i.env.User(), host)
|
||||
return i.format(remoteHost)
|
||||
}
|
||||
|
||||
func (i *ITerm) format(input string) string {
|
||||
switch i.env.Shell() {
|
||||
case shell.ZSH:
|
||||
return fmt.Sprintf(`%%{%s%%}`, input)
|
||||
case shell.BASH:
|
||||
return fmt.Sprintf(`\[%s\]`, input)
|
||||
default:
|
||||
return input
|
||||
}
|
||||
}
|
||||
|
||||
func (i *ITerm) Init(props properties.Properties, env platform.Environment) {
|
||||
i.props = props
|
||||
i.env = env
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
package segments
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/jandedobbeleer/oh-my-posh/src/mock"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
mock2 "github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
func TestITermSegment(t *testing.T) {
|
||||
cases := []struct {
|
||||
Case string
|
||||
TermProgram string
|
||||
SquelchMark string
|
||||
Shell string
|
||||
Template string
|
||||
ExpectedString string
|
||||
ExpectedDisabled bool
|
||||
}{
|
||||
{Case: "not iterm", TermProgram: "", SquelchMark: "1", Shell: "zsh", ExpectedDisabled: true},
|
||||
{Case: "default mark", TermProgram: "iTerm.app", Shell: "zsh", Template: "{{ .PromptMark }}", ExpectedDisabled: false},
|
||||
{Case: "zsh", TermProgram: "iTerm.app", SquelchMark: "1", Shell: "zsh", Template: "{{ .PromptMark }}", ExpectedString: `%{$(iterm2_prompt_mark)%}`},
|
||||
{Case: "bash", TermProgram: "iTerm.app", SquelchMark: "1", Shell: "bash", Template: "{{ .PromptMark }}", ExpectedString: `\[$(iterm2_prompt_mark)\]`},
|
||||
{Case: "fish", TermProgram: "iTerm.app", SquelchMark: "1", Shell: "fish", Template: "{{ .PromptMark }}", ExpectedDisabled: false},
|
||||
{Case: "pwsh", TermProgram: "iTerm.app", SquelchMark: "1", Shell: "pwsh", Template: "{{ .PromptMark }}", ExpectedDisabled: false},
|
||||
{Case: "gibberishshell", TermProgram: "iTerm.app", SquelchMark: "1", Shell: "jaserhuashf", Template: "{{ .PromptMark }}", ExpectedDisabled: false},
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
env := new(mock.MockedEnvironment)
|
||||
env.On("PathSeparator").Return("/")
|
||||
env.On("Getenv", "TERM_PROGRAM").Return(tc.TermProgram)
|
||||
env.On("Getenv", "ITERM2_SQUELCH_MARK").Return(tc.SquelchMark)
|
||||
env.On("Shell").Return(tc.Shell)
|
||||
env.On("Error", mock2.Anything).Return()
|
||||
iterm := &ITerm{
|
||||
env: env,
|
||||
}
|
||||
assert.Equal(t, !tc.ExpectedDisabled, iterm.Enabled(), tc.Case)
|
||||
if !tc.ExpectedDisabled {
|
||||
assert.Equal(t, tc.ExpectedString, renderTemplate(env, tc.Template, iterm), tc.Case)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -321,7 +321,6 @@
|
|||
"haskell",
|
||||
"helm",
|
||||
"ipify",
|
||||
"iterm",
|
||||
"julia",
|
||||
"java",
|
||||
"kotlin",
|
||||
|
@ -549,7 +548,10 @@
|
|||
"type": "array",
|
||||
"title": "Extensions",
|
||||
"description": "The extensions to look for when determining if a folder is an NPM workspace",
|
||||
"default": ["package.json", "package-lock.json"],
|
||||
"default": [
|
||||
"package.json",
|
||||
"package-lock.json"
|
||||
],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
|
@ -631,7 +633,11 @@
|
|||
"title": "Source",
|
||||
"description": "https://ohmyposh.dev/docs/segments/az#properties",
|
||||
"default": "first_match",
|
||||
"enum": ["first_match", "cli", "pwsh"]
|
||||
"enum": [
|
||||
"first_match",
|
||||
"cli",
|
||||
"pwsh"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -745,7 +751,11 @@
|
|||
"type": "array",
|
||||
"title": "Folders",
|
||||
"description": "The folders to look for when determining if a folder is a Bazel workspace",
|
||||
"default": ["bazel-bin", "bazel-out", "bazel-testlogs"],
|
||||
"default": [
|
||||
"bazel-bin",
|
||||
"bazel-out",
|
||||
"bazel-testlogs"
|
||||
],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
|
@ -791,7 +801,11 @@
|
|||
"type": "array",
|
||||
"title": "Extensions",
|
||||
"description": "The extensions to look for when determining if a folder is a Buf workspace",
|
||||
"default": ["buf.yaml", "buf.gen.yaml", "buf.work.yaml"],
|
||||
"default": [
|
||||
"buf.yaml",
|
||||
"buf.gen.yaml",
|
||||
"buf.work.yaml"
|
||||
],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
|
@ -884,7 +898,12 @@
|
|||
"type": "string",
|
||||
"title": "Connection type",
|
||||
"description": "The connection type to display",
|
||||
"enum": ["ethernet", "wifi", "cellular", "bluetooth"],
|
||||
"enum": [
|
||||
"ethernet",
|
||||
"wifi",
|
||||
"cellular",
|
||||
"bluetooth"
|
||||
],
|
||||
"default": "wifi|ethernet"
|
||||
},
|
||||
"unit": {
|
||||
|
@ -946,7 +965,10 @@
|
|||
"type": "array",
|
||||
"title": "Extensions",
|
||||
"description": "The extensions to look for when determining if a folder is a CMake workspace",
|
||||
"default": ["*.cmake", "CMakeLists.txt"],
|
||||
"default": [
|
||||
"*.cmake",
|
||||
"CMakeLists.txt"
|
||||
],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
|
@ -1054,10 +1076,10 @@
|
|||
"default": false
|
||||
},
|
||||
"status_template": {
|
||||
"type": "string",
|
||||
"title": "Status Template",
|
||||
"description": "The template to use for the status segment",
|
||||
"default": "|"
|
||||
"type": "string",
|
||||
"title": "Status Template",
|
||||
"description": "The template to use for the status segment",
|
||||
"default": "|"
|
||||
},
|
||||
"status_separator": {
|
||||
"type": "string",
|
||||
|
@ -1120,7 +1142,9 @@
|
|||
"type": "array",
|
||||
"title": "Folders",
|
||||
"description": "The folders to look for when determining if a folder is a Flutter workspace",
|
||||
"default": [".dart_tool"],
|
||||
"default": [
|
||||
".dart_tool"
|
||||
],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
|
@ -1393,7 +1417,10 @@
|
|||
"type": "array",
|
||||
"title": "Extensions",
|
||||
"description": "The extensions to look for when determining if a folder is a Go workspace",
|
||||
"default": ["*.go", "go.mod"],
|
||||
"default": [
|
||||
"*.go",
|
||||
"go.mod"
|
||||
],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
|
@ -1456,7 +1483,9 @@
|
|||
"type": "array",
|
||||
"title": "Folders",
|
||||
"description": "The folders to look for when determining if a folder is a Dart workspace",
|
||||
"default": [".dart_tool"],
|
||||
"default": [
|
||||
".dart_tool"
|
||||
],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
|
@ -1502,7 +1531,11 @@
|
|||
"type": "array",
|
||||
"title": "Extensions",
|
||||
"description": "The extensions to look for when determining if a folder is a Deno workspace",
|
||||
"default": ["*.js", "*.ts", "deno.json"],
|
||||
"default": [
|
||||
"*.js",
|
||||
"*.ts",
|
||||
"deno.json"
|
||||
],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
|
@ -1551,7 +1584,10 @@
|
|||
"type": "array",
|
||||
"title": "Extensions",
|
||||
"description": "The extensions to look for when determining if a folder is a Crystal workspace",
|
||||
"default": ["*.cr", "shard.yml"],
|
||||
"default": [
|
||||
"*.cr",
|
||||
"shard.yml"
|
||||
],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
|
@ -1600,7 +1636,9 @@
|
|||
"type": "array",
|
||||
"title": "Extensions",
|
||||
"description": "The extensions to look for when determining if a folder is a Julia workspace",
|
||||
"default": ["*.jl"],
|
||||
"default": [
|
||||
"*.jl"
|
||||
],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
|
@ -1649,7 +1687,12 @@
|
|||
"type": "array",
|
||||
"title": "Extensions",
|
||||
"description": "The extensions to look for when determining if a folder is a Perl workspace",
|
||||
"default": [".perl-version", "*.pl", "*.pm", "*.t"],
|
||||
"default": [
|
||||
".perl-version",
|
||||
"*.pl",
|
||||
"*.pm",
|
||||
"*.t"
|
||||
],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
|
@ -1812,7 +1855,11 @@
|
|||
"type": "array",
|
||||
"title": "Extensions",
|
||||
"description": "The extensions to look for when determining if a folder is a Ruby workspace",
|
||||
"default": ["*.rb", "Rakefile", "Gemfile"]
|
||||
"default": [
|
||||
"*.rb",
|
||||
"Rakefile",
|
||||
"Gemfile"
|
||||
]
|
||||
},
|
||||
"folders": {
|
||||
"$ref": "#/definitions/folders"
|
||||
|
@ -1858,7 +1905,11 @@
|
|||
"type": "array",
|
||||
"title": "Extensions",
|
||||
"description": "The extensions to look for when determining if a folder is a Rust workspace",
|
||||
"default": ["*.rs", "Cargo.toml", "Cargo.lock"]
|
||||
"default": [
|
||||
"*.rs",
|
||||
"Cargo.toml",
|
||||
"Cargo.lock"
|
||||
]
|
||||
},
|
||||
"folders": {
|
||||
"$ref": "#/definitions/folders"
|
||||
|
@ -1904,7 +1955,9 @@
|
|||
"type": "array",
|
||||
"title": "Extensions",
|
||||
"description": "The extensions to look for when determining if a folder is a XMake workspace",
|
||||
"default": ["xmake.lua"],
|
||||
"default": [
|
||||
"xmake.lua"
|
||||
],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
|
@ -2564,7 +2617,10 @@
|
|||
"type": "array",
|
||||
"title": "Extensions",
|
||||
"description": "The extensions to look for when determining if a folder is a Quasar workspace",
|
||||
"default": ["quasar.config", "quasar.config.js"]
|
||||
"default": [
|
||||
"quasar.config",
|
||||
"quasar.config.js"
|
||||
]
|
||||
},
|
||||
"folders": {
|
||||
"$ref": "#/definitions/folders"
|
||||
|
@ -2890,13 +2946,13 @@
|
|||
"description": "Location to use for the API call interpreted only if valid coordinates aren't given. Formatted as <City>,<STATE>,<COUNTRY_CODE>. City name, state code and country code divided by comma. Please, refer to ISO 3166 for the state codes or country codes.",
|
||||
"default": "De Bilt,NL"
|
||||
},
|
||||
"latitude" : {
|
||||
"latitude": {
|
||||
"type": "number",
|
||||
"title": "Latitude",
|
||||
"description": "The latitude of the requested location, valid between -90 and 90",
|
||||
"default": 91
|
||||
},
|
||||
"longitude" : {
|
||||
"longitude": {
|
||||
"type": "number",
|
||||
"title": "Longitude",
|
||||
"description": "The longitude of the requested location, valid between -180 and 180",
|
||||
|
@ -2907,7 +2963,11 @@
|
|||
"title": "units",
|
||||
"description": "Units of measurement. Available values are standard (kelvin), metric (celsius), and imperial (fahrenheit). Default is standard",
|
||||
"default": "standard",
|
||||
"enum": ["standard", "metric", "imperial"]
|
||||
"enum": [
|
||||
"standard",
|
||||
"metric",
|
||||
"imperial"
|
||||
]
|
||||
},
|
||||
"http_timeout": {
|
||||
"$ref": "#/definitions/http_timeout"
|
||||
|
@ -2956,7 +3016,10 @@
|
|||
"type": "array",
|
||||
"title": "Extensions",
|
||||
"description": "The extensions to look for when determining if a folder is a Elixir workspace",
|
||||
"default": ["*.ex", "*.exs"],
|
||||
"default": [
|
||||
"*.ex",
|
||||
"*.exs"
|
||||
],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
|
@ -3179,7 +3242,9 @@
|
|||
"type": "array",
|
||||
"title": "Extensions",
|
||||
"description": "The extensions to look for when determining if the current directory is an Angular project",
|
||||
"default": ["angular.json"],
|
||||
"default": [
|
||||
"angular.json"
|
||||
],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
|
@ -3228,7 +3293,9 @@
|
|||
"type": "array",
|
||||
"title": "Extensions",
|
||||
"description": "The extensions to look for when determining if the current directory is a React project",
|
||||
"default": ["package.json"],
|
||||
"default": [
|
||||
"package.json"
|
||||
],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
|
@ -3277,7 +3344,10 @@
|
|||
"type": "array",
|
||||
"title": "Extensions",
|
||||
"description": "The extensions to look for when determining if the current directory is an Nx project",
|
||||
"default": ["workspace.json", "nx.json"],
|
||||
"default": [
|
||||
"workspace.json",
|
||||
"nx.json"
|
||||
],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
|
@ -3696,7 +3766,11 @@
|
|||
"type": "string",
|
||||
"title": "Use Stack GHC",
|
||||
"description": "Get the GHC version used by Stack. Will decrease performance. Boolean indicating whether stack ghc was used available in template as .StackGhc",
|
||||
"enum": ["always", "package", "never"],
|
||||
"enum": [
|
||||
"always",
|
||||
"package",
|
||||
"never"
|
||||
],
|
||||
"default": "never"
|
||||
},
|
||||
"extensions": {
|
||||
|
@ -3781,7 +3855,9 @@
|
|||
"type": "array",
|
||||
"title": "Extensions",
|
||||
"description": "The extensions to look for when determining if the current directory is a UI5 project",
|
||||
"default": ["*ui5*.y*ml"],
|
||||
"default": [
|
||||
"*ui5*.y*ml"
|
||||
],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
|
@ -3874,7 +3950,9 @@
|
|||
"type": "array",
|
||||
"title": "Extensions",
|
||||
"description": "The extensions to look for when determining if the current directory is a Vala project",
|
||||
"default": ["*.vala"],
|
||||
"default": [
|
||||
"*.vala"
|
||||
],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
|
@ -3923,7 +4001,10 @@
|
|||
"type": "array",
|
||||
"title": "Extensions",
|
||||
"description": "The extensions to look for when determining if the current directory is a Cloud Foundry project",
|
||||
"default": ["manifest.yml", "mta.yaml"],
|
||||
"default": [
|
||||
"manifest.yml",
|
||||
"mta.yaml"
|
||||
],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
|
@ -4001,7 +4082,11 @@
|
|||
"type": "array",
|
||||
"title": "Extensions",
|
||||
"description": "The extensions to look for when determining if the current directory is a Kotlin project",
|
||||
"default": ["*.kt", "*.kts", "*.ktm"],
|
||||
"default": [
|
||||
"*.kt",
|
||||
"*.kts",
|
||||
"*.ktm"
|
||||
],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
|
@ -4099,14 +4184,20 @@
|
|||
"type": "string",
|
||||
"title": "Preferred Executable",
|
||||
"description": "The preferred executable to use when fetching the version.",
|
||||
"enum": ["lua", "luajit"],
|
||||
"enum": [
|
||||
"lua",
|
||||
"luajit"
|
||||
],
|
||||
"default": "lua"
|
||||
},
|
||||
"extensions": {
|
||||
"type": "array",
|
||||
"title": "Extensions",
|
||||
"description": "The extensions to look for when determining if the current directory is a Lua project",
|
||||
"default": ["*.lua", "*.rockspec"],
|
||||
"default": [
|
||||
"*.lua",
|
||||
"*.rockspec"
|
||||
],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
|
@ -4155,7 +4246,10 @@
|
|||
"type": "array",
|
||||
"title": "Extensions",
|
||||
"description": "The extensions to look for when determining if the current directory is a Swift project",
|
||||
"default": ["*.swift", "*.SWIFT"],
|
||||
"default": [
|
||||
"*.swift",
|
||||
"*.SWIFT"
|
||||
],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
|
@ -4204,7 +4298,11 @@
|
|||
"type": "array",
|
||||
"title": "Extensions",
|
||||
"description": "The extensions to look for when determining if the current directory is a CDS project",
|
||||
"default": [".cdsrc.json", ".cdsrc-private.json", "*.cds"],
|
||||
"default": [
|
||||
".cdsrc.json",
|
||||
".cdsrc-private.json",
|
||||
"*.cds"
|
||||
],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
|
@ -4399,7 +4497,9 @@
|
|||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"type": { "const": "umbraco" }
|
||||
"type": {
|
||||
"const": "umbraco"
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
|
@ -4587,6 +4687,18 @@
|
|||
"accent_color": {
|
||||
"title": "Accent color",
|
||||
"$ref": "#/definitions/color"
|
||||
},
|
||||
"iterm_features": {
|
||||
"type": "array",
|
||||
"title": "The iTerm2 features to enable",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"prompt_mark",
|
||||
"current_dir",
|
||||
"remote_host"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,17 +126,18 @@ For example, the following is a valid `--config` flag:
|
|||
|
||||
## General Settings
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `final_space` | `boolean` | when true adds a space at the end of the prompt |
|
||||
| `pwd` | `string` | notify terminal of current working directory, values can be `osc99`, `osc7` or `osc51` depending on your terminal. Supports [templates][templates] |
|
||||
| `terminal_background` | `string` | [color][colors] - terminal background color, set to your terminal's background color when you notice black elements in Windows Terminal or the Visual Studio Code integrated terminal |
|
||||
| `accent_color` | `string` | [color][colors] - accent color, used as a fallback when the `accent` [color][accent] is not supported |
|
||||
| `var` | `map[string]any` | config variables to use in [templates][templates]. Can be any value |
|
||||
| `shell_integration` | `boolean` | enable shell integration using FinalTerm's OSC sequences. Works in bash, cmd (Clink v1.14.25+), fish, powershell and zsh |
|
||||
| `disable_cursor_positioning` | `boolean` | disable fetching the cursor position in bash and zsh in case of unwanted side-effects |
|
||||
| `patch_pwsh_bleed` | `boolean` | patch a PowerShell bug where the background colors bleed into the next line at the end of the buffer (can be removed when [this][pwsh-bleed] is merged) |
|
||||
| `disable_notice` | `boolean` | disable the upgrade notice |
|
||||
| Name | Type | Description |
|
||||
| ---------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `final_space` | `boolean` | when true adds a space at the end of the prompt |
|
||||
| `pwd` | `string` | notify terminal of current working directory, values can be `osc99`, `osc7` or `osc51` depending on your terminal. Supports [templates][templates] |
|
||||
| `terminal_background` | `string` | [color][colors] - terminal background color, set to your terminal's background color when you notice black elements in Windows Terminal or the Visual Studio Code integrated terminal |
|
||||
| `accent_color` | `string` | [color][colors] - accent color, used as a fallback when the `accent` [color][accent] is not supported |
|
||||
| `var` | `map[string]any` | config variables to use in [templates][templates]. Can be any value |
|
||||
| `shell_integration` | `boolean` | enable shell integration using FinalTerm's OSC sequences. Works in bash, cmd (Clink v1.14.25+), fish, powershell and zsh |
|
||||
| `disable_cursor_positioning` | `boolean` | disable fetching the cursor position in bash and zsh in case of unwanted side-effects |
|
||||
| `patch_pwsh_bleed` | `boolean` | patch a PowerShell bug where the background colors bleed into the next line at the end of the buffer (can be removed when [this][pwsh-bleed] is merged) |
|
||||
| `disable_notice` | `boolean` | disable the upgrade notice |
|
||||
| `iterm_features` | `[]string` | enable iTerm2 specific features:<ul><li>`prompt_mark`: add the `iterm2_prompt_mark` [function][iterm2-si] for supported shells</li><li>`current_dir`: expose the current directory for iTerm2</li><li>`remote_host`: expose the current remote and user for iTerm2</li></ul> |
|
||||
|
||||
### JSON Schema Validation
|
||||
|
||||
|
@ -191,3 +192,4 @@ Converters won't catch this change, so you will need to adjust manually.
|
|||
[accent]: /docs/configuration/colors#standard-colors
|
||||
[templates]: /docs/configuration/templates#config-variables
|
||||
[pwsh-bleed]: https://github.com/PowerShell/PowerShell/pull/19019
|
||||
[iterm2-si]: https://iterm2.com/documentation-shell-integration.html
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
---
|
||||
id: iterm
|
||||
title: iTerm
|
||||
sidebar_label: iTerm
|
||||
---
|
||||
|
||||
## What
|
||||
|
||||
Inserts iTerm2 shell integration prompt marks and extensions. This segment has no visible output
|
||||
but is used to enable iTerm2 terminal features.
|
||||
For more information, read the [shell integration][int-page] and [extension page][ext-page] on
|
||||
the developer's website.
|
||||
|
||||
:::info PromptMark in Bash and ZSH
|
||||
You will need to add `export ITERM2_SQUELCH_MARK=1` before the shell integration script is sourced.
|
||||
:::
|
||||
|
||||
:::info PromptMark in Fish shell
|
||||
For fish, you can make use of Oh My Posh's `set_poshcontext` function to set the prompt mark. Add the
|
||||
following line after initialising Oh My Posh:
|
||||
|
||||
```fish
|
||||
function set_poshcontext
|
||||
iterm2_prompt_mark
|
||||
end
|
||||
```
|
||||
|
||||
You do not need to add this segment to use the prompt mark.
|
||||
:::
|
||||
|
||||
## Sample Configuration
|
||||
|
||||
import Config from "@site/src/components/Config.js";
|
||||
|
||||
<Config
|
||||
data={{
|
||||
type: "iterm",
|
||||
interactive: true,
|
||||
style: "plain",
|
||||
foreground: "#80ffea",
|
||||
template: "{{ .PromptMark }}",
|
||||
}}
|
||||
/>
|
||||
|
||||
## Template ([info][templates])
|
||||
|
||||
:::note default template
|
||||
|
||||
```template
|
||||
{{ .PromptMark }}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Properties
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------------- | -------- | --------------------------------------------------- |
|
||||
| `.PromptMark` | `string` | inserts the prompt mark to enable shell integration |
|
||||
| `.CurrentDir` | `string` | inserts the current directory |
|
||||
| `.RemoteHost` | `string` | inserts the current user and host name |
|
||||
|
||||
[templates]: /docs/configuration/templates
|
||||
[int-page]: https://iterm2.com/documentation-shell-integration.html
|
||||
[ext-page]: https://iterm2.com/documentation-escape-codes.html
|
|
@ -84,7 +84,6 @@ module.exports = {
|
|||
"segments/haskell",
|
||||
"segments/helm",
|
||||
"segments/ipify",
|
||||
"segments/iterm",
|
||||
"segments/java",
|
||||
"segments/julia",
|
||||
"segments/kotlin",
|
||||
|
|
Loading…
Reference in a new issue