Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
O
oh-my-fish
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
oh-my-fish
Commits
d33d8cbf
Commit
d33d8cbf
authored
Sep 05, 2015
by
Bruno
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9 from oh-my-fish/refactoring
Beginning of many PRs to clean up the code
parents
55aa2de7
b36bc03e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
23 deletions
+17
-23
init.fish
init.fish
+12
-21
lib/autoload.fish
lib/autoload.fish
+3
-1
pkg/omf/omf.fish
pkg/omf/omf.fish
+2
-1
No files found.
init.fish
View file @
d33d8cbf
...
@@ -9,40 +9,32 @@
...
@@ -9,40 +9,32 @@
# + Emit init_<pkg> event
# + Emit init_<pkg> event
#
#
# + Autoload {$OMF_PATH,$OMF_CONFIG}/functions
# + Autoload {$OMF_PATH,$OMF_CONFIG}/functions
# + Source {$OMF_PATH,$OMF_CONFIG}/events
# + Source $OMF_CONFIG/init.fish
# + Source $OMF_CONFIG/init.fish
#
#
# ENV
# ENV
# OSTYPE Operating system.
# OSTYPE Operating system.
#
RESET_PATH
Original $PATH preseved across Oh My Fish reloads.
#
ORIGINAL_PATH
Original $PATH preseved across Oh My Fish reloads.
# OMF_PATH
Set in ~/.config/fish/config.fish
# OMF_PATH
~/.local/share/omf by default.
# OMF_IGNORE List of packages to ignore.
# OMF_IGNORE List of packages to ignore.
# OMF_CONFIG
Same as OMF_PATH. ~/.dotfiles
by default.
# OMF_CONFIG
~/.config/omf
by default.
# OMF_VERSION Oh My Fish! version
# OMF_VERSION Oh My Fish! version
if set -q RESET_PATH
# Save PATH before oh my fish for reseting the PATH when we reload OMF.
set PATH $RESET_PATH
if set -q ORIGINAL_PATH
set PATH $ORIGINAL_PATH
else
else
set -gx
RESET
_PATH $PATH
set -gx
ORIGINAL
_PATH $PATH
end
end
set -q OSTYPE; or set -g OSTYPE (uname)
# Save the head of function path and autoload core functions
# Save the head of function path and autoload core functions
set -l user_function_path $fish_function_path[1]
set -l user_function_path $fish_function_path[1]
set fish_function_path[1] $OMF_PATH/lib
set fish_function_path[1] $OMF_PATH/lib
set -l theme {$OMF_PATH,$OMF_CONFIG}/themes/(cat $OMF_CONFIG/theme)
set -l theme {$OMF_PATH,$OMF_CONFIG}/themes/(cat $OMF_CONFIG/theme)
set -l paths $OMF_PATH/pkg/*
set -l config $OMF_CONFIG/pkg/*
set -l ignore $OMF_IGNORE
for path in $paths
for path in $OMF_PATH/lib $OMF_PATH/lib/git {$OMF_PATH,$OMF_CONFIG}/pkg/* $theme
set config $OMF_CONFIG/(basename $path) $config
contains -- (basename $path) $OMF_IGNORE; and continue
end
for path in $OMF_PATH/lib $OMF_PATH/lib/git $paths $theme $config
contains -- (basename $path) $ignore; and continue
autoload $path $path/completions
autoload $path $path/completions
source $path/(basename $path).fish ^/dev/null
source $path/(basename $path).fish ^/dev/null
and emit init_(basename $path) $path
and emit init_(basename $path) $path
...
@@ -51,8 +43,7 @@ end
...
@@ -51,8 +43,7 @@ end
autoload $OMF_CONFIG/functions
autoload $OMF_CONFIG/functions
autoload $user_function_path
autoload $user_function_path
for path in {$OMF_PATH,$OMF_CONFIG}/events.fish $OMF_CONFIG/init.fish
# Source custom init.fish file
source $path ^/dev/null
source $OMF_CONFIG/init.fish ^/dev/null
end
set -g OMF_VERSION "1.0.0"
set -g OMF_VERSION "1.0.0"
lib/autoload.fish
View file @
d33d8cbf
...
@@ -10,9 +10,11 @@ function autoload -d "autoload a function or completion path"
...
@@ -10,9 +10,11 @@ function autoload -d "autoload a function or completion path"
for path in $argv
for path in $argv
if test -d "$path"
if test -d "$path"
set -l dest fish_function_path
set -l dest fish_function_path
if test (basename "$path") = "completions"
if test (basename "$path") = completions
set dest fish_complete_path
set dest fish_complete_path
end
end
contains "$path" $$dest; or set $dest "$path" $$dest
contains "$path" $$dest; or set $dest "$path" $$dest
end
end
end
end
...
...
pkg/omf/omf.fish
View file @
d33d8cbf
...
@@ -97,9 +97,10 @@ function omf -d "Oh My Fish"
...
@@ -97,9 +97,10 @@ function omf -d "Oh My Fish"
case "t" "theme"
case "t" "theme"
if test (count $argv) -eq 1
if test (count $argv) -eq 1
set -l ostype (uname)
set -l theme (cat $OMF_CONFIG/theme)
set -l theme (cat $OMF_CONFIG/theme)
set -l regex "[[:<:]]($theme)[[:>:]]"
set -l regex "[[:<:]]($theme)[[:>:]]"
test "$
OSTYPE
" != "Darwin"; and set regex "\b($theme)\b"
test "$
ostype
" != "Darwin"; and set regex "\b($theme)\b"
omf.list_themes | column | sed -E "s/$regex/"(omf::em)"\1"(omf::off)"/"
omf.list_themes | column | sed -E "s/$regex/"(omf::em)"\1"(omf::off)"/"
omf::off
omf::off
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment