-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
1 parent
391ceaf
commit e7a10ac
Showing
13 changed files
with
248 additions
and
255 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.