Additional dotfiles
This commit is contained in:
@@ -4,9 +4,12 @@ alias tt="watson"
|
|||||||
alias c="clear"
|
alias c="clear"
|
||||||
alias l="ls --color"
|
alias l="ls --color"
|
||||||
alias in="sudo dnf install -y"
|
alias in="sudo dnf install -y"
|
||||||
|
alias rein="sudo dnf reinstall -y"
|
||||||
alias se="sudo dnf search"
|
alias se="sudo dnf search"
|
||||||
alias re="sudo dnf remove"
|
alias re="sudo dnf remove"
|
||||||
alias up="sudo dnf update"
|
alias up="sudo dnf update"
|
||||||
|
alias sys="sudo systemctl"
|
||||||
|
alias sysu="systemctl --user"
|
||||||
|
|
||||||
alias nv="nvim"
|
alias nv="nvim"
|
||||||
|
|
||||||
@@ -19,3 +22,6 @@ alias kittyconf="nvim ~/dotfiles/.config/kitty/kitty.conf"
|
|||||||
alias fishconf="nvim ~/dotfiles/.config/fish/config.fish"
|
alias fishconf="nvim ~/dotfiles/.config/fish/config.fish"
|
||||||
alias roficonf="nvim ~/dotfiles/.config/rofi/config.rasi"
|
alias roficonf="nvim ~/dotfiles/.config/rofi/config.rasi"
|
||||||
alias nvimconf="nvim ~/dotfiles/.config/nvim/init.lua"
|
alias nvimconf="nvim ~/dotfiles/.config/nvim/init.lua"
|
||||||
|
|
||||||
|
alias gosteam="cd ~/.local/share/Steam/steamapps/common/"
|
||||||
|
alias reload="source ~/.config/fish/config.fish"
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
complete --command fisher --exclusive --long help --description "Print help"
|
||||||
|
complete --command fisher --exclusive --long version --description "Print version"
|
||||||
|
complete --command fisher --exclusive --condition __fish_use_subcommand --arguments install --description "Install plugins"
|
||||||
|
complete --command fisher --exclusive --condition __fish_use_subcommand --arguments update --description "Update installed plugins"
|
||||||
|
complete --command fisher --exclusive --condition __fish_use_subcommand --arguments remove --description "Remove installed plugins"
|
||||||
|
complete --command fisher --exclusive --condition __fish_use_subcommand --arguments list --description "List installed plugins matching regex"
|
||||||
|
complete --command fisher --exclusive --condition "__fish_seen_subcommand_from update remove" --arguments "(fisher list)"
|
||||||
@@ -0,0 +1,243 @@
|
|||||||
|
# Defines autocompletion for SDKMAN!
|
||||||
|
|
||||||
|
# Copyright (c) 2018-2023 Raphael Reitzig
|
||||||
|
# MIT License (MIT)
|
||||||
|
# https://github.com/reitzig/sdkman-for-fish
|
||||||
|
|
||||||
|
# Guard: SDKMAN! needs to be installed
|
||||||
|
if not test -f "$SDKMAN_DIR/bin/sdkman-init.sh"
|
||||||
|
exit 0
|
||||||
|
end
|
||||||
|
|
||||||
|
# # # # # #
|
||||||
|
# Completion trigger predicates
|
||||||
|
# # # # # #
|
||||||
|
|
||||||
|
# Test if there is no command
|
||||||
|
function __fish_sdkman_no_command
|
||||||
|
set cmd (commandline -opc)
|
||||||
|
|
||||||
|
if [ (count $cmd) -eq 1 ]
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
# Test if the main command matches one of the parameters
|
||||||
|
function __fish_sdkman_using_command
|
||||||
|
set cmd (commandline -opc)
|
||||||
|
|
||||||
|
if [ (count $cmd) -eq 2 ]
|
||||||
|
if contains $cmd[2] $argv
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish_sdkman_specifying_candidate
|
||||||
|
set cmd (commandline -opc)
|
||||||
|
|
||||||
|
if [ (count $cmd) -eq 3 ] # currently, sdk does not support multiple versions
|
||||||
|
if contains $cmd[2] $argv
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish_sdkman_command_has_enough_parameters
|
||||||
|
set cmd (commandline -opc)
|
||||||
|
|
||||||
|
if [ (count $cmd) -ge (math $argv[1] + 2) ]; and contains $cmd[2] $argv[2..-1]
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
# # # # # #
|
||||||
|
# Data collectors
|
||||||
|
# # # # # #
|
||||||
|
|
||||||
|
function __fish_sdkman_candidates
|
||||||
|
cat "$SDKMAN_DIR"/var/candidates | string replace -a -r ',' '\n'
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish_sdkman_candidates_with_versions
|
||||||
|
set regexpHome (string replace -a '/' '\\/' "$HOME/")
|
||||||
|
|
||||||
|
find "$SDKMAN_DIR"/candidates/ -mindepth 2 -maxdepth 2 -name '*current' \
|
||||||
|
| awk -F '/' '{ print $(NF-1) }' \
|
||||||
|
| sort -u
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish_sdkman_installed_versions
|
||||||
|
set cmd (commandline -opc)
|
||||||
|
if [ -d "$SDKMAN_DIR"/candidates/$cmd[3]/current ]
|
||||||
|
ls -v1 "$SDKMAN_DIR"/candidates/$cmd[3] | grep -v current
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# # # # # #
|
||||||
|
# Completion specification
|
||||||
|
# # # # # #
|
||||||
|
|
||||||
|
# install
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'i install' \
|
||||||
|
-d 'Install new version'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command i install' \
|
||||||
|
-a "(__fish_sdkman_candidates)"
|
||||||
|
# TODO complete available versions --> issue #4
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_specifying_candidate i install' \
|
||||||
|
-a 'a.b.c' \
|
||||||
|
-d "version list unavailable"
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_specifying_candidate i install' \
|
||||||
|
-a 'x.y.z' \
|
||||||
|
-d "Specify path to install custom version."
|
||||||
|
# Implicit: complete files as fourth parameter
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 3 i install'
|
||||||
|
# block
|
||||||
|
|
||||||
|
# uninstall
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'rm uninstall' -d 'Uninstall version'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command rm uninstall' \
|
||||||
|
-a "(__fish_sdkman_candidates_with_versions)"
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_specifying_candidate rm uninstall' \
|
||||||
|
-a "(__fish_sdkman_installed_versions)"
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 2 rm uninstall'
|
||||||
|
# block
|
||||||
|
|
||||||
|
# list
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'ls list' \
|
||||||
|
-d 'List versions'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command ls list' \
|
||||||
|
-a "(__fish_sdkman_candidates)"
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 ls list'
|
||||||
|
# block
|
||||||
|
|
||||||
|
# use
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'u use' \
|
||||||
|
-d 'Use specific version'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command u use' \
|
||||||
|
-a "(__fish_sdkman_candidates_with_versions)"
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_specifying_candidate u use' \
|
||||||
|
-a "(__fish_sdkman_installed_versions)"
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 2 u use'
|
||||||
|
# block
|
||||||
|
|
||||||
|
# default
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'd default' \
|
||||||
|
-d 'Set default version'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command d default' \
|
||||||
|
-a "(__fish_sdkman_candidates_with_versions)"
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_specifying_candidate d default' \
|
||||||
|
-a "(__fish_sdkman_installed_versions)"
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 2 d default'
|
||||||
|
# block
|
||||||
|
|
||||||
|
# current
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'c current' \
|
||||||
|
-d 'Display current version'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command c current' \
|
||||||
|
-a "(__fish_sdkman_candidates)"
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 c current'
|
||||||
|
# block
|
||||||
|
|
||||||
|
# upgrade
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'ug upgrade' \
|
||||||
|
-d 'Display what is outdated'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command ug upgrade' \
|
||||||
|
-a "(__fish_sdkman_candidates_with_versions)"
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 ug upgrade'
|
||||||
|
# block
|
||||||
|
|
||||||
|
# version
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'v version' \
|
||||||
|
-d 'Display version'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 0 v version'
|
||||||
|
# block
|
||||||
|
|
||||||
|
# help
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'help' \
|
||||||
|
-d 'Display help message'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 0 h help'
|
||||||
|
# block
|
||||||
|
|
||||||
|
# offline
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'offline' \
|
||||||
|
-d 'Set offline status'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command offline' \
|
||||||
|
-a 'enable' \
|
||||||
|
-d 'Make sdk work while offline'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command offline' \
|
||||||
|
-a 'disable' \
|
||||||
|
-d 'Turn on all features'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 offline'
|
||||||
|
# block
|
||||||
|
|
||||||
|
# selfupdate
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'selfupdate' \
|
||||||
|
-d 'Update sdk'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command selfupdate' \
|
||||||
|
-a 'force' \
|
||||||
|
-d 'Force re-install of current version'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 selfupdate'
|
||||||
|
# block
|
||||||
|
|
||||||
|
# update
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'update' \
|
||||||
|
-d 'Reload the candidate list'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 0 update'
|
||||||
|
# block
|
||||||
|
|
||||||
|
# flush
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'flush' \
|
||||||
|
-d 'Clear out archives and temporary storage folders'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command flush' \
|
||||||
|
-a 'temp' \
|
||||||
|
-d 'Clear out staging work folder'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command flush' \
|
||||||
|
-a 'version' \
|
||||||
|
-d 'Flush version file'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 flush'
|
||||||
|
# block
|
||||||
|
|
||||||
|
# env
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'e env' \
|
||||||
|
-d 'Load environment from .sdkmanrc file'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command e env' \
|
||||||
|
-a 'init' \
|
||||||
|
-d 'Initialize .sdkmanrc file'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command e env' \
|
||||||
|
-a 'install' \
|
||||||
|
-d 'Install all candidate versions listed in .sdkmanrc'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command e env' \
|
||||||
|
-a 'clear' \
|
||||||
|
-d 'Unload currently loaded environment'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 e env'
|
||||||
|
# block
|
||||||
|
|
||||||
|
# home
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'h home' \
|
||||||
|
-d 'Show installation folder of given candidate'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command h home' \
|
||||||
|
-a "(__fish_sdkman_candidates_with_versions)"
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_specifying_candidate h home' \
|
||||||
|
-a "(__fish_sdkman_installed_versions)"
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 2 h home'
|
||||||
|
# block
|
||||||
@@ -1 +0,0 @@
|
|||||||
source "$HOME/.cargo/env.fish"
|
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
#!/usr/bin/fish
|
||||||
|
|
||||||
|
# Makes command and binaries from SDKMAN! available in fish.
|
||||||
|
# Delegates to bash for the `sdk` command.
|
||||||
|
|
||||||
|
# Copyright (c) 2018-2023 Raphael Reitzig
|
||||||
|
# MIT License (MIT)
|
||||||
|
# https://github.com/reitzig/sdkman-for-fish
|
||||||
|
|
||||||
|
# Account for custom install locations
|
||||||
|
if set -q __sdkman_custom_dir
|
||||||
|
set -gx SDKMAN_DIR "$__sdkman_custom_dir"
|
||||||
|
end
|
||||||
|
# Guard: SDKMAN! needs to be installed
|
||||||
|
if set -q SDKMAN_DIR; and not test -f "$SDKMAN_DIR/bin/sdkman-init.sh"
|
||||||
|
echo "WARNING: SDKMAN! installation path set to $SDKMAN_DIR, but no installation found there"
|
||||||
|
exit 0
|
||||||
|
end
|
||||||
|
|
||||||
|
# Unless overridden, use the default location:
|
||||||
|
if not set -q SDKMAN_DIR
|
||||||
|
set -gx SDKMAN_DIR "$HOME/.sdkman"
|
||||||
|
end
|
||||||
|
|
||||||
|
set __fish_sdkman_init "$SDKMAN_DIR/bin/sdkman-init.sh"
|
||||||
|
|
||||||
|
# Guard: SDKMAN! needs to be installed
|
||||||
|
if not test -f "$__fish_sdkman_init"
|
||||||
|
exit 0
|
||||||
|
end
|
||||||
|
|
||||||
|
# Copied from https://github.com/jorgebucaran/fisher/blob/main/functions/fisher.fish to be consistent:
|
||||||
|
set --query fisher_path || set --local fisher_path $__fish_config_dir
|
||||||
|
set __fish_sdkman_noexport_init "$fisher_path/functions/__sdkman-noexport-init.sh"
|
||||||
|
|
||||||
|
# Hack for issue #19:
|
||||||
|
# Create version of sdkman-init that doesn't export any environment variables.
|
||||||
|
# Refresh if sdkman-init changed.
|
||||||
|
if begin not test -f "$__fish_sdkman_noexport_init";
|
||||||
|
or env test "$__fish_sdkman_init" -nt "$__fish_sdkman_noexport_init"
|
||||||
|
end
|
||||||
|
mkdir -p (dirname $__fish_sdkman_noexport_init)
|
||||||
|
sed -E -e 's/^(\s*).*(export|to_path).*$/\1:/g' "$__fish_sdkman_init" \
|
||||||
|
> "$__fish_sdkman_noexport_init"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Runs the given command in bash, capturing some side effects
|
||||||
|
# and repeating them on the current fish shell.
|
||||||
|
# Returns the same status code as the given command.
|
||||||
|
function __fish_sdkman_run_in_bash
|
||||||
|
# We need to leave stdin and stdout of sdk free for user interaction.
|
||||||
|
# So, pipe relevant environment variables (which might have changed)
|
||||||
|
# through a file.
|
||||||
|
# But since now getting the exit code of sdk itself is a hassle,
|
||||||
|
# pipe it as well.
|
||||||
|
#
|
||||||
|
# TODO: Can somebody get this to work without the overhead of a file?
|
||||||
|
set pipe (mktemp)
|
||||||
|
bash -c "$argv[1];
|
||||||
|
echo -e \"\$?\" > $pipe;
|
||||||
|
env | grep -e '^SDKMAN_\|^PATH' >> $pipe;
|
||||||
|
env | grep -i -E \"^(`echo \${SDKMAN_CANDIDATES_CSV} | sed 's/,/|/g'`)_HOME\" >> $pipe;
|
||||||
|
echo \"SDKMAN_OFFLINE_MODE=\${SDKMAN_OFFLINE_MODE}\" >> $pipe;
|
||||||
|
echo \"SDKMAN_ENV=\${SDKMAN_ENV}\" >> $pipe" # it's not an environment variable!
|
||||||
|
set bashDump (cat $pipe; rm $pipe)
|
||||||
|
|
||||||
|
set sdkStatus $bashDump[1]
|
||||||
|
set bashEnv $bashDump[2..-1]
|
||||||
|
|
||||||
|
# If SDKMAN! succeeded, copy relevant environment variables
|
||||||
|
# to the current shell (they might have changed)
|
||||||
|
if [ $sdkStatus = 0 ]
|
||||||
|
for line in $bashEnv
|
||||||
|
set parts (string split "=" $line)
|
||||||
|
set var $parts[1]
|
||||||
|
set value (string join "=" $parts[2..-1])
|
||||||
|
|
||||||
|
switch "$var"
|
||||||
|
case "PATH"
|
||||||
|
# Special treatment: need fish list instead
|
||||||
|
# of colon-separated list.
|
||||||
|
set value (string split : "$value")
|
||||||
|
end
|
||||||
|
|
||||||
|
if test -n value
|
||||||
|
set -gx $var $value
|
||||||
|
# Note: This makes SDKMAN_{OFFLINE_MODE,ENV} environment variables.
|
||||||
|
# That gives it the behaviour we _want_!
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return $sdkStatus
|
||||||
|
end
|
||||||
|
|
||||||
|
# If this is a subshell of a(n initialized) fish owned by the same user,
|
||||||
|
# no initialization necessary.
|
||||||
|
# Otherwise:
|
||||||
|
if not set -q SDKMAN_CANDIDATES_DIR; or test (ls -ld "$SDKMAN_CANDIDATES_DIR" | awk '{print $3}') != (whoami)
|
||||||
|
__fish_sdkman_run_in_bash "source $__fish_sdkman_init"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Set up auto_env
|
||||||
|
if grep -q "^sdkman_auto_env=true" "$SDKMAN_DIR/etc/config"
|
||||||
|
function __fish_sdkman_autoenv --on-variable PWD
|
||||||
|
# Run the (modified) init script, which performs the checks and calls for us!
|
||||||
|
__fish_sdkman_run_in_bash "source \"$__fish_sdkman_noexport_init\""
|
||||||
|
|
||||||
|
set -x SDKMAN_OLD_PWD "$PWD" # needed by the Bash implementation
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
jorgebucaran/fisher
|
||||||
|
reitzig/sdkman-for-fish@v2.1.0
|
||||||
@@ -1,6 +1,10 @@
|
|||||||
# This file contains fish universal variable definitions.
|
# This file contains fish universal variable definitions.
|
||||||
# VERSION: 3.0
|
# VERSION: 3.0
|
||||||
SETUVAR __fish_initialized:3800
|
SETUVAR __fish_initialized:3800
|
||||||
|
SETUVAR _fisher_jorgebucaran_2F_fisher_files:\x7e/\x2econfig/fish/functions/fisher\x2efish\x1e\x7e/\x2econfig/fish/completions/fisher\x2efish
|
||||||
|
SETUVAR _fisher_plugins:jorgebucaran/fisher\x1ereitzig/sdkman\x2dfor\x2dfish\x40v2\x2e1\x2e0
|
||||||
|
SETUVAR _fisher_reitzig_2F_sdkman_2D_for_2D_fish_40_v2_2E_31_2E_30__files:\x7e/\x2econfig/fish/functions/sdk\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/sdk\x2efish\x1e\x7e/\x2econfig/fish/completions/sdk\x2efish
|
||||||
|
SETUVAR _fisher_upgraded_to_4_4:\x1d
|
||||||
SETUVAR fish_color_autosuggestion:brblack
|
SETUVAR fish_color_autosuggestion:brblack
|
||||||
SETUVAR fish_color_cancel:\x2dr
|
SETUVAR fish_color_cancel:\x2dr
|
||||||
SETUVAR fish_color_command:blue
|
SETUVAR fish_color_command:blue
|
||||||
|
|||||||
@@ -0,0 +1,179 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2021 Marco Vermeulen
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
# set env vars if not set
|
||||||
|
if [ -z "$SDKMAN_CANDIDATES_API" ]; then
|
||||||
|
:
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$SDKMAN_BROKER_API" ]; then
|
||||||
|
:
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$SDKMAN_DIR" ]; then
|
||||||
|
:
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Load the sdkman config if it exists.
|
||||||
|
if [ -f "${SDKMAN_DIR}/etc/config" ]; then
|
||||||
|
source "${SDKMAN_DIR}/etc/config"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Read the platform file
|
||||||
|
SDKMAN_PLATFORM="$(cat "${SDKMAN_DIR}/var/platform")"
|
||||||
|
:
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
darwin=false
|
||||||
|
solaris=false
|
||||||
|
freebsd=false
|
||||||
|
SDKMAN_KERNEL="$(uname -s)"
|
||||||
|
case "${SDKMAN_KERNEL}" in
|
||||||
|
CYGWIN*)
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin*)
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
SunOS*)
|
||||||
|
solaris=true
|
||||||
|
;;
|
||||||
|
FreeBSD*)
|
||||||
|
freebsd=true
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Determine shell
|
||||||
|
zsh_shell=false
|
||||||
|
bash_shell=false
|
||||||
|
|
||||||
|
if [[ -n "$ZSH_VERSION" ]]; then
|
||||||
|
zsh_shell=true
|
||||||
|
elif [[ -n "$BASH_VERSION" ]]; then
|
||||||
|
bash_shell=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Source sdkman module scripts and extension files.
|
||||||
|
#
|
||||||
|
# Extension files are prefixed with 'sdkman-' and found in the ext/ folder.
|
||||||
|
# Use this if extensions are written with the functional approach and want
|
||||||
|
# to use functions in the main sdkman script. For more details, refer to
|
||||||
|
# <https://github.com/sdkman/sdkman-extensions>.
|
||||||
|
OLD_IFS="$IFS"
|
||||||
|
IFS=$'\n'
|
||||||
|
scripts=($(find "${SDKMAN_DIR}/src" "${SDKMAN_DIR}/ext" -type f -name 'sdkman-*.sh'))
|
||||||
|
for f in "${scripts[@]}"; do
|
||||||
|
source "$f"
|
||||||
|
done
|
||||||
|
IFS="$OLD_IFS"
|
||||||
|
unset OLD_IFS scripts f
|
||||||
|
|
||||||
|
# Create upgrade delay file if it doesn't exist
|
||||||
|
if [[ ! -f "${SDKMAN_DIR}/var/delay_upgrade" ]]; then
|
||||||
|
touch "${SDKMAN_DIR}/var/delay_upgrade"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# set curl connect-timeout and max-time
|
||||||
|
if [[ -z "$sdkman_curl_connect_timeout" ]]; then sdkman_curl_connect_timeout=7; fi
|
||||||
|
if [[ -z "$sdkman_curl_max_time" ]]; then sdkman_curl_max_time=10; fi
|
||||||
|
|
||||||
|
# set curl retry
|
||||||
|
if [[ -z "${sdkman_curl_retry}" ]]; then sdkman_curl_retry=0; fi
|
||||||
|
|
||||||
|
# set curl retry max time in seconds
|
||||||
|
if [[ -z "${sdkman_curl_retry_max_time}" ]]; then sdkman_curl_retry_max_time=60; fi
|
||||||
|
|
||||||
|
# set curl to continue downloading automatically
|
||||||
|
if [[ -z "${sdkman_curl_continue}" ]]; then sdkman_curl_continue=true; fi
|
||||||
|
|
||||||
|
# read list of candidates and set array
|
||||||
|
SDKMAN_CANDIDATES_CACHE="${SDKMAN_DIR}/var/candidates"
|
||||||
|
SDKMAN_CANDIDATES_CSV=$(<"$SDKMAN_CANDIDATES_CACHE")
|
||||||
|
__sdkman_echo_debug "Setting candidates csv: $SDKMAN_CANDIDATES_CSV"
|
||||||
|
if [[ "$zsh_shell" == 'true' ]]; then
|
||||||
|
SDKMAN_CANDIDATES=(${(s:,:)SDKMAN_CANDIDATES_CSV})
|
||||||
|
else
|
||||||
|
IFS=',' read -a SDKMAN_CANDIDATES <<< "${SDKMAN_CANDIDATES_CSV}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
:
|
||||||
|
|
||||||
|
for candidate_name in "${SDKMAN_CANDIDATES[@]}"; do
|
||||||
|
candidate_dir="${SDKMAN_CANDIDATES_DIR}/${candidate_name}/current"
|
||||||
|
if [[ -h "$candidate_dir" || -d "${candidate_dir}" ]]; then
|
||||||
|
:
|
||||||
|
:
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
unset candidate_name candidate_dir
|
||||||
|
:
|
||||||
|
|
||||||
|
# source completion scripts
|
||||||
|
if [[ "$sdkman_auto_complete" == 'true' ]]; then
|
||||||
|
if [[ "$zsh_shell" == 'true' ]]; then
|
||||||
|
# initialize zsh completions (if not already done)
|
||||||
|
if ! (( $+functions[compdef] )) ; then
|
||||||
|
autoload -Uz compinit
|
||||||
|
if [[ $ZSH_DISABLE_COMPFIX == 'true' ]]; then
|
||||||
|
compinit -u -C
|
||||||
|
else
|
||||||
|
compinit
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
autoload -U bashcompinit
|
||||||
|
bashcompinit
|
||||||
|
source "${SDKMAN_DIR}/contrib/completion/bash/sdk"
|
||||||
|
__sdkman_echo_debug "ZSH completion script loaded..."
|
||||||
|
elif [[ "$bash_shell" == 'true' ]]; then
|
||||||
|
source "${SDKMAN_DIR}/contrib/completion/bash/sdk"
|
||||||
|
__sdkman_echo_debug "Bash completion script loaded..."
|
||||||
|
else
|
||||||
|
__sdkman_echo_debug "No completion scripts found for $SHELL"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$sdkman_auto_env" == "true" ]]; then
|
||||||
|
if [[ "$zsh_shell" == "true" ]]; then
|
||||||
|
function sdkman_auto_env() {
|
||||||
|
if [[ -n $SDKMAN_ENV ]] && [[ ! $PWD =~ ^$SDKMAN_ENV ]]; then
|
||||||
|
sdk env clear
|
||||||
|
fi
|
||||||
|
if [[ -f .sdkmanrc ]]; then
|
||||||
|
sdk env
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
chpwd_functions+=(sdkman_auto_env)
|
||||||
|
else
|
||||||
|
function sdkman_auto_env() {
|
||||||
|
if [[ -n $SDKMAN_ENV ]] && [[ ! $PWD =~ ^$SDKMAN_ENV ]]; then
|
||||||
|
sdk env clear
|
||||||
|
fi
|
||||||
|
if [[ "$SDKMAN_OLD_PWD" != "$PWD" ]] && [[ -f ".sdkmanrc" ]]; then
|
||||||
|
sdk env
|
||||||
|
fi
|
||||||
|
|
||||||
|
:
|
||||||
|
}
|
||||||
|
|
||||||
|
trimmed_prompt_command="${PROMPT_COMMAND%"${PROMPT_COMMAND##*[![:space:]]}"}"
|
||||||
|
[[ -z "$trimmed_prompt_command" ]] && PROMPT_COMMAND="sdkman_auto_env" || PROMPT_COMMAND="${trimmed_prompt_command%\;};sdkman_auto_env"
|
||||||
|
fi
|
||||||
|
|
||||||
|
sdkman_auto_env
|
||||||
|
fi
|
||||||
@@ -0,0 +1,240 @@
|
|||||||
|
function fisher --argument-names cmd --description "A plugin manager for Fish"
|
||||||
|
set --query fisher_path || set --local fisher_path $__fish_config_dir
|
||||||
|
set --local fisher_version 4.4.5
|
||||||
|
set --local fish_plugins $__fish_config_dir/fish_plugins
|
||||||
|
|
||||||
|
switch "$cmd"
|
||||||
|
case -v --version
|
||||||
|
echo "fisher, version $fisher_version"
|
||||||
|
case "" -h --help
|
||||||
|
echo "Usage: fisher install <plugins...> Install plugins"
|
||||||
|
echo " fisher remove <plugins...> Remove installed plugins"
|
||||||
|
echo " fisher update <plugins...> Update installed plugins"
|
||||||
|
echo " fisher update Update all installed plugins"
|
||||||
|
echo " fisher list [<regex>] List installed plugins matching regex"
|
||||||
|
echo "Options:"
|
||||||
|
echo " -v, --version Print version"
|
||||||
|
echo " -h, --help Print this help message"
|
||||||
|
echo "Variables:"
|
||||||
|
echo " \$fisher_path Plugin installation path. Default: $__fish_config_dir" | string replace --regex -- $HOME \~
|
||||||
|
case ls list
|
||||||
|
string match --entire --regex -- "$argv[2]" $_fisher_plugins
|
||||||
|
case install update remove
|
||||||
|
isatty || read --local --null --array stdin && set --append argv $stdin
|
||||||
|
|
||||||
|
set --local install_plugins
|
||||||
|
set --local update_plugins
|
||||||
|
set --local remove_plugins
|
||||||
|
set --local arg_plugins $argv[2..-1]
|
||||||
|
set --local old_plugins $_fisher_plugins
|
||||||
|
set --local new_plugins
|
||||||
|
|
||||||
|
test -e $fish_plugins && set --local file_plugins (string match --regex -- '^[^\s]+$' <$fish_plugins | string replace -- \~ ~)
|
||||||
|
|
||||||
|
if ! set --query argv[2]
|
||||||
|
if test "$cmd" != update
|
||||||
|
echo "fisher: Not enough arguments for command: \"$cmd\"" >&2 && return 1
|
||||||
|
else if ! set --query file_plugins
|
||||||
|
echo "fisher: \"$fish_plugins\" file not found: \"$cmd\"" >&2 && return 1
|
||||||
|
end
|
||||||
|
set arg_plugins $file_plugins
|
||||||
|
end
|
||||||
|
|
||||||
|
for plugin in $arg_plugins
|
||||||
|
set plugin (test -e "$plugin" && realpath $plugin || string lower -- $plugin)
|
||||||
|
contains -- "$plugin" $new_plugins || set --append new_plugins $plugin
|
||||||
|
end
|
||||||
|
|
||||||
|
if set --query argv[2]
|
||||||
|
for plugin in $new_plugins
|
||||||
|
if contains -- "$plugin" $old_plugins
|
||||||
|
test "$cmd" = remove &&
|
||||||
|
set --append remove_plugins $plugin ||
|
||||||
|
set --append update_plugins $plugin
|
||||||
|
else if test "$cmd" = install
|
||||||
|
set --append install_plugins $plugin
|
||||||
|
else
|
||||||
|
echo "fisher: Plugin not installed: \"$plugin\"" >&2 && return 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
for plugin in $new_plugins
|
||||||
|
contains -- "$plugin" $old_plugins &&
|
||||||
|
set --append update_plugins $plugin ||
|
||||||
|
set --append install_plugins $plugin
|
||||||
|
end
|
||||||
|
|
||||||
|
for plugin in $old_plugins
|
||||||
|
contains -- "$plugin" $new_plugins || set --append remove_plugins $plugin
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
set --local pid_list
|
||||||
|
set --local source_plugins
|
||||||
|
set --local fetch_plugins $update_plugins $install_plugins
|
||||||
|
set --local fish_path (status fish-path)
|
||||||
|
|
||||||
|
echo (set_color --bold)fisher $cmd version $fisher_version(set_color normal)
|
||||||
|
|
||||||
|
for plugin in $fetch_plugins
|
||||||
|
set --local source (command mktemp -d)
|
||||||
|
set --append source_plugins $source
|
||||||
|
|
||||||
|
command mkdir -p $source/{completions,conf.d,themes,functions}
|
||||||
|
|
||||||
|
$fish_path --command "
|
||||||
|
if test -e $plugin
|
||||||
|
command cp -Rf $plugin/* $source
|
||||||
|
else
|
||||||
|
set temp (command mktemp -d)
|
||||||
|
set repo (string split -- \@ $plugin) || set repo[2] HEAD
|
||||||
|
|
||||||
|
if set path (string replace --regex -- '^(https://)?gitlab.com/' '' \$repo[1])
|
||||||
|
set name (string split -- / \$path)[-1]
|
||||||
|
set url https://gitlab.com/\$path/-/archive/\$repo[2]/\$name-\$repo[2].tar.gz
|
||||||
|
else
|
||||||
|
set url https://api.github.com/repos/\$repo[1]/tarball/\$repo[2]
|
||||||
|
end
|
||||||
|
|
||||||
|
echo Fetching (set_color --underline)\$url(set_color normal)
|
||||||
|
|
||||||
|
if command curl -q --silent -L \$url | command tar -xzC \$temp -f - 2>/dev/null
|
||||||
|
command cp -Rf \$temp/*/* $source
|
||||||
|
else
|
||||||
|
echo fisher: Invalid plugin name or host unavailable: \\\"$plugin\\\" >&2
|
||||||
|
command rm -rf $source
|
||||||
|
end
|
||||||
|
|
||||||
|
command rm -rf \$temp
|
||||||
|
end
|
||||||
|
|
||||||
|
set files $source/* && string match --quiet --regex -- .+\.fish\\\$ \$files
|
||||||
|
" &
|
||||||
|
|
||||||
|
set --append pid_list (jobs --last --pid)
|
||||||
|
end
|
||||||
|
|
||||||
|
wait $pid_list 2>/dev/null
|
||||||
|
|
||||||
|
for plugin in $fetch_plugins
|
||||||
|
if set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)] && test ! -e $source
|
||||||
|
if set --local index (contains --index -- "$plugin" $install_plugins)
|
||||||
|
set --erase install_plugins[$index]
|
||||||
|
else
|
||||||
|
set --erase update_plugins[(contains --index -- "$plugin" $update_plugins)]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for plugin in $update_plugins $remove_plugins
|
||||||
|
if set --local index (contains --index -- "$plugin" $_fisher_plugins)
|
||||||
|
set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files
|
||||||
|
|
||||||
|
if contains -- "$plugin" $remove_plugins
|
||||||
|
for name in (string replace --filter --regex -- '.+/conf\.d/([^/]+)\.fish$' '$1' $$plugin_files_var)
|
||||||
|
emit {$name}_uninstall
|
||||||
|
end
|
||||||
|
printf "%s\n" Removing\ (set_color red --bold)$plugin(set_color normal) " "$$plugin_files_var | string replace -- \~ ~
|
||||||
|
set --erase _fisher_plugins[$index]
|
||||||
|
end
|
||||||
|
|
||||||
|
command rm -rf (string replace -- \~ ~ $$plugin_files_var)
|
||||||
|
|
||||||
|
functions --erase (string replace --filter --regex -- '.+/functions/([^/]+)\.fish$' '$1' $$plugin_files_var)
|
||||||
|
|
||||||
|
for name in (string replace --filter --regex -- '.+/completions/([^/]+)\.fish$' '$1' $$plugin_files_var)
|
||||||
|
complete --erase --command $name
|
||||||
|
end
|
||||||
|
|
||||||
|
set --erase $plugin_files_var
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if set --query update_plugins[1] || set --query install_plugins[1]
|
||||||
|
command mkdir -p $fisher_path/{functions,themes,conf.d,completions}
|
||||||
|
end
|
||||||
|
|
||||||
|
for plugin in $update_plugins $install_plugins
|
||||||
|
set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)]
|
||||||
|
set --local files $source/{functions,themes,conf.d,completions}/*
|
||||||
|
|
||||||
|
if set --local index (contains --index -- $plugin $install_plugins)
|
||||||
|
set --local user_files $fisher_path/{functions,themes,conf.d,completions}/*
|
||||||
|
set --local conflict_files
|
||||||
|
|
||||||
|
for file in (string replace -- $source/ $fisher_path/ $files)
|
||||||
|
contains -- $file $user_files && set --append conflict_files $file
|
||||||
|
end
|
||||||
|
|
||||||
|
if set --query conflict_files[1] && set --erase install_plugins[$index]
|
||||||
|
echo -s "fisher: Cannot install \"$plugin\": please remove or move conflicting files first:" \n" "$conflict_files >&2
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for file in (string replace -- $source/ "" $files)
|
||||||
|
command cp -RLf $source/$file $fisher_path/$file
|
||||||
|
end
|
||||||
|
|
||||||
|
set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files
|
||||||
|
|
||||||
|
set --query files[1] && set --universal $plugin_files_var (string replace -- $source $fisher_path $files | string replace -- ~ \~)
|
||||||
|
|
||||||
|
contains -- $plugin $_fisher_plugins || set --universal --append _fisher_plugins $plugin
|
||||||
|
contains -- $plugin $install_plugins && set --local event install || set --local event update
|
||||||
|
|
||||||
|
printf "%s\n" Installing\ (set_color --bold)$plugin(set_color normal) " "$$plugin_files_var | string replace -- \~ ~
|
||||||
|
|
||||||
|
for file in (string match --regex -- '.+/[^/]+\.fish$' $$plugin_files_var | string replace -- \~ ~)
|
||||||
|
source $file
|
||||||
|
if set --local name (string replace --regex -- '.+conf\.d/([^/]+)\.fish$' '$1' $file)
|
||||||
|
emit {$name}_$event
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
command rm -rf $source_plugins
|
||||||
|
|
||||||
|
if set --query _fisher_plugins[1]
|
||||||
|
set --local commit_plugins
|
||||||
|
|
||||||
|
for plugin in $file_plugins
|
||||||
|
contains -- (string lower -- $plugin) (string lower -- $_fisher_plugins) && set --append commit_plugins $plugin
|
||||||
|
end
|
||||||
|
|
||||||
|
for plugin in $_fisher_plugins
|
||||||
|
contains -- (string lower -- $plugin) (string lower -- $commit_plugins) || set --append commit_plugins $plugin
|
||||||
|
end
|
||||||
|
|
||||||
|
string replace --regex -- $HOME \~ $commit_plugins >$fish_plugins
|
||||||
|
else
|
||||||
|
set --erase _fisher_plugins
|
||||||
|
command rm -f $fish_plugins
|
||||||
|
end
|
||||||
|
|
||||||
|
set --local total (count $install_plugins) (count $update_plugins) (count $remove_plugins)
|
||||||
|
|
||||||
|
test "$total" != "0 0 0" && echo (string join ", " (
|
||||||
|
test $total[1] = 0 || echo "Installed $total[1]") (
|
||||||
|
test $total[2] = 0 || echo "Updated $total[2]") (
|
||||||
|
test $total[3] = 0 || echo "Removed $total[3]")
|
||||||
|
) plugin/s
|
||||||
|
case \*
|
||||||
|
echo "fisher: Unknown command: \"$cmd\"" >&2 && return 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if ! set --query _fisher_upgraded_to_4_4
|
||||||
|
set --universal _fisher_upgraded_to_4_4
|
||||||
|
if functions --query _fisher_list
|
||||||
|
set --query XDG_DATA_HOME[1] || set --local XDG_DATA_HOME ~/.local/share
|
||||||
|
command rm -rf $XDG_DATA_HOME/fisher
|
||||||
|
functions --erase _fisher_{list,plugin_parse}
|
||||||
|
fisher update >/dev/null 2>/dev/null
|
||||||
|
else
|
||||||
|
for var in (set --names | string match --entire --regex '^_fisher_.+_files$')
|
||||||
|
set $var (string replace -- ~ \~ $$var)
|
||||||
|
end
|
||||||
|
functions --erase _fisher_fish_postexec
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
# Wrapper function for SDKMAN!
|
||||||
|
|
||||||
|
# Copyright (c) 2018-2023 Raphael Reitzig
|
||||||
|
# MIT License (MIT)
|
||||||
|
# https://github.com/reitzig/sdkman-for-fish
|
||||||
|
|
||||||
|
function sdk -d "Manage SDKs"
|
||||||
|
# Guard: SDKMAN! needs to be installed
|
||||||
|
if not test -f "$__fish_sdkman_init"
|
||||||
|
# Propose to install SDKMAN!
|
||||||
|
|
||||||
|
function read_confirm
|
||||||
|
while true
|
||||||
|
read -l -P "$argv[1] [y/N] " confirm
|
||||||
|
|
||||||
|
switch $confirm
|
||||||
|
case Y y
|
||||||
|
return 0
|
||||||
|
case '' N n
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if read_confirm "You don't seem to have SDKMAN! installed. Install now?"
|
||||||
|
if not which curl > /dev/null
|
||||||
|
echo "curl required"
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
if not which bash > /dev/null
|
||||||
|
echo "bash required"
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
curl -s "https://get.sdkman.io" | bash | sed '/All done!/q'
|
||||||
|
echo "Please open a new terminal/shell to load SDKMAN!"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
# Declare the _actual_ sdk command for fish
|
||||||
|
__fish_sdkman_run_in_bash "source \"$__fish_sdkman_noexport_init\" && sdk $argv"
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
from kitty.boss import Boss
|
||||||
|
from kittens.tui.handler import result_handler
|
||||||
|
import kitty.fast_data_types as f
|
||||||
|
|
||||||
|
focus_opacity = 0.5
|
||||||
|
focus_margin = 200
|
||||||
|
|
||||||
|
|
||||||
|
def main(args: list[str]) -> str:
|
||||||
|
pass
|
||||||
|
|
||||||
|
@result_handler(no_ui=True)
|
||||||
|
def handle_result(args, answer, target_window_id, boss):
|
||||||
|
w = boss.window_id_map.get(target_window_id)
|
||||||
|
current_opacity = f.background_opacity_of(target_window_id)
|
||||||
|
|
||||||
|
in_focus = True if current_opacity != 1 else False
|
||||||
|
new_opacity = str(1 if in_focus else focus_opacity)
|
||||||
|
new_margin = str(0 if in_focus else focus_margin)
|
||||||
|
if w is not None:
|
||||||
|
boss.call_remote_control(w, ('set-background-opacity', new_opacity))
|
||||||
|
boss.call_remote_control(w, ('set-spacing', "margin-left="+new_margin))
|
||||||
|
boss.call_remote_control(w, ('set-spacing', "margin-right="+new_margin))
|
||||||
|
boss.toggle_fullscreen()
|
||||||
@@ -5,6 +5,10 @@ font_size 16
|
|||||||
shell /usr/bin/fish
|
shell /usr/bin/fish
|
||||||
cursor_trail 3
|
cursor_trail 3
|
||||||
cursor_trail_decay 0.1 0.25
|
cursor_trail_decay 0.1 0.25
|
||||||
|
dynamic_background_opacity true
|
||||||
|
map f11 kitten focus_mode.py
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# BEGIN_KITTY_THEME
|
# BEGIN_KITTY_THEME
|
||||||
# Everforest Light Hard
|
# Everforest Light Hard
|
||||||
|
|||||||
+17
-2
@@ -1,6 +1,6 @@
|
|||||||
-- Options
|
-- Options
|
||||||
vim.g.mapleader = '<space>'
|
vim.g.mapleader = '<space>'
|
||||||
vim.o.number = true
|
vim.o.number = false
|
||||||
vim.o.relativenumber = false
|
vim.o.relativenumber = false
|
||||||
vim.o.termguicolors = true
|
vim.o.termguicolors = true
|
||||||
vim.o.background = light
|
vim.o.background = light
|
||||||
@@ -16,6 +16,9 @@ vim.o.undofile = true
|
|||||||
vim.o.swapfile = true
|
vim.o.swapfile = true
|
||||||
vim.o.autochdir = true
|
vim.o.autochdir = true
|
||||||
vim.o.scrolloff = 15
|
vim.o.scrolloff = 15
|
||||||
|
vim.o.winborder = "solid"
|
||||||
|
vim.o.cursorline = true
|
||||||
|
vim.opt.spelllang = "en_us"
|
||||||
|
|
||||||
--Neovide Options
|
--Neovide Options
|
||||||
vim.o.guifont = "CaskaydiaMono Nerd Font:h14"
|
vim.o.guifont = "CaskaydiaMono Nerd Font:h14"
|
||||||
@@ -34,4 +37,16 @@ vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
|
|||||||
|
|
||||||
-- Autocompletion
|
-- Autocompletion
|
||||||
vim.diagnostic.config({ virtual_text = { current_line = true } })
|
vim.diagnostic.config({ virtual_text = { current_line = true } })
|
||||||
vim.lsp.enable({ "lua_ls", "rust_analyzer", "ts_ls", "pyright", "html", "cssls", "gopls", "lemminx" });
|
vim.lsp.enable({ "lua_ls", "rust_analyzer", "ts_ls", "pyright", "html", "cssls", "gopls", "lemminx", "marksman" });
|
||||||
|
|
||||||
|
-- Spell Checking
|
||||||
|
local spell_types = { "text", "plaintex", "typst", "gitcommit", "markdown" }
|
||||||
|
vim.api.nvim_create_augroup("Spellcheck", { clear = true })
|
||||||
|
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||||
|
group = "Spellcheck",
|
||||||
|
pattern = spell_types,
|
||||||
|
callback = function()
|
||||||
|
vim.opt_local.spell = true
|
||||||
|
end,
|
||||||
|
desc = "Enable spellcheck for defined filetypes"
|
||||||
|
})
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
|
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
|
||||||
"alpha-nvim": { "branch": "main", "commit": "a35468cd72645dbd52c0624ceead5f301c566dff" },
|
"alpha-nvim": { "branch": "main", "commit": "a35468cd72645dbd52c0624ceead5f301c566dff" },
|
||||||
|
"blink-cmp-spell": { "branch": "master", "commit": "2bd0e0d5e7735c047e72b6918a0458f3e8fadaba" },
|
||||||
"blink.cmp": { "branch": "main", "commit": "022521a8910a5543b0251b21c9e1a1e989745796" },
|
"blink.cmp": { "branch": "main", "commit": "022521a8910a5543b0251b21c9e1a1e989745796" },
|
||||||
"cord.nvim": { "branch": "master", "commit": "85d623661218c785379a554c59c71d1edde07114" },
|
"cord.nvim": { "branch": "master", "commit": "85d623661218c785379a554c59c71d1edde07114" },
|
||||||
"everforest-nvim": { "branch": "main", "commit": "2eb7c348f880ba93de4d98cae049c9441f5d4d49" },
|
"everforest-nvim": { "branch": "main", "commit": "2eb7c348f880ba93de4d98cae049c9441f5d4d49" },
|
||||||
@@ -11,16 +12,17 @@
|
|||||||
"lualine-macro-recording.nvim": { "branch": "main", "commit": "e2dcf63ba74e6111b53e1520a4f8a17a3d7427a1" },
|
"lualine-macro-recording.nvim": { "branch": "main", "commit": "e2dcf63ba74e6111b53e1520a4f8a17a3d7427a1" },
|
||||||
"lualine.nvim": { "branch": "master", "commit": "0c6cca9f2c63dadeb9225c45bc92bb95a151d4af" },
|
"lualine.nvim": { "branch": "master", "commit": "0c6cca9f2c63dadeb9225c45bc92bb95a151d4af" },
|
||||||
"mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" },
|
"mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" },
|
||||||
|
"maximizer.nvim": { "branch": "main", "commit": "8e2e71ce705400b10ef02a25ef2528bb078514a2" },
|
||||||
"mini.icons": { "branch": "main", "commit": "397ed3807e96b59709ef3292f0a3e253d5c1dc0a" },
|
"mini.icons": { "branch": "main", "commit": "397ed3807e96b59709ef3292f0a3e253d5c1dc0a" },
|
||||||
"noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" },
|
"noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" },
|
||||||
"nui.nvim": { "branch": "main", "commit": "7cd18e73cfbd70e1546931b7268b3eebaeff9391" },
|
"nui.nvim": { "branch": "main", "commit": "7cd18e73cfbd70e1546931b7268b3eebaeff9391" },
|
||||||
"nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" },
|
"nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" },
|
||||||
"nvim-lint": { "branch": "master", "commit": "0d2650564ce5a8bf8d5a4a4dd05b004936b03215" },
|
"nvim-lint": { "branch": "master", "commit": "cc26ae6a620298bb3f33b0e0681f99a10ae57781" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "036885e8e5456d3907626b634693234f628afef6" },
|
"nvim-lspconfig": { "branch": "master", "commit": "a182334ba933e58240c2c45e6ae2d9c7ae313e00" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||||
"nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" },
|
"nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" },
|
"nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" },
|
||||||
"oil.nvim": { "branch": "master", "commit": "5b6068aad7d2057dd399fac73b7fb2cdf23ccd6e" },
|
"oil.nvim": { "branch": "master", "commit": "08c2bce8b00fd780fb7999dbffdf7cd174e896fb" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||||
"snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" },
|
"snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" },
|
||||||
"solarized.nvim": { "branch": "main", "commit": "c0dfe1cbfabd93b546baf5f1408f5df7e02e2050" },
|
"solarized.nvim": { "branch": "main", "commit": "c0dfe1cbfabd93b546baf5f1408f5df7e02e2050" },
|
||||||
@@ -31,5 +33,6 @@
|
|||||||
"tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" },
|
"tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" },
|
||||||
"vim-illuminate": { "branch": "master", "commit": "0d1e93684da00ab7c057410fecfc24f434698898" },
|
"vim-illuminate": { "branch": "master", "commit": "0d1e93684da00ab7c057410fecfc24f434698898" },
|
||||||
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" },
|
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" },
|
||||||
"yazi.nvim": { "branch": "main", "commit": "e2ddbaa88ec61d0b96e3d53ba851b0e7a0b36f14" }
|
"yazi.nvim": { "branch": "main", "commit": "e2ddbaa88ec61d0b96e3d53ba851b0e7a0b36f14" },
|
||||||
|
"zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
return {
|
return {
|
||||||
'saghen/blink.cmp',
|
'saghen/blink.cmp',
|
||||||
dependencies = { 'rafamadriz/friendly-snippets' },
|
dependencies = {
|
||||||
|
'rafamadriz/friendly-snippets',
|
||||||
|
'ribru17/blink-cmp-spell'
|
||||||
|
},
|
||||||
version = '1.*',
|
version = '1.*',
|
||||||
opts = {
|
opts = {
|
||||||
keymap = {
|
keymap = {
|
||||||
@@ -14,7 +17,35 @@ return {
|
|||||||
},
|
},
|
||||||
completion = { documentation = { auto_show = false } },
|
completion = { documentation = { auto_show = false } },
|
||||||
sources = {
|
sources = {
|
||||||
default = { 'lsp', 'path', 'snippets', 'buffer' },
|
default = { 'lsp', 'path', 'snippets', 'buffer', 'spell' },
|
||||||
|
providers = {
|
||||||
|
-- ...
|
||||||
|
spell = {
|
||||||
|
name = 'Spell',
|
||||||
|
module = 'blink-cmp-spell',
|
||||||
|
opts = {
|
||||||
|
-- EXAMPLE: Only enable source in `@spell` captures, and disable it
|
||||||
|
-- in `@nospell` captures.
|
||||||
|
enable_in_context = function()
|
||||||
|
local curpos = vim.api.nvim_win_get_cursor(0)
|
||||||
|
local captures = vim.treesitter.get_captures_at_pos(
|
||||||
|
0,
|
||||||
|
curpos[1] - 1,
|
||||||
|
curpos[2] - 1
|
||||||
|
)
|
||||||
|
local in_spell_capture = false
|
||||||
|
for _, cap in ipairs(captures) do
|
||||||
|
if cap.capture == 'spell' then
|
||||||
|
in_spell_capture = true
|
||||||
|
elseif cap.capture == 'nospell' then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return in_spell_capture
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
fuzzy = { implementation = "prefer_rust_with_warning" }
|
fuzzy = { implementation = "prefer_rust_with_warning" }
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
return {
|
||||||
|
"0x00-ketsu/maximizer.nvim",
|
||||||
|
keys = {
|
||||||
|
{'mt', '<cmd>lua require("maximizer").toggle()<CR>'},
|
||||||
|
{'mm', '<cmd>lua require("maximizer").maximize()<CR>'},
|
||||||
|
{'mr', '<cmd>lua require("maximizer").restore()<CR>'}
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("maximizer").setup {
|
||||||
|
}
|
||||||
|
end
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
return {
|
||||||
|
"folke/zen-mode.nvim",
|
||||||
|
opts = {
|
||||||
|
window = {
|
||||||
|
backdrop = 0.5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
c1177910-90a7-46a2-ac12-a9aedb788ea1
|
4b0f4407-a1a3-4bd1-b1c3-443eb396506f
|
||||||
@@ -1 +1 @@
|
|||||||
1eff6e2a-b118-475f-9fc0-36fa6f4f4339
|
6d446931-7421-42b0-89dd-0cd902eb4737
|
||||||
@@ -1 +1 @@
|
|||||||
88e1527e-effc-429a-aa31-0c038a5723df
|
0ed133e5-956e-469d-ae55-b7525bb88fd6
|
||||||
@@ -1 +1 @@
|
|||||||
8de85f99-357f-425e-ad2d-700d57bf456b
|
3ff48d18-f52e-448c-a0c2-6acebc8a846e
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"vimMode": true
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"nativeMenus": false
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
[
|
||||||
|
"cm-typewriter-scroll-obsidian"
|
||||||
|
]
|
||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"file-explorer": true,
|
||||||
|
"global-search": true,
|
||||||
|
"switcher": true,
|
||||||
|
"graph": true,
|
||||||
|
"backlink": true,
|
||||||
|
"canvas": true,
|
||||||
|
"outgoing-link": true,
|
||||||
|
"tag-pane": true,
|
||||||
|
"properties": false,
|
||||||
|
"page-preview": true,
|
||||||
|
"daily-notes": true,
|
||||||
|
"templates": true,
|
||||||
|
"note-composer": true,
|
||||||
|
"command-palette": true,
|
||||||
|
"slash-command": false,
|
||||||
|
"editor-status": true,
|
||||||
|
"bookmarks": true,
|
||||||
|
"markdown-importer": false,
|
||||||
|
"zk-prefixer": false,
|
||||||
|
"random-note": false,
|
||||||
|
"outline": true,
|
||||||
|
"word-count": true,
|
||||||
|
"slides": false,
|
||||||
|
"audio-recorder": false,
|
||||||
|
"workspaces": false,
|
||||||
|
"file-recovery": true,
|
||||||
|
"publish": false,
|
||||||
|
"sync": true,
|
||||||
|
"webviewer": false,
|
||||||
|
"footnotes": false,
|
||||||
|
"bases": true
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"collapse-filter": true,
|
||||||
|
"search": "",
|
||||||
|
"showTags": false,
|
||||||
|
"showAttachments": false,
|
||||||
|
"hideUnresolved": false,
|
||||||
|
"showOrphans": true,
|
||||||
|
"collapse-color-groups": true,
|
||||||
|
"colorGroups": [],
|
||||||
|
"collapse-display": true,
|
||||||
|
"showArrow": false,
|
||||||
|
"textFadeMultiplier": 0,
|
||||||
|
"nodeSizeMultiplier": 1,
|
||||||
|
"lineSizeMultiplier": 1,
|
||||||
|
"collapse-forces": true,
|
||||||
|
"centerStrength": 0.518713248970312,
|
||||||
|
"repelStrength": 10,
|
||||||
|
"linkStrength": 1,
|
||||||
|
"linkDistance": 250,
|
||||||
|
"scale": 1,
|
||||||
|
"close": true
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"enabled": true,
|
||||||
|
"typewriterOffset": 0.5,
|
||||||
|
"zenEnabled": false,
|
||||||
|
"zenOpacity": 0.25
|
||||||
|
}
|
||||||
@@ -0,0 +1,427 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var obsidian = require('obsidian');
|
||||||
|
var state = require('@codemirror/state');
|
||||||
|
var view = require('@codemirror/view');
|
||||||
|
|
||||||
|
/*! *****************************************************************************
|
||||||
|
Copyright (c) Microsoft Corporation.
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
***************************************************************************** */
|
||||||
|
/* global Reflect, Promise */
|
||||||
|
|
||||||
|
var extendStatics = function(d, b) {
|
||||||
|
extendStatics = Object.setPrototypeOf ||
|
||||||
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||||
|
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||||
|
return extendStatics(d, b);
|
||||||
|
};
|
||||||
|
|
||||||
|
function __extends(d, b) {
|
||||||
|
if (typeof b !== "function" && b !== null)
|
||||||
|
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||||
|
extendStatics(d, b);
|
||||||
|
function __() { this.constructor = d; }
|
||||||
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||||
|
}
|
||||||
|
|
||||||
|
function __awaiter(thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function __generator(thisArg, body) {
|
||||||
|
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||||
|
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||||
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||||
|
function step(op) {
|
||||||
|
if (f) throw new TypeError("Generator is already executing.");
|
||||||
|
while (_) try {
|
||||||
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||||
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||||
|
switch (op[0]) {
|
||||||
|
case 0: case 1: t = op; break;
|
||||||
|
case 4: _.label++; return { value: op[1], done: false };
|
||||||
|
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||||
|
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||||
|
default:
|
||||||
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||||
|
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||||
|
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||||
|
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||||
|
if (t[2]) _.ops.pop();
|
||||||
|
_.trys.pop(); continue;
|
||||||
|
}
|
||||||
|
op = body.call(thisArg, _);
|
||||||
|
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||||
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// all credit to azu: https://github.com/azu/codemirror-typewriter-scrolling/blob/b0ac076d72c9445c96182de87d974de2e8cc56e2/typewriter-scrolling.js
|
||||||
|
var movedByMouse = false;
|
||||||
|
CodeMirror.commands.scrollSelectionToCenter = function (cm) {
|
||||||
|
var cursor = cm.getCursor('head');
|
||||||
|
var charCoords = cm.charCoords(cursor, "local");
|
||||||
|
var top = charCoords.top;
|
||||||
|
var halfLineHeight = (charCoords.bottom - top) / 2;
|
||||||
|
var halfWindowHeight = cm.getWrapperElement().offsetHeight / 2;
|
||||||
|
var scrollTo = Math.round((top - halfWindowHeight + halfLineHeight));
|
||||||
|
cm.scrollTo(null, scrollTo);
|
||||||
|
};
|
||||||
|
CodeMirror.defineOption("typewriterScrolling", false, function (cm, val, old) {
|
||||||
|
if (old && old != CodeMirror.Init) {
|
||||||
|
const linesEl = cm.getScrollerElement().querySelector('.CodeMirror-lines');
|
||||||
|
linesEl.style.paddingTop = null;
|
||||||
|
linesEl.style.paddingBottom = null;
|
||||||
|
cm.off("cursorActivity", onCursorActivity);
|
||||||
|
cm.off("refresh", onRefresh);
|
||||||
|
cm.off("mousedown", onMouseDown);
|
||||||
|
cm.off("keydown", onKeyDown);
|
||||||
|
cm.off("beforeChange", onBeforeChange);
|
||||||
|
}
|
||||||
|
if (val) {
|
||||||
|
onRefresh(cm);
|
||||||
|
cm.on("cursorActivity", onCursorActivity);
|
||||||
|
cm.on("refresh", onRefresh);
|
||||||
|
cm.on("mousedown", onMouseDown);
|
||||||
|
cm.on("keydown", onKeyDown);
|
||||||
|
cm.on("beforeChange", onBeforeChange);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
function onMouseDown() {
|
||||||
|
movedByMouse = true;
|
||||||
|
}
|
||||||
|
const modiferKeys = ["Alt", "AltGraph", "CapsLock", "Control", "Fn", "FnLock", "Hyper", "Meta", "NumLock", "ScrollLock", "Shift", "Super", "Symbol", "SymbolLock"];
|
||||||
|
function onKeyDown(cm, e) {
|
||||||
|
if (!modiferKeys.includes(e.key)) {
|
||||||
|
movedByMouse = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function onBeforeChange() {
|
||||||
|
movedByMouse = false;
|
||||||
|
}
|
||||||
|
function onCursorActivity(cm) {
|
||||||
|
const linesEl = cm.getScrollerElement().querySelector('.CodeMirror-lines');
|
||||||
|
if (cm.getSelection().length !== 0) {
|
||||||
|
linesEl.classList.add("selecting");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
linesEl.classList.remove("selecting");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!movedByMouse) {
|
||||||
|
cm.execCommand("scrollSelectionToCenter");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function onRefresh(cm) {
|
||||||
|
const halfWindowHeight = cm.getWrapperElement().offsetHeight / 2;
|
||||||
|
const linesEl = cm.getScrollerElement().querySelector('.CodeMirror-lines');
|
||||||
|
linesEl.style.paddingTop = `${halfWindowHeight}px`;
|
||||||
|
linesEl.style.paddingBottom = `${halfWindowHeight}px`; // Thanks @walulula!
|
||||||
|
if (cm.getSelection().length === 0) {
|
||||||
|
cm.execCommand("scrollSelectionToCenter");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var allowedUserEvents = /^(select|input|delete|undo|redo)(\..+)?$/;
|
||||||
|
var disallowedUserEvents = /^(select.pointer)$/;
|
||||||
|
var typewriterOffset = state.Facet.define({
|
||||||
|
combine: function (values) { return values.length ? Math.min.apply(Math, values) : 0.5; }
|
||||||
|
});
|
||||||
|
var resetTypewriterScrollPaddingPlugin = view.ViewPlugin.fromClass(/** @class */ (function () {
|
||||||
|
function class_1(view) {
|
||||||
|
this.view = view;
|
||||||
|
}
|
||||||
|
class_1.prototype.update = function (update) {
|
||||||
|
if (this.view.contentDOM.style.paddingTop) {
|
||||||
|
this.view.contentDOM.style.paddingTop = "";
|
||||||
|
this.view.contentDOM.style.paddingBottom = (update.view.dom.clientHeight / 2) + "px";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return class_1;
|
||||||
|
}()));
|
||||||
|
var typewriterScrollPaddingPlugin = view.ViewPlugin.fromClass(/** @class */ (function () {
|
||||||
|
function class_2(view) {
|
||||||
|
this.view = view;
|
||||||
|
this.topPadding = null;
|
||||||
|
}
|
||||||
|
class_2.prototype.update = function (update) {
|
||||||
|
var offset = (update.view.dom.clientHeight * update.view.state.facet(typewriterOffset)) - (update.view.defaultLineHeight / 2);
|
||||||
|
this.topPadding = offset + "px";
|
||||||
|
if (this.topPadding != this.view.contentDOM.style.paddingTop) {
|
||||||
|
this.view.contentDOM.style.paddingTop = this.topPadding;
|
||||||
|
this.view.contentDOM.style.paddingBottom = (update.view.dom.clientHeight - offset) + "px";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return class_2;
|
||||||
|
}()));
|
||||||
|
var typewriterScrollPlugin = view.ViewPlugin.fromClass(/** @class */ (function () {
|
||||||
|
function class_3(view) {
|
||||||
|
this.view = view;
|
||||||
|
this.myUpdate = false;
|
||||||
|
}
|
||||||
|
class_3.prototype.update = function (update) {
|
||||||
|
if (this.myUpdate)
|
||||||
|
this.myUpdate = false;
|
||||||
|
else {
|
||||||
|
var userEvents = update.transactions.map(function (tr) { return tr.annotation(state.Transaction.userEvent); });
|
||||||
|
var isAllowed = userEvents.reduce(function (result, event) { return result && allowedUserEvents.test(event) && !disallowedUserEvents.test(event); }, userEvents.length > 0);
|
||||||
|
if (isAllowed) {
|
||||||
|
this.myUpdate = true;
|
||||||
|
this.centerOnHead(update);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
class_3.prototype.centerOnHead = function (update) {
|
||||||
|
return __awaiter(this, void 0, void 0, function () {
|
||||||
|
var _this = this;
|
||||||
|
return __generator(this, function (_a) {
|
||||||
|
// can't update inside an update, so request the next animation frame
|
||||||
|
window.requestAnimationFrame(function () {
|
||||||
|
// current selection range
|
||||||
|
if (update.state.selection.ranges.length == 1) {
|
||||||
|
// only act on the one range
|
||||||
|
var head = update.state.selection.main.head;
|
||||||
|
var prevHead = update.startState.selection.main.head;
|
||||||
|
// TODO: work out line number and use that instead? Is that even possible?
|
||||||
|
// don't bother with this next part if the range (line??) hasn't changed
|
||||||
|
if (prevHead != head) {
|
||||||
|
// this is the effect that does the centering
|
||||||
|
var offset = (update.view.dom.clientHeight * update.view.state.facet(typewriterOffset)) - (update.view.defaultLineHeight / 2);
|
||||||
|
var effect = view.EditorView.scrollIntoView(head, { y: "start", yMargin: offset });
|
||||||
|
// const effect = EditorView.scrollIntoView(head, { y: "center" });
|
||||||
|
var transaction = _this.view.state.update({ effects: effect });
|
||||||
|
_this.view.dispatch(transaction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return [2 /*return*/];
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
return class_3;
|
||||||
|
}()));
|
||||||
|
function typewriterScroll(options) {
|
||||||
|
if (options === void 0) { options = {}; }
|
||||||
|
return [
|
||||||
|
options.typewriterOffset == null ? [] : typewriterOffset.of(options.typewriterOffset),
|
||||||
|
typewriterScrollPaddingPlugin,
|
||||||
|
typewriterScrollPlugin
|
||||||
|
];
|
||||||
|
}
|
||||||
|
function resetTypewriterSrcoll() {
|
||||||
|
return [
|
||||||
|
resetTypewriterScrollPaddingPlugin
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
var DEFAULT_SETTINGS = {
|
||||||
|
enabled: true,
|
||||||
|
typewriterOffset: 0.5,
|
||||||
|
zenEnabled: false,
|
||||||
|
zenOpacity: 0.25
|
||||||
|
};
|
||||||
|
var CMTypewriterScrollPlugin = /** @class */ (function (_super) {
|
||||||
|
__extends(CMTypewriterScrollPlugin, _super);
|
||||||
|
function CMTypewriterScrollPlugin() {
|
||||||
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||||
|
_this.extArray = [];
|
||||||
|
_this.toggleTypewriterScroll = function (newValue) {
|
||||||
|
if (newValue === void 0) { newValue = null; }
|
||||||
|
// if no value is passed in, toggle the existing value
|
||||||
|
if (newValue === null)
|
||||||
|
newValue = !_this.settings.enabled;
|
||||||
|
// assign the new value and call the correct enable / disable function
|
||||||
|
(_this.settings.enabled = newValue)
|
||||||
|
? _this.enableTypewriterScroll() : _this.disableTypewriterScroll();
|
||||||
|
// save the new settings
|
||||||
|
_this.saveData(_this.settings);
|
||||||
|
};
|
||||||
|
_this.changeTypewriterOffset = function (newValue) {
|
||||||
|
_this.settings.typewriterOffset = newValue;
|
||||||
|
if (_this.settings.enabled) {
|
||||||
|
_this.disableTypewriterScroll();
|
||||||
|
// delete the extension, so it gets recreated with the new value
|
||||||
|
delete _this.ext;
|
||||||
|
_this.enableTypewriterScroll();
|
||||||
|
}
|
||||||
|
_this.saveData(_this.settings);
|
||||||
|
};
|
||||||
|
_this.toggleZen = function (newValue) {
|
||||||
|
if (newValue === void 0) { newValue = null; }
|
||||||
|
// if no value is passed in, toggle the existing value
|
||||||
|
if (newValue === null)
|
||||||
|
newValue = !_this.settings.zenEnabled;
|
||||||
|
// assign the new value and call the correct enable / disable function
|
||||||
|
(_this.settings.zenEnabled = newValue)
|
||||||
|
? _this.enableZen() : _this.disableZen();
|
||||||
|
// save the new settings
|
||||||
|
_this.saveData(_this.settings);
|
||||||
|
};
|
||||||
|
_this.changeZenOpacity = function (newValue) {
|
||||||
|
if (newValue === void 0) { newValue = 0.25; }
|
||||||
|
_this.settings.zenOpacity = newValue;
|
||||||
|
_this.css.innerText = "body{--zen-opacity: ".concat(newValue, ";}");
|
||||||
|
// save the new settings
|
||||||
|
_this.saveData(_this.settings);
|
||||||
|
};
|
||||||
|
_this.enableTypewriterScroll = function () {
|
||||||
|
// add the class
|
||||||
|
document.body.classList.add('plugin-cm-typewriter-scroll');
|
||||||
|
// register the codemirror add on setting
|
||||||
|
_this.registerCodeMirror(function (cm) {
|
||||||
|
// @ts-ignore
|
||||||
|
cm.setOption("typewriterScrolling", true);
|
||||||
|
});
|
||||||
|
if (!_this.ext) {
|
||||||
|
_this.ext = typewriterScroll({ typewriterOffset: _this.settings.typewriterOffset });
|
||||||
|
_this.extArray = [_this.ext];
|
||||||
|
_this.registerEditorExtension(_this.extArray);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_this.extArray.splice(0, _this.extArray.length);
|
||||||
|
_this.extArray.push(_this.ext);
|
||||||
|
_this.app.workspace.updateOptions();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
_this.disableTypewriterScroll = function () {
|
||||||
|
// remove the class
|
||||||
|
document.body.classList.remove('plugin-cm-typewriter-scroll');
|
||||||
|
// remove the codemirror add on setting
|
||||||
|
_this.app.workspace.iterateCodeMirrors(function (cm) {
|
||||||
|
// @ts-ignore
|
||||||
|
cm.setOption("typewriterScrolling", false);
|
||||||
|
});
|
||||||
|
// clear out the registered extension
|
||||||
|
_this.extArray.splice(0, _this.extArray.length);
|
||||||
|
_this.extArray.push(resetTypewriterSrcoll());
|
||||||
|
_this.app.workspace.updateOptions();
|
||||||
|
};
|
||||||
|
_this.enableZen = function () {
|
||||||
|
// add the class
|
||||||
|
document.body.classList.add('plugin-cm-typewriter-scroll-zen');
|
||||||
|
};
|
||||||
|
_this.disableZen = function () {
|
||||||
|
// remove the class
|
||||||
|
document.body.classList.remove('plugin-cm-typewriter-scroll-zen');
|
||||||
|
};
|
||||||
|
return _this;
|
||||||
|
}
|
||||||
|
CMTypewriterScrollPlugin.prototype.onload = function () {
|
||||||
|
return __awaiter(this, void 0, void 0, function () {
|
||||||
|
var _a, _b, _c, _d;
|
||||||
|
return __generator(this, function (_e) {
|
||||||
|
switch (_e.label) {
|
||||||
|
case 0:
|
||||||
|
_a = this;
|
||||||
|
_c = (_b = Object).assign;
|
||||||
|
_d = [DEFAULT_SETTINGS];
|
||||||
|
return [4 /*yield*/, this.loadData()];
|
||||||
|
case 1:
|
||||||
|
_a.settings = _c.apply(_b, _d.concat([_e.sent()]));
|
||||||
|
// enable the plugin (based on settings)
|
||||||
|
if (this.settings.enabled)
|
||||||
|
this.enableTypewriterScroll();
|
||||||
|
if (this.settings.zenEnabled)
|
||||||
|
this.enableZen();
|
||||||
|
this.css = document.createElement('style');
|
||||||
|
this.css.id = 'plugin-typewriter-scroll';
|
||||||
|
this.css.setAttr('type', 'text/css');
|
||||||
|
document.getElementsByTagName("head")[0].appendChild(this.css);
|
||||||
|
this.css.innerText = "body{--zen-opacity: ".concat(this.settings.zenOpacity, ";}");
|
||||||
|
// add the settings tab
|
||||||
|
this.addSettingTab(new CMTypewriterScrollSettingTab(this.app, this));
|
||||||
|
// add the commands / keyboard shortcuts
|
||||||
|
this.addCommands();
|
||||||
|
return [2 /*return*/];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
CMTypewriterScrollPlugin.prototype.onunload = function () {
|
||||||
|
// disable the plugin
|
||||||
|
this.disableTypewriterScroll();
|
||||||
|
this.disableZen();
|
||||||
|
};
|
||||||
|
CMTypewriterScrollPlugin.prototype.addCommands = function () {
|
||||||
|
var _this = this;
|
||||||
|
// add the toggle on/off command
|
||||||
|
this.addCommand({
|
||||||
|
id: 'toggle-typewriter-sroll',
|
||||||
|
name: 'Toggle On/Off',
|
||||||
|
callback: function () { _this.toggleTypewriterScroll(); }
|
||||||
|
});
|
||||||
|
// toggle zen mode
|
||||||
|
this.addCommand({
|
||||||
|
id: 'toggle-typewriter-sroll-zen',
|
||||||
|
name: 'Toggle Zen Mode On/Off',
|
||||||
|
callback: function () { _this.toggleZen(); }
|
||||||
|
});
|
||||||
|
};
|
||||||
|
return CMTypewriterScrollPlugin;
|
||||||
|
}(obsidian.Plugin));
|
||||||
|
var CMTypewriterScrollSettingTab = /** @class */ (function (_super) {
|
||||||
|
__extends(CMTypewriterScrollSettingTab, _super);
|
||||||
|
function CMTypewriterScrollSettingTab(app, plugin) {
|
||||||
|
var _this = _super.call(this, app, plugin) || this;
|
||||||
|
_this.plugin = plugin;
|
||||||
|
return _this;
|
||||||
|
}
|
||||||
|
CMTypewriterScrollSettingTab.prototype.display = function () {
|
||||||
|
var _this = this;
|
||||||
|
var containerEl = this.containerEl;
|
||||||
|
containerEl.empty();
|
||||||
|
new obsidian.Setting(containerEl)
|
||||||
|
.setName("Toggle Typewriter Scrolling")
|
||||||
|
.setDesc("Turns typewriter scrolling on or off globally")
|
||||||
|
.addToggle(function (toggle) {
|
||||||
|
return toggle.setValue(_this.plugin.settings.enabled)
|
||||||
|
.onChange(function (newValue) { _this.plugin.toggleTypewriterScroll(newValue); });
|
||||||
|
});
|
||||||
|
new obsidian.Setting(containerEl)
|
||||||
|
.setName("Center offset")
|
||||||
|
.setDesc("Positions the typewriter text at the specified percentage of the screen")
|
||||||
|
.addSlider(function (slider) {
|
||||||
|
return slider.setLimits(0, 100, 5)
|
||||||
|
.setValue(_this.plugin.settings.typewriterOffset * 100)
|
||||||
|
.onChange(function (newValue) { _this.plugin.changeTypewriterOffset(newValue / 100); });
|
||||||
|
});
|
||||||
|
new obsidian.Setting(containerEl)
|
||||||
|
.setName("Zen Mode")
|
||||||
|
.setDesc("Darkens non-active lines in the editor so you can focus on what you're typing")
|
||||||
|
.addToggle(function (toggle) {
|
||||||
|
return toggle.setValue(_this.plugin.settings.zenEnabled)
|
||||||
|
.onChange(function (newValue) { _this.plugin.toggleZen(newValue); });
|
||||||
|
});
|
||||||
|
new obsidian.Setting(containerEl)
|
||||||
|
.setName("Zen Opacity")
|
||||||
|
.setDesc("The opacity of unfocused lines in zen mode")
|
||||||
|
.addSlider(function (slider) {
|
||||||
|
return slider.setLimits(0, 100, 5)
|
||||||
|
.setValue(_this.plugin.settings.zenOpacity * 100)
|
||||||
|
.onChange(function (newValue) { _this.plugin.changeZenOpacity(newValue / 100); });
|
||||||
|
});
|
||||||
|
};
|
||||||
|
return CMTypewriterScrollSettingTab;
|
||||||
|
}(obsidian.PluginSettingTab));
|
||||||
|
|
||||||
|
module.exports = CMTypewriterScrollPlugin;
|
||||||
|
|
||||||
|
|
||||||
|
/* nosourcemap */
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"id": "cm-typewriter-scroll-obsidian",
|
||||||
|
"name": "Typewriter Scroll",
|
||||||
|
"author": "death_au",
|
||||||
|
"authorUrl": "https://github.com/deathau",
|
||||||
|
"description": "Typewriter-style scrolling which keeps the view centered in the editor.",
|
||||||
|
"isDesktopOnly": false,
|
||||||
|
"version": "0.2.2",
|
||||||
|
"minAppVersion": "0.10.0"
|
||||||
|
}
|
||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
body.plugin-cm-typewriter-scroll-zen .CodeMirror-lines:not(.selecting) .CodeMirror-code > :not(.CodeMirror-activeline) {
|
||||||
|
opacity: var(--zen-opacity);
|
||||||
|
}
|
||||||
|
body.plugin-cm-typewriter-scroll-zen .cm-editor.cm-focused .cm-line:not(.cm-active) {
|
||||||
|
opacity: var(--zen-opacity);
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"author": "Vinzent",
|
||||||
|
"authorUrl": "https://github.com/Vinzent03",
|
||||||
|
"id": "obsidian-git",
|
||||||
|
"name": "Git",
|
||||||
|
"description": "Integrate Git version control with automatic backup and other advanced features.",
|
||||||
|
"isDesktopOnly": false,
|
||||||
|
"fundingUrl": "https://ko-fi.com/vinzent",
|
||||||
|
"version": "2.35.0"
|
||||||
|
}
|
||||||
@@ -0,0 +1,621 @@
|
|||||||
|
@keyframes loading {
|
||||||
|
0% {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="git-view"] .button-border {
|
||||||
|
border: 2px solid var(--interactive-accent);
|
||||||
|
border-radius: var(--radius-s);
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="git-view"] .view-content {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="git-history-view"] .view-content {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading > svg {
|
||||||
|
animation: 2s linear infinite loading;
|
||||||
|
transform-origin: 50% 50%;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.obsidian-git-center {
|
||||||
|
margin: auto;
|
||||||
|
text-align: center;
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.obsidian-git-textarea {
|
||||||
|
display: block;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.obsidian-git-disabled {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.obsidian-git-center-button {
|
||||||
|
display: block;
|
||||||
|
margin: 20px auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tooltip.mod-left {
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tooltip.mod-right {
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Limits the scrollbar to the view body */
|
||||||
|
.git-view {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
position: relative;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.git-tools {
|
||||||
|
display: flex;
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
.git-tools .type {
|
||||||
|
padding-left: var(--size-2-1);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.git-tools .type[data-type="M"] {
|
||||||
|
color: orange;
|
||||||
|
}
|
||||||
|
.git-tools .type[data-type="D"] {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
.git-tools .buttons {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
.git-tools .buttons > * {
|
||||||
|
padding: 0 0;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="git-view"] .tree-item-self,
|
||||||
|
.workspace-leaf-content[data-type="git-history-view"] .tree-item-self {
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="git-view"]
|
||||||
|
.tree-item-self:hover
|
||||||
|
.clickable-icon,
|
||||||
|
.workspace-leaf-content[data-type="git-history-view"]
|
||||||
|
.tree-item-self:hover
|
||||||
|
.clickable-icon {
|
||||||
|
color: var(--icon-color-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Highlight an item as active if it's diff is currently opened */
|
||||||
|
.is-active .git-tools .buttons > * {
|
||||||
|
color: var(--nav-item-color-active);
|
||||||
|
}
|
||||||
|
|
||||||
|
.git-author {
|
||||||
|
color: var(--text-accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.git-date {
|
||||||
|
color: var(--text-accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.git-ref {
|
||||||
|
color: var(--text-accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-d-none {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-wrapper {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-file-header {
|
||||||
|
background-color: var(--background-primary);
|
||||||
|
border-bottom: 1px solid var(--interactive-accent);
|
||||||
|
font-family: var(--font-monospace);
|
||||||
|
height: 35px;
|
||||||
|
padding: 5px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-file-header,
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-file-stats {
|
||||||
|
display: -webkit-box;
|
||||||
|
display: -ms-flexbox;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-file-stats {
|
||||||
|
font-size: 14px;
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-lines-added {
|
||||||
|
border: 1px solid #b4e2b4;
|
||||||
|
border-radius: 5px 0 0 5px;
|
||||||
|
color: #399839;
|
||||||
|
padding: 2px;
|
||||||
|
text-align: right;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-lines-deleted {
|
||||||
|
border: 1px solid #e9aeae;
|
||||||
|
border-radius: 0 5px 5px 0;
|
||||||
|
color: #c33;
|
||||||
|
margin-left: 1px;
|
||||||
|
padding: 2px;
|
||||||
|
text-align: left;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-file-name-wrapper {
|
||||||
|
-webkit-box-align: center;
|
||||||
|
-ms-flex-align: center;
|
||||||
|
align-items: center;
|
||||||
|
display: -webkit-box;
|
||||||
|
display: -ms-flexbox;
|
||||||
|
display: flex;
|
||||||
|
font-size: 15px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-file-name {
|
||||||
|
overflow-x: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-file-wrapper {
|
||||||
|
border: 1px solid var(--background-modifier-border);
|
||||||
|
border-radius: 3px;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-file-collapse {
|
||||||
|
-webkit-box-pack: end;
|
||||||
|
-ms-flex-pack: end;
|
||||||
|
-webkit-box-align: center;
|
||||||
|
-ms-flex-align: center;
|
||||||
|
align-items: center;
|
||||||
|
border: 1px solid var(--background-modifier-border);
|
||||||
|
border-radius: 3px;
|
||||||
|
cursor: pointer;
|
||||||
|
display: none;
|
||||||
|
font-size: 12px;
|
||||||
|
justify-content: flex-end;
|
||||||
|
padding: 4px 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-file-collapse.d2h-selected {
|
||||||
|
background-color: #c8e1ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-file-collapse-input {
|
||||||
|
margin: 0 4px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-diff-table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
font-family: Menlo, Consolas, monospace;
|
||||||
|
font-size: 13px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-files-diff {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-file-diff {
|
||||||
|
overflow-y: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-file-side-diff {
|
||||||
|
display: inline-block;
|
||||||
|
margin-bottom: -8px;
|
||||||
|
margin-right: -4px;
|
||||||
|
overflow-x: scroll;
|
||||||
|
overflow-y: hidden;
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line {
|
||||||
|
padding: 0 8em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line,
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line {
|
||||||
|
display: inline-block;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
white-space: nowrap;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line {
|
||||||
|
padding: 0 4.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line-ctn {
|
||||||
|
word-wrap: normal;
|
||||||
|
background: none;
|
||||||
|
display: inline-block;
|
||||||
|
padding: 0;
|
||||||
|
-webkit-user-select: text;
|
||||||
|
-moz-user-select: text;
|
||||||
|
-ms-user-select: text;
|
||||||
|
user-select: text;
|
||||||
|
vertical-align: middle;
|
||||||
|
white-space: pre;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-code-line del,
|
||||||
|
.theme-light
|
||||||
|
.workspace-leaf-content[data-type="diff-view"]
|
||||||
|
.d2h-code-side-line
|
||||||
|
del {
|
||||||
|
background-color: #ffb6ba;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-code-line del,
|
||||||
|
.theme-dark
|
||||||
|
.workspace-leaf-content[data-type="diff-view"]
|
||||||
|
.d2h-code-side-line
|
||||||
|
del {
|
||||||
|
background-color: #8d232881;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line del,
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line ins,
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line del,
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line ins {
|
||||||
|
border-radius: 0.2em;
|
||||||
|
display: inline-block;
|
||||||
|
margin-top: -1px;
|
||||||
|
text-decoration: none;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-code-line ins,
|
||||||
|
.theme-light
|
||||||
|
.workspace-leaf-content[data-type="diff-view"]
|
||||||
|
.d2h-code-side-line
|
||||||
|
ins {
|
||||||
|
background-color: #97f295;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-code-line ins,
|
||||||
|
.theme-dark
|
||||||
|
.workspace-leaf-content[data-type="diff-view"]
|
||||||
|
.d2h-code-side-line
|
||||||
|
ins {
|
||||||
|
background-color: #1d921996;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line-prefix {
|
||||||
|
word-wrap: normal;
|
||||||
|
background: none;
|
||||||
|
display: inline;
|
||||||
|
padding: 0;
|
||||||
|
white-space: pre;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .line-num1 {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .line-num1,
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .line-num2 {
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
overflow: hidden;
|
||||||
|
padding: 0 0.5em;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
width: 3.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .line-num2 {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber {
|
||||||
|
background-color: var(--background-primary);
|
||||||
|
border: solid var(--background-modifier-border);
|
||||||
|
border-width: 0 1px;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
color: var(--text-muted);
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline-block;
|
||||||
|
position: absolute;
|
||||||
|
text-align: right;
|
||||||
|
width: 7.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber:after {
|
||||||
|
content: "\200b";
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber {
|
||||||
|
background-color: var(--background-primary);
|
||||||
|
border: solid var(--background-modifier-border);
|
||||||
|
border-width: 0 1px;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
color: var(--text-muted);
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline-block;
|
||||||
|
overflow: hidden;
|
||||||
|
padding: 0 0.5em;
|
||||||
|
position: absolute;
|
||||||
|
text-align: right;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
width: 4em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-diff-tbody tr {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber:after {
|
||||||
|
content: "\200b";
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-emptyplaceholder,
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-emptyplaceholder {
|
||||||
|
background-color: var(--background-primary);
|
||||||
|
border-color: var(--background-modifier-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line-prefix,
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber,
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber,
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-emptyplaceholder {
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber,
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber {
|
||||||
|
direction: rtl;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-del {
|
||||||
|
background-color: #fee8e9;
|
||||||
|
border-color: #e9aeae;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-ins {
|
||||||
|
background-color: #dfd;
|
||||||
|
border-color: #b4e2b4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-del {
|
||||||
|
background-color: #521b1d83;
|
||||||
|
border-color: #691d1d73;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-ins {
|
||||||
|
background-color: rgba(30, 71, 30, 0.5);
|
||||||
|
border-color: #13501381;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-info {
|
||||||
|
background-color: var(--background-primary);
|
||||||
|
border-color: var(--background-modifier-border);
|
||||||
|
color: var(--text-normal);
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-light
|
||||||
|
.workspace-leaf-content[data-type="diff-view"]
|
||||||
|
.d2h-file-diff
|
||||||
|
.d2h-del.d2h-change {
|
||||||
|
background-color: #fdf2d0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-dark
|
||||||
|
.workspace-leaf-content[data-type="diff-view"]
|
||||||
|
.d2h-file-diff
|
||||||
|
.d2h-del.d2h-change {
|
||||||
|
background-color: #55492480;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-light
|
||||||
|
.workspace-leaf-content[data-type="diff-view"]
|
||||||
|
.d2h-file-diff
|
||||||
|
.d2h-ins.d2h-change {
|
||||||
|
background-color: #ded;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-dark
|
||||||
|
.workspace-leaf-content[data-type="diff-view"]
|
||||||
|
.d2h-file-diff
|
||||||
|
.d2h-ins.d2h-change {
|
||||||
|
background-color: rgba(37, 78, 37, 0.418);
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-wrapper {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-wrapper a {
|
||||||
|
color: #3572b0;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"]
|
||||||
|
.d2h-file-list-wrapper
|
||||||
|
a:visited {
|
||||||
|
color: #3572b0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-header {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-title {
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-line {
|
||||||
|
display: -webkit-box;
|
||||||
|
display: -ms-flexbox;
|
||||||
|
display: flex;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list {
|
||||||
|
display: block;
|
||||||
|
list-style: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list > li {
|
||||||
|
border-bottom: 1px solid var(--background-modifier-border);
|
||||||
|
margin: 0;
|
||||||
|
padding: 5px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list > li:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-file-switch {
|
||||||
|
cursor: pointer;
|
||||||
|
display: none;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-icon {
|
||||||
|
fill: currentColor;
|
||||||
|
margin-right: 10px;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-deleted {
|
||||||
|
color: #c33;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-added {
|
||||||
|
color: #399839;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-changed {
|
||||||
|
color: #d0b44c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-moved {
|
||||||
|
color: #3572b0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-tag {
|
||||||
|
background-color: var(--background-primary);
|
||||||
|
display: -webkit-box;
|
||||||
|
display: -ms-flexbox;
|
||||||
|
display: flex;
|
||||||
|
font-size: 10px;
|
||||||
|
margin-left: 5px;
|
||||||
|
padding: 0 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-deleted-tag {
|
||||||
|
border: 2px solid #c33;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-added-tag {
|
||||||
|
border: 1px solid #399839;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-changed-tag {
|
||||||
|
border: 1px solid #d0b44c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace-leaf-content[data-type="diff-view"] .d2h-moved-tag {
|
||||||
|
border: 1px solid #3572b0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ====================== Line Authoring Information ====================== */
|
||||||
|
|
||||||
|
.cm-gutterElement.obs-git-blame-gutter {
|
||||||
|
/* Add background color to spacing inbetween and around the gutter for better aesthetics */
|
||||||
|
border-width: 0px 2px 0.2px 2px;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: var(--background-secondary);
|
||||||
|
background-color: var(--background-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-gutterElement.obs-git-blame-gutter > div,
|
||||||
|
.line-author-settings-preview {
|
||||||
|
/* delegate text color to settings */
|
||||||
|
color: var(--obs-git-gutter-text);
|
||||||
|
font-family: monospace;
|
||||||
|
height: 100%; /* ensure, that age-based background color occupies entire parent */
|
||||||
|
text-align: right;
|
||||||
|
padding: 0px 6px 0px 6px;
|
||||||
|
white-space: pre; /* Keep spaces and do not collapse them. */
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 800px) {
|
||||||
|
/* hide git blame gutter not to superpose text */
|
||||||
|
.cm-gutterElement.obs-git-blame-gutter {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.git-unified-diff-view,
|
||||||
|
.git-split-diff-view .cm-deletedLine .cm-changedText {
|
||||||
|
background-color: #ee443330;
|
||||||
|
}
|
||||||
|
|
||||||
|
.git-unified-diff-view,
|
||||||
|
.git-split-diff-view .cm-insertedLine .cm-changedText {
|
||||||
|
background-color: #22bb2230;
|
||||||
|
}
|
||||||
|
|
||||||
|
.git-obscure-prompt[git-is-obscured="true"] #git-show-password:after {
|
||||||
|
-webkit-mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-eye"><path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"></path><circle cx="12" cy="12" r="3"></circle></svg>');
|
||||||
|
}
|
||||||
|
|
||||||
|
.git-obscure-prompt[git-is-obscured="false"] #git-show-password:after {
|
||||||
|
-webkit-mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-eye-off"><path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"></path><path d="M14.084 14.158a3 3 0 0 1-4.242-4.242"></path><path d="M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"></path><path d="m2 2 20 20"></path></svg>');
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Override styling of Codemirror merge view "collapsed lines" indicator */
|
||||||
|
.git-split-diff-view .ͼ2 .cm-collapsedLines {
|
||||||
|
background: var(--interactive-normal);
|
||||||
|
border-radius: var(--radius-m);
|
||||||
|
color: var(--text-accent);
|
||||||
|
font-size: var(--font-small);
|
||||||
|
padding: var(--size-4-1) var(--size-4-1);
|
||||||
|
}
|
||||||
|
.git-split-diff-view .ͼ2 .cm-collapsedLines:hover {
|
||||||
|
background: var(--interactive-hover);
|
||||||
|
color: var(--text-accent-hover);
|
||||||
|
}
|
||||||
+185
@@ -0,0 +1,185 @@
|
|||||||
|
{
|
||||||
|
"main": {
|
||||||
|
"id": "dae69fdd3b47a4d7",
|
||||||
|
"type": "split",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "54aed1b31881bfe8",
|
||||||
|
"type": "tabs",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "2ce026f3ab9af9f8",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "markdown",
|
||||||
|
"state": {
|
||||||
|
"file": "Rating Overview/Needs Met.md",
|
||||||
|
"mode": "source",
|
||||||
|
"source": false
|
||||||
|
},
|
||||||
|
"icon": "lucide-file",
|
||||||
|
"title": "Needs Met"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"direction": "vertical"
|
||||||
|
},
|
||||||
|
"left": {
|
||||||
|
"id": "0c254c8309ee602e",
|
||||||
|
"type": "split",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "99f8a6404562a71e",
|
||||||
|
"type": "tabs",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "246950bc76f43a59",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "file-explorer",
|
||||||
|
"state": {
|
||||||
|
"sortOrder": "alphabetical",
|
||||||
|
"autoReveal": false
|
||||||
|
},
|
||||||
|
"icon": "lucide-folder-closed",
|
||||||
|
"title": "Files"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "7271ec52b1c934a0",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "search",
|
||||||
|
"state": {
|
||||||
|
"query": "",
|
||||||
|
"matchingCase": false,
|
||||||
|
"explainSearch": false,
|
||||||
|
"collapseAll": false,
|
||||||
|
"extraContext": false,
|
||||||
|
"sortOrder": "alphabetical"
|
||||||
|
},
|
||||||
|
"icon": "lucide-search",
|
||||||
|
"title": "Search"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "eab78f1dc1101f8d",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "bookmarks",
|
||||||
|
"state": {},
|
||||||
|
"icon": "lucide-bookmark",
|
||||||
|
"title": "Bookmarks"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"direction": "horizontal",
|
||||||
|
"width": 300
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
"id": "c11231216b231d67",
|
||||||
|
"type": "split",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "9cc00f6d6b8426e7",
|
||||||
|
"type": "tabs",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "c421609821539bfa",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "backlink",
|
||||||
|
"state": {
|
||||||
|
"file": "Rating Overview/Needs Met.md",
|
||||||
|
"collapseAll": false,
|
||||||
|
"extraContext": false,
|
||||||
|
"sortOrder": "alphabetical",
|
||||||
|
"showSearch": false,
|
||||||
|
"searchQuery": "",
|
||||||
|
"backlinkCollapsed": false,
|
||||||
|
"unlinkedCollapsed": true
|
||||||
|
},
|
||||||
|
"icon": "links-coming-in",
|
||||||
|
"title": "Backlinks for Needs Met"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "c3789511a5537015",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "outgoing-link",
|
||||||
|
"state": {
|
||||||
|
"file": "Rating Overview/Page Quality.md",
|
||||||
|
"linksCollapsed": false,
|
||||||
|
"unlinkedCollapsed": true
|
||||||
|
},
|
||||||
|
"icon": "links-going-out",
|
||||||
|
"title": "Outgoing links from Page Quality"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "65b45b489eb44da6",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "tag",
|
||||||
|
"state": {
|
||||||
|
"sortOrder": "frequency",
|
||||||
|
"useHierarchy": true,
|
||||||
|
"showSearch": false,
|
||||||
|
"searchQuery": ""
|
||||||
|
},
|
||||||
|
"icon": "lucide-tags",
|
||||||
|
"title": "Tags"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "eb77695a8b55950d",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "outline",
|
||||||
|
"state": {
|
||||||
|
"file": "Rating Overview/Page Quality.md",
|
||||||
|
"followCursor": false,
|
||||||
|
"showSearch": false,
|
||||||
|
"searchQuery": ""
|
||||||
|
},
|
||||||
|
"icon": "lucide-list",
|
||||||
|
"title": "Outline of Page Quality"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"direction": "horizontal",
|
||||||
|
"width": 300,
|
||||||
|
"collapsed": true
|
||||||
|
},
|
||||||
|
"left-ribbon": {
|
||||||
|
"hiddenItems": {
|
||||||
|
"bases:Create new base": false,
|
||||||
|
"switcher:Open quick switcher": false,
|
||||||
|
"graph:Open graph view": false,
|
||||||
|
"canvas:Create new canvas": false,
|
||||||
|
"daily-notes:Open today's daily note": false,
|
||||||
|
"templates:Insert template": false,
|
||||||
|
"command-palette:Open command palette": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"active": "2ce026f3ab9af9f8",
|
||||||
|
"lastOpenFiles": [
|
||||||
|
"Untitled.canvas",
|
||||||
|
"Rating Overview/Needs Met.md",
|
||||||
|
"Untitled.base",
|
||||||
|
"Rating Overview/Page Quality.md",
|
||||||
|
"Untitled 3.base",
|
||||||
|
"Untitled 1.base",
|
||||||
|
"Untitled 2.base",
|
||||||
|
"Rating Overview.md",
|
||||||
|
"Rating Overview",
|
||||||
|
"Welcome.md"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
Based on both the query and the result.
|
||||||
|
## Fully Meets
|
||||||
|
|
||||||
|
Few queries can have fully meets results.
|
||||||
|
|
||||||
|
Only applies when all of the following are true:
|
||||||
|
- The query interpretation and user intent is ==specific, clear, and unambiguous==.
|
||||||
|
- There is a ==specific website, webpage, or know-simple fact== or other specific result that all or almost all users in the rating locale and user location are looking for.
|
||||||
|
- All or almost all users in the rating locale and user location would be completely satisfied by the result.
|
||||||
|
|
||||||
|
## Highly Meets
|
||||||
|
|
||||||
|
Results are highly satisfying and a good "fit" for reasonable interpretations and intents.
|
||||||
|
|
||||||
|
- ==Entertaining or enjoyable== for queries with a reasonable entertainment intent.
|
||||||
|
- Representative of the opinions, perspectives and experience of real people for queries with no single right answer.
|
||||||
|
- For informational queries, very helpful results that, for example:
|
||||||
|
- Are easy to understand the content, e.g., helpful images or videos, an easy to understand summary.
|
||||||
|
- Provide in-depth or insightful content, e.g., a deep dive explanation, an expert analysis.
|
||||||
|
- For queries that benefit from recently created content, fresh results that provide ==up-to-date content== on "what everyone is talking about right now" e.g., breaking news on a topic or the latest viral video or a hot new fashion trend.
|
||||||
|
|
||||||
|
- ==Accuracy is required== for Highly Meets informational results.
|
||||||
|
- Information pages on ==YMYL topics must be accurate and trustworthy==.
|
||||||
|
- Medical/Scientific information pages must represent ==well-established consensus== unless the user is clearly seeking an alternative viewpoint.
|
||||||
|
|
||||||
|
## Moderately Meets
|
||||||
|
|
||||||
|
Still "fits" the query, but less satisfying than HM results.
|
||||||
|
|
||||||
|
Assigned to helpful results for any reasonable interpretation or user intent of the query, including reasonable minor interpretations and intents.
|
||||||
|
|
||||||
|
- May be ==less representative of the opinions, perspectives and experience== of real people for queries with no single right answer.
|
||||||
|
- For informational queries, MM results might have content that is ==slightly harder to understand== than HM results.
|
||||||
|
- MM results may be ==slightly out of date== for queries that benefit from recently created content.
|
||||||
|
|
||||||
|
MM is an acceptable rating if you see aspects that are HM but other aspects seem SM.
|
||||||
|
|
||||||
|
## Slightly Meets
|
||||||
|
|
||||||
|
Results that are less helpful for a reasonable query interpretation or user intent.
|
||||||
|
|
||||||
|
==Slightly Meets can also be an appropriate rating for a result which is related to the user’s information need without fully addressing it, as long as it provides some value to the user. However, if the user is looking for a specific piece of information, a result which does not provide that information, or a result which misses a key aspect of the query, cannot be rated Slightly Meets and should be rated Fails to Meet.==
|
||||||
|
|
||||||
|
## Fails to Meet
|
||||||
|
|
||||||
|
Assigned to results that fail to meet the needs of all or almost all users.
|
||||||
|
|
||||||
|
Should be rated FM if it is clear the user is not looking for such content:
|
||||||
|
- Harmful to Self or Other Individuals
|
||||||
|
- Harmful to Specified Groups
|
||||||
|
- Harmfully Misleading Information
|
||||||
|
- Untrustworthy
|
||||||
|
- Spammy
|
||||||
|
- Porn
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
PQ is independent of NM
|
||||||
|
|
||||||
|
## Steps
|
||||||
|
1. Assess the true purpose of the page.
|
||||||
|
2. Assess the potential of the page to cause harm.
|
||||||
|
3. Otherwise, the PQ rating is based on how well the page achieves its purpose.
|
||||||
|
## Considerations
|
||||||
|
- Purpose of page
|
||||||
|
- Potential to cause harm
|
||||||
|
- The type of website
|
||||||
|
- Information provided by the website and content creator
|
||||||
|
- Quality of the MC
|
||||||
|
- Page Title
|
||||||
|
- The role of Ads and SC on the page
|
||||||
|
- Reputation of the website and content creator
|
||||||
|
- Trustworthiness of the page: E-E-A-T (Experience, Expertise, Authoritativeness, Trust)
|
||||||
|
|
||||||
|
## Highest Quality
|
||||||
|
|
||||||
|
Pages that serve a ==beneficial purpose== and ==achieve that purpose very well==.
|
||||||
|
|
||||||
|
- Beneficial purpose
|
||||||
|
- Not expected to cause harm
|
||||||
|
- Title that summarizes the page
|
||||||
|
- Ads and SC do not block or significantly interfere with the MC
|
||||||
|
- Adequate information about the website and content creator
|
||||||
|
- MC created with a very high level of effort, originality, talent, or skill
|
||||||
|
- Very positive reputation of the website
|
||||||
|
- Very positive reputation of the content creator
|
||||||
|
|
||||||
|
The distinction between High and Highest is based on:
|
||||||
|
- The Quality of the MC
|
||||||
|
- The reputation of the Website and Content Creator
|
||||||
|
- EEAT
|
||||||
|
|
||||||
|
## High Quality
|
||||||
|
|
||||||
|
Pages that serve a ==beneficial purpose== and ==achieve that purpose well==.
|
||||||
|
|
||||||
|
- Beneficial purpose
|
||||||
|
- Not expected to cause harm
|
||||||
|
- Title summarizes the page
|
||||||
|
- Ads and SC do not block or significantly interfere with the MC
|
||||||
|
- Adequate information about the website and content creator
|
||||||
|
- MC created with a high level of effort, originality, talent, or skill
|
||||||
|
- Positive reputation of the website
|
||||||
|
- Positive reputation of the content creator
|
||||||
|
|
||||||
|
## Medium Quality
|
||||||
|
|
||||||
|
Pages that have a ==beneficial purpose== and ==achieve their purpose==. There is ==nothing wrong== with these pages.
|
||||||
|
|
||||||
|
- Beneficial or non-harmful purpose
|
||||||
|
- Not expected to cause harm
|
||||||
|
- Title that summarizes the page
|
||||||
|
- Ads and SC do not block or significantly interfere with the MC
|
||||||
|
- Adequate information about the website and content creator
|
||||||
|
- MC created with adequate effort, originality, talent, or skill
|
||||||
|
- Not especially positive nor especially negative reputation
|
||||||
|
|
||||||
|
## Low Quality
|
||||||
|
|
||||||
|
Pages that do not achieve their purpose well because they are ==lacking in an important dimension== or have a ==problematic aspect==.
|
||||||
|
|
||||||
|
- Beneficial or non-harmful purpose
|
||||||
|
- No potential or Mild potential for harm
|
||||||
|
- Content creator lacks adequate experience
|
||||||
|
- Website or Content creator is not an authoritative or trustworthy source for the topic
|
||||||
|
- Low Effort, Originality, or Added Value for Website Visitors
|
||||||
|
- Distracting Ads/SC
|
||||||
|
- Mildly Negative Reputation
|
||||||
|
- Unsatisfying Amount of Information
|
||||||
|
|
||||||
|
## Lowest Quality
|
||||||
|
|
||||||
|
Pages are ==untrustworthy, deceptive, harmful to people or society==, or have other highly undesirable characteristics.
|
||||||
|
|
||||||
|
- Harmful or Deceives
|
||||||
|
- Deceptive Purpose
|
||||||
|
- Deceptive Information
|
||||||
|
- Deceptive Design
|
||||||
|
- Harmfully misleading information
|
||||||
|
- Benefits the owner with very little or no attempt to benefit website visitors
|
||||||
|
- Hacked, Defaced, or Spammed
|
||||||
|
- Gibberish or makes no sense
|
||||||
|
- Little Effort, little to no originality, adds no value
|
||||||
|
- Title is misleading, shocking, or exaggerated
|
||||||
|
- MC is obstructed or obscured
|
||||||
|
- A complete lack of information about who is responsible for the website and its content for pages requiring trust
|
||||||
|
- Negative reputation
|
||||||
|
- Untrustworthy
|
||||||
|
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"vimMode": true
|
||||||
|
}
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
+4
@@ -0,0 +1,4 @@
|
|||||||
|
[
|
||||||
|
"obsidian-prozen",
|
||||||
|
"cm-typewriter-scroll-obsidian"
|
||||||
|
]
|
||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"file-explorer": true,
|
||||||
|
"global-search": true,
|
||||||
|
"switcher": true,
|
||||||
|
"graph": true,
|
||||||
|
"backlink": true,
|
||||||
|
"canvas": true,
|
||||||
|
"outgoing-link": true,
|
||||||
|
"tag-pane": true,
|
||||||
|
"footnotes": false,
|
||||||
|
"properties": false,
|
||||||
|
"page-preview": true,
|
||||||
|
"daily-notes": true,
|
||||||
|
"templates": true,
|
||||||
|
"note-composer": true,
|
||||||
|
"command-palette": true,
|
||||||
|
"slash-command": false,
|
||||||
|
"editor-status": true,
|
||||||
|
"bookmarks": true,
|
||||||
|
"markdown-importer": false,
|
||||||
|
"zk-prefixer": false,
|
||||||
|
"random-note": false,
|
||||||
|
"outline": true,
|
||||||
|
"word-count": true,
|
||||||
|
"slides": false,
|
||||||
|
"audio-recorder": false,
|
||||||
|
"workspaces": false,
|
||||||
|
"file-recovery": true,
|
||||||
|
"publish": false,
|
||||||
|
"sync": true,
|
||||||
|
"bases": true,
|
||||||
|
"webviewer": false
|
||||||
|
}
|
||||||
Vendored
+10
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"obsidian-prozen:zenmode": [
|
||||||
|
{
|
||||||
|
"modifiers": [
|
||||||
|
"Alt"
|
||||||
|
],
|
||||||
|
"key": "Z"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,427 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var obsidian = require('obsidian');
|
||||||
|
var state = require('@codemirror/state');
|
||||||
|
var view = require('@codemirror/view');
|
||||||
|
|
||||||
|
/*! *****************************************************************************
|
||||||
|
Copyright (c) Microsoft Corporation.
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
***************************************************************************** */
|
||||||
|
/* global Reflect, Promise */
|
||||||
|
|
||||||
|
var extendStatics = function(d, b) {
|
||||||
|
extendStatics = Object.setPrototypeOf ||
|
||||||
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||||
|
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||||
|
return extendStatics(d, b);
|
||||||
|
};
|
||||||
|
|
||||||
|
function __extends(d, b) {
|
||||||
|
if (typeof b !== "function" && b !== null)
|
||||||
|
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||||
|
extendStatics(d, b);
|
||||||
|
function __() { this.constructor = d; }
|
||||||
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||||
|
}
|
||||||
|
|
||||||
|
function __awaiter(thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function __generator(thisArg, body) {
|
||||||
|
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||||
|
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||||
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||||
|
function step(op) {
|
||||||
|
if (f) throw new TypeError("Generator is already executing.");
|
||||||
|
while (_) try {
|
||||||
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||||
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||||
|
switch (op[0]) {
|
||||||
|
case 0: case 1: t = op; break;
|
||||||
|
case 4: _.label++; return { value: op[1], done: false };
|
||||||
|
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||||
|
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||||
|
default:
|
||||||
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||||
|
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||||
|
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||||
|
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||||
|
if (t[2]) _.ops.pop();
|
||||||
|
_.trys.pop(); continue;
|
||||||
|
}
|
||||||
|
op = body.call(thisArg, _);
|
||||||
|
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||||
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// all credit to azu: https://github.com/azu/codemirror-typewriter-scrolling/blob/b0ac076d72c9445c96182de87d974de2e8cc56e2/typewriter-scrolling.js
|
||||||
|
var movedByMouse = false;
|
||||||
|
CodeMirror.commands.scrollSelectionToCenter = function (cm) {
|
||||||
|
var cursor = cm.getCursor('head');
|
||||||
|
var charCoords = cm.charCoords(cursor, "local");
|
||||||
|
var top = charCoords.top;
|
||||||
|
var halfLineHeight = (charCoords.bottom - top) / 2;
|
||||||
|
var halfWindowHeight = cm.getWrapperElement().offsetHeight / 2;
|
||||||
|
var scrollTo = Math.round((top - halfWindowHeight + halfLineHeight));
|
||||||
|
cm.scrollTo(null, scrollTo);
|
||||||
|
};
|
||||||
|
CodeMirror.defineOption("typewriterScrolling", false, function (cm, val, old) {
|
||||||
|
if (old && old != CodeMirror.Init) {
|
||||||
|
const linesEl = cm.getScrollerElement().querySelector('.CodeMirror-lines');
|
||||||
|
linesEl.style.paddingTop = null;
|
||||||
|
linesEl.style.paddingBottom = null;
|
||||||
|
cm.off("cursorActivity", onCursorActivity);
|
||||||
|
cm.off("refresh", onRefresh);
|
||||||
|
cm.off("mousedown", onMouseDown);
|
||||||
|
cm.off("keydown", onKeyDown);
|
||||||
|
cm.off("beforeChange", onBeforeChange);
|
||||||
|
}
|
||||||
|
if (val) {
|
||||||
|
onRefresh(cm);
|
||||||
|
cm.on("cursorActivity", onCursorActivity);
|
||||||
|
cm.on("refresh", onRefresh);
|
||||||
|
cm.on("mousedown", onMouseDown);
|
||||||
|
cm.on("keydown", onKeyDown);
|
||||||
|
cm.on("beforeChange", onBeforeChange);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
function onMouseDown() {
|
||||||
|
movedByMouse = true;
|
||||||
|
}
|
||||||
|
const modiferKeys = ["Alt", "AltGraph", "CapsLock", "Control", "Fn", "FnLock", "Hyper", "Meta", "NumLock", "ScrollLock", "Shift", "Super", "Symbol", "SymbolLock"];
|
||||||
|
function onKeyDown(cm, e) {
|
||||||
|
if (!modiferKeys.includes(e.key)) {
|
||||||
|
movedByMouse = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function onBeforeChange() {
|
||||||
|
movedByMouse = false;
|
||||||
|
}
|
||||||
|
function onCursorActivity(cm) {
|
||||||
|
const linesEl = cm.getScrollerElement().querySelector('.CodeMirror-lines');
|
||||||
|
if (cm.getSelection().length !== 0) {
|
||||||
|
linesEl.classList.add("selecting");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
linesEl.classList.remove("selecting");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!movedByMouse) {
|
||||||
|
cm.execCommand("scrollSelectionToCenter");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function onRefresh(cm) {
|
||||||
|
const halfWindowHeight = cm.getWrapperElement().offsetHeight / 2;
|
||||||
|
const linesEl = cm.getScrollerElement().querySelector('.CodeMirror-lines');
|
||||||
|
linesEl.style.paddingTop = `${halfWindowHeight}px`;
|
||||||
|
linesEl.style.paddingBottom = `${halfWindowHeight}px`; // Thanks @walulula!
|
||||||
|
if (cm.getSelection().length === 0) {
|
||||||
|
cm.execCommand("scrollSelectionToCenter");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var allowedUserEvents = /^(select|input|delete|undo|redo)(\..+)?$/;
|
||||||
|
var disallowedUserEvents = /^(select.pointer)$/;
|
||||||
|
var typewriterOffset = state.Facet.define({
|
||||||
|
combine: function (values) { return values.length ? Math.min.apply(Math, values) : 0.5; }
|
||||||
|
});
|
||||||
|
var resetTypewriterScrollPaddingPlugin = view.ViewPlugin.fromClass(/** @class */ (function () {
|
||||||
|
function class_1(view) {
|
||||||
|
this.view = view;
|
||||||
|
}
|
||||||
|
class_1.prototype.update = function (update) {
|
||||||
|
if (this.view.contentDOM.style.paddingTop) {
|
||||||
|
this.view.contentDOM.style.paddingTop = "";
|
||||||
|
this.view.contentDOM.style.paddingBottom = (update.view.dom.clientHeight / 2) + "px";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return class_1;
|
||||||
|
}()));
|
||||||
|
var typewriterScrollPaddingPlugin = view.ViewPlugin.fromClass(/** @class */ (function () {
|
||||||
|
function class_2(view) {
|
||||||
|
this.view = view;
|
||||||
|
this.topPadding = null;
|
||||||
|
}
|
||||||
|
class_2.prototype.update = function (update) {
|
||||||
|
var offset = (update.view.dom.clientHeight * update.view.state.facet(typewriterOffset)) - (update.view.defaultLineHeight / 2);
|
||||||
|
this.topPadding = offset + "px";
|
||||||
|
if (this.topPadding != this.view.contentDOM.style.paddingTop) {
|
||||||
|
this.view.contentDOM.style.paddingTop = this.topPadding;
|
||||||
|
this.view.contentDOM.style.paddingBottom = (update.view.dom.clientHeight - offset) + "px";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return class_2;
|
||||||
|
}()));
|
||||||
|
var typewriterScrollPlugin = view.ViewPlugin.fromClass(/** @class */ (function () {
|
||||||
|
function class_3(view) {
|
||||||
|
this.view = view;
|
||||||
|
this.myUpdate = false;
|
||||||
|
}
|
||||||
|
class_3.prototype.update = function (update) {
|
||||||
|
if (this.myUpdate)
|
||||||
|
this.myUpdate = false;
|
||||||
|
else {
|
||||||
|
var userEvents = update.transactions.map(function (tr) { return tr.annotation(state.Transaction.userEvent); });
|
||||||
|
var isAllowed = userEvents.reduce(function (result, event) { return result && allowedUserEvents.test(event) && !disallowedUserEvents.test(event); }, userEvents.length > 0);
|
||||||
|
if (isAllowed) {
|
||||||
|
this.myUpdate = true;
|
||||||
|
this.centerOnHead(update);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
class_3.prototype.centerOnHead = function (update) {
|
||||||
|
return __awaiter(this, void 0, void 0, function () {
|
||||||
|
var _this = this;
|
||||||
|
return __generator(this, function (_a) {
|
||||||
|
// can't update inside an update, so request the next animation frame
|
||||||
|
window.requestAnimationFrame(function () {
|
||||||
|
// current selection range
|
||||||
|
if (update.state.selection.ranges.length == 1) {
|
||||||
|
// only act on the one range
|
||||||
|
var head = update.state.selection.main.head;
|
||||||
|
var prevHead = update.startState.selection.main.head;
|
||||||
|
// TODO: work out line number and use that instead? Is that even possible?
|
||||||
|
// don't bother with this next part if the range (line??) hasn't changed
|
||||||
|
if (prevHead != head) {
|
||||||
|
// this is the effect that does the centering
|
||||||
|
var offset = (update.view.dom.clientHeight * update.view.state.facet(typewriterOffset)) - (update.view.defaultLineHeight / 2);
|
||||||
|
var effect = view.EditorView.scrollIntoView(head, { y: "start", yMargin: offset });
|
||||||
|
// const effect = EditorView.scrollIntoView(head, { y: "center" });
|
||||||
|
var transaction = _this.view.state.update({ effects: effect });
|
||||||
|
_this.view.dispatch(transaction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return [2 /*return*/];
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
return class_3;
|
||||||
|
}()));
|
||||||
|
function typewriterScroll(options) {
|
||||||
|
if (options === void 0) { options = {}; }
|
||||||
|
return [
|
||||||
|
options.typewriterOffset == null ? [] : typewriterOffset.of(options.typewriterOffset),
|
||||||
|
typewriterScrollPaddingPlugin,
|
||||||
|
typewriterScrollPlugin
|
||||||
|
];
|
||||||
|
}
|
||||||
|
function resetTypewriterSrcoll() {
|
||||||
|
return [
|
||||||
|
resetTypewriterScrollPaddingPlugin
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
var DEFAULT_SETTINGS = {
|
||||||
|
enabled: true,
|
||||||
|
typewriterOffset: 0.5,
|
||||||
|
zenEnabled: false,
|
||||||
|
zenOpacity: 0.25
|
||||||
|
};
|
||||||
|
var CMTypewriterScrollPlugin = /** @class */ (function (_super) {
|
||||||
|
__extends(CMTypewriterScrollPlugin, _super);
|
||||||
|
function CMTypewriterScrollPlugin() {
|
||||||
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||||
|
_this.extArray = [];
|
||||||
|
_this.toggleTypewriterScroll = function (newValue) {
|
||||||
|
if (newValue === void 0) { newValue = null; }
|
||||||
|
// if no value is passed in, toggle the existing value
|
||||||
|
if (newValue === null)
|
||||||
|
newValue = !_this.settings.enabled;
|
||||||
|
// assign the new value and call the correct enable / disable function
|
||||||
|
(_this.settings.enabled = newValue)
|
||||||
|
? _this.enableTypewriterScroll() : _this.disableTypewriterScroll();
|
||||||
|
// save the new settings
|
||||||
|
_this.saveData(_this.settings);
|
||||||
|
};
|
||||||
|
_this.changeTypewriterOffset = function (newValue) {
|
||||||
|
_this.settings.typewriterOffset = newValue;
|
||||||
|
if (_this.settings.enabled) {
|
||||||
|
_this.disableTypewriterScroll();
|
||||||
|
// delete the extension, so it gets recreated with the new value
|
||||||
|
delete _this.ext;
|
||||||
|
_this.enableTypewriterScroll();
|
||||||
|
}
|
||||||
|
_this.saveData(_this.settings);
|
||||||
|
};
|
||||||
|
_this.toggleZen = function (newValue) {
|
||||||
|
if (newValue === void 0) { newValue = null; }
|
||||||
|
// if no value is passed in, toggle the existing value
|
||||||
|
if (newValue === null)
|
||||||
|
newValue = !_this.settings.zenEnabled;
|
||||||
|
// assign the new value and call the correct enable / disable function
|
||||||
|
(_this.settings.zenEnabled = newValue)
|
||||||
|
? _this.enableZen() : _this.disableZen();
|
||||||
|
// save the new settings
|
||||||
|
_this.saveData(_this.settings);
|
||||||
|
};
|
||||||
|
_this.changeZenOpacity = function (newValue) {
|
||||||
|
if (newValue === void 0) { newValue = 0.25; }
|
||||||
|
_this.settings.zenOpacity = newValue;
|
||||||
|
_this.css.innerText = "body{--zen-opacity: ".concat(newValue, ";}");
|
||||||
|
// save the new settings
|
||||||
|
_this.saveData(_this.settings);
|
||||||
|
};
|
||||||
|
_this.enableTypewriterScroll = function () {
|
||||||
|
// add the class
|
||||||
|
document.body.classList.add('plugin-cm-typewriter-scroll');
|
||||||
|
// register the codemirror add on setting
|
||||||
|
_this.registerCodeMirror(function (cm) {
|
||||||
|
// @ts-ignore
|
||||||
|
cm.setOption("typewriterScrolling", true);
|
||||||
|
});
|
||||||
|
if (!_this.ext) {
|
||||||
|
_this.ext = typewriterScroll({ typewriterOffset: _this.settings.typewriterOffset });
|
||||||
|
_this.extArray = [_this.ext];
|
||||||
|
_this.registerEditorExtension(_this.extArray);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_this.extArray.splice(0, _this.extArray.length);
|
||||||
|
_this.extArray.push(_this.ext);
|
||||||
|
_this.app.workspace.updateOptions();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
_this.disableTypewriterScroll = function () {
|
||||||
|
// remove the class
|
||||||
|
document.body.classList.remove('plugin-cm-typewriter-scroll');
|
||||||
|
// remove the codemirror add on setting
|
||||||
|
_this.app.workspace.iterateCodeMirrors(function (cm) {
|
||||||
|
// @ts-ignore
|
||||||
|
cm.setOption("typewriterScrolling", false);
|
||||||
|
});
|
||||||
|
// clear out the registered extension
|
||||||
|
_this.extArray.splice(0, _this.extArray.length);
|
||||||
|
_this.extArray.push(resetTypewriterSrcoll());
|
||||||
|
_this.app.workspace.updateOptions();
|
||||||
|
};
|
||||||
|
_this.enableZen = function () {
|
||||||
|
// add the class
|
||||||
|
document.body.classList.add('plugin-cm-typewriter-scroll-zen');
|
||||||
|
};
|
||||||
|
_this.disableZen = function () {
|
||||||
|
// remove the class
|
||||||
|
document.body.classList.remove('plugin-cm-typewriter-scroll-zen');
|
||||||
|
};
|
||||||
|
return _this;
|
||||||
|
}
|
||||||
|
CMTypewriterScrollPlugin.prototype.onload = function () {
|
||||||
|
return __awaiter(this, void 0, void 0, function () {
|
||||||
|
var _a, _b, _c, _d;
|
||||||
|
return __generator(this, function (_e) {
|
||||||
|
switch (_e.label) {
|
||||||
|
case 0:
|
||||||
|
_a = this;
|
||||||
|
_c = (_b = Object).assign;
|
||||||
|
_d = [DEFAULT_SETTINGS];
|
||||||
|
return [4 /*yield*/, this.loadData()];
|
||||||
|
case 1:
|
||||||
|
_a.settings = _c.apply(_b, _d.concat([_e.sent()]));
|
||||||
|
// enable the plugin (based on settings)
|
||||||
|
if (this.settings.enabled)
|
||||||
|
this.enableTypewriterScroll();
|
||||||
|
if (this.settings.zenEnabled)
|
||||||
|
this.enableZen();
|
||||||
|
this.css = document.createElement('style');
|
||||||
|
this.css.id = 'plugin-typewriter-scroll';
|
||||||
|
this.css.setAttr('type', 'text/css');
|
||||||
|
document.getElementsByTagName("head")[0].appendChild(this.css);
|
||||||
|
this.css.innerText = "body{--zen-opacity: ".concat(this.settings.zenOpacity, ";}");
|
||||||
|
// add the settings tab
|
||||||
|
this.addSettingTab(new CMTypewriterScrollSettingTab(this.app, this));
|
||||||
|
// add the commands / keyboard shortcuts
|
||||||
|
this.addCommands();
|
||||||
|
return [2 /*return*/];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
CMTypewriterScrollPlugin.prototype.onunload = function () {
|
||||||
|
// disable the plugin
|
||||||
|
this.disableTypewriterScroll();
|
||||||
|
this.disableZen();
|
||||||
|
};
|
||||||
|
CMTypewriterScrollPlugin.prototype.addCommands = function () {
|
||||||
|
var _this = this;
|
||||||
|
// add the toggle on/off command
|
||||||
|
this.addCommand({
|
||||||
|
id: 'toggle-typewriter-sroll',
|
||||||
|
name: 'Toggle On/Off',
|
||||||
|
callback: function () { _this.toggleTypewriterScroll(); }
|
||||||
|
});
|
||||||
|
// toggle zen mode
|
||||||
|
this.addCommand({
|
||||||
|
id: 'toggle-typewriter-sroll-zen',
|
||||||
|
name: 'Toggle Zen Mode On/Off',
|
||||||
|
callback: function () { _this.toggleZen(); }
|
||||||
|
});
|
||||||
|
};
|
||||||
|
return CMTypewriterScrollPlugin;
|
||||||
|
}(obsidian.Plugin));
|
||||||
|
var CMTypewriterScrollSettingTab = /** @class */ (function (_super) {
|
||||||
|
__extends(CMTypewriterScrollSettingTab, _super);
|
||||||
|
function CMTypewriterScrollSettingTab(app, plugin) {
|
||||||
|
var _this = _super.call(this, app, plugin) || this;
|
||||||
|
_this.plugin = plugin;
|
||||||
|
return _this;
|
||||||
|
}
|
||||||
|
CMTypewriterScrollSettingTab.prototype.display = function () {
|
||||||
|
var _this = this;
|
||||||
|
var containerEl = this.containerEl;
|
||||||
|
containerEl.empty();
|
||||||
|
new obsidian.Setting(containerEl)
|
||||||
|
.setName("Toggle Typewriter Scrolling")
|
||||||
|
.setDesc("Turns typewriter scrolling on or off globally")
|
||||||
|
.addToggle(function (toggle) {
|
||||||
|
return toggle.setValue(_this.plugin.settings.enabled)
|
||||||
|
.onChange(function (newValue) { _this.plugin.toggleTypewriterScroll(newValue); });
|
||||||
|
});
|
||||||
|
new obsidian.Setting(containerEl)
|
||||||
|
.setName("Center offset")
|
||||||
|
.setDesc("Positions the typewriter text at the specified percentage of the screen")
|
||||||
|
.addSlider(function (slider) {
|
||||||
|
return slider.setLimits(0, 100, 5)
|
||||||
|
.setValue(_this.plugin.settings.typewriterOffset * 100)
|
||||||
|
.onChange(function (newValue) { _this.plugin.changeTypewriterOffset(newValue / 100); });
|
||||||
|
});
|
||||||
|
new obsidian.Setting(containerEl)
|
||||||
|
.setName("Zen Mode")
|
||||||
|
.setDesc("Darkens non-active lines in the editor so you can focus on what you're typing")
|
||||||
|
.addToggle(function (toggle) {
|
||||||
|
return toggle.setValue(_this.plugin.settings.zenEnabled)
|
||||||
|
.onChange(function (newValue) { _this.plugin.toggleZen(newValue); });
|
||||||
|
});
|
||||||
|
new obsidian.Setting(containerEl)
|
||||||
|
.setName("Zen Opacity")
|
||||||
|
.setDesc("The opacity of unfocused lines in zen mode")
|
||||||
|
.addSlider(function (slider) {
|
||||||
|
return slider.setLimits(0, 100, 5)
|
||||||
|
.setValue(_this.plugin.settings.zenOpacity * 100)
|
||||||
|
.onChange(function (newValue) { _this.plugin.changeZenOpacity(newValue / 100); });
|
||||||
|
});
|
||||||
|
};
|
||||||
|
return CMTypewriterScrollSettingTab;
|
||||||
|
}(obsidian.PluginSettingTab));
|
||||||
|
|
||||||
|
module.exports = CMTypewriterScrollPlugin;
|
||||||
|
|
||||||
|
|
||||||
|
/* nosourcemap */
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"id": "cm-typewriter-scroll-obsidian",
|
||||||
|
"name": "Typewriter Scroll",
|
||||||
|
"author": "death_au",
|
||||||
|
"authorUrl": "https://github.com/deathau",
|
||||||
|
"description": "Typewriter-style scrolling which keeps the view centered in the editor.",
|
||||||
|
"isDesktopOnly": false,
|
||||||
|
"version": "0.2.2",
|
||||||
|
"minAppVersion": "0.10.0"
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
body.plugin-cm-typewriter-scroll-zen .CodeMirror-lines:not(.selecting) .CodeMirror-code > :not(.CodeMirror-activeline) {
|
||||||
|
opacity: var(--zen-opacity);
|
||||||
|
}
|
||||||
|
body.plugin-cm-typewriter-scroll-zen .cm-editor.cm-focused .cm-line:not(.cm-active) {
|
||||||
|
opacity: var(--zen-opacity);
|
||||||
|
}
|
||||||
@@ -0,0 +1,197 @@
|
|||||||
|
/*
|
||||||
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||||||
|
if you want to view the source, please visit the github repository of this plugin
|
||||||
|
*/
|
||||||
|
|
||||||
|
var __defProp = Object.defineProperty;
|
||||||
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||||
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||||
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||||
|
var __export = (target, all) => {
|
||||||
|
for (var name in all)
|
||||||
|
__defProp(target, name, { get: all[name], enumerable: true });
|
||||||
|
};
|
||||||
|
var __copyProps = (to, from, except, desc) => {
|
||||||
|
if (from && typeof from === "object" || typeof from === "function") {
|
||||||
|
for (let key of __getOwnPropNames(from))
|
||||||
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||||
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||||
|
}
|
||||||
|
return to;
|
||||||
|
};
|
||||||
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||||
|
|
||||||
|
// main.ts
|
||||||
|
var main_exports = {};
|
||||||
|
__export(main_exports, {
|
||||||
|
default: () => Prozen
|
||||||
|
});
|
||||||
|
module.exports = __toCommonJS(main_exports);
|
||||||
|
var import_obsidian = require("obsidian");
|
||||||
|
var DEFAULT_SETTINGS = {
|
||||||
|
animationDuration: 2,
|
||||||
|
showHeader: false,
|
||||||
|
showScroll: false,
|
||||||
|
showGraphControls: false,
|
||||||
|
forceReadable: true,
|
||||||
|
vignetteOpacity: 0.75,
|
||||||
|
vignetteScaleLinear: 20,
|
||||||
|
vignetteScaleRadial: 75
|
||||||
|
};
|
||||||
|
var Prozen = class extends import_obsidian.Plugin {
|
||||||
|
async onload() {
|
||||||
|
await this.loadSettings();
|
||||||
|
this.addCommand({
|
||||||
|
id: "zenmode",
|
||||||
|
name: "Zen mode",
|
||||||
|
callback: this.fullscreenMode.bind(this)
|
||||||
|
});
|
||||||
|
this.addSettingTab(new ProzenSettingTab(this.app, this));
|
||||||
|
}
|
||||||
|
onunload() {
|
||||||
|
}
|
||||||
|
async loadSettings() {
|
||||||
|
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
|
||||||
|
}
|
||||||
|
async saveSettings() {
|
||||||
|
await this.saveData(this.settings);
|
||||||
|
}
|
||||||
|
fullscreenMode() {
|
||||||
|
const leaf = this.app.workspace.getActiveViewOfType(import_obsidian.ItemView).leaf;
|
||||||
|
if (!leaf)
|
||||||
|
return;
|
||||||
|
if (leaf.view.getViewType() === "empty")
|
||||||
|
return;
|
||||||
|
const root = document.documentElement;
|
||||||
|
root.style.setProperty("--fadeIn-duration", this.settings.animationDuration + "s");
|
||||||
|
root.style.setProperty("--vignette-opacity", this.settings.vignetteOpacity);
|
||||||
|
root.style.setProperty("--vignette-scale-linear", this.settings.vignetteScaleLinear + "%");
|
||||||
|
root.style.setProperty("--vignette-scale-radial", this.settings.vignetteScaleRadial + "%");
|
||||||
|
const containerEl = leaf.containerEl;
|
||||||
|
if (!document.fullscreenElement) {
|
||||||
|
containerEl.requestFullscreen();
|
||||||
|
this.addStyles(leaf);
|
||||||
|
} else {
|
||||||
|
document.exitFullscreen();
|
||||||
|
this.removeStyles(leaf);
|
||||||
|
}
|
||||||
|
containerEl.onfullscreenchange = () => {
|
||||||
|
if (!document.fullscreenElement) {
|
||||||
|
this.removeStyles(leaf);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
addStyles(leaf) {
|
||||||
|
const viewEl = leaf.view.contentEl;
|
||||||
|
const header = leaf.view.headerEl;
|
||||||
|
const isGraph = leaf.view.getViewType() === "graph";
|
||||||
|
let graphControls;
|
||||||
|
if (isGraph) {
|
||||||
|
graphControls = leaf.view.dataEngine.controlsEl;
|
||||||
|
}
|
||||||
|
if (!this.settings.showScroll) {
|
||||||
|
viewEl.classList.add("noscroll");
|
||||||
|
}
|
||||||
|
if (isGraph && !this.settings.showGraphControls) {
|
||||||
|
graphControls.classList.add("hide");
|
||||||
|
}
|
||||||
|
isGraph ? viewEl.classList.add("vignette-radial") : viewEl.classList.add("vignette-linear");
|
||||||
|
if (!isGraph && this.settings.forceReadable) {
|
||||||
|
leaf.view.editMode.editorEl.classList.add("is-readable-line-width");
|
||||||
|
}
|
||||||
|
viewEl.classList.add("animate");
|
||||||
|
this.settings.showHeader ? header.classList.add("animate") : header.classList.add("hide");
|
||||||
|
}
|
||||||
|
removeStyles(leaf) {
|
||||||
|
const viewEl = leaf.view.contentEl;
|
||||||
|
const header = leaf.view.headerEl;
|
||||||
|
const isGraph = leaf.view.getViewType() === "graph";
|
||||||
|
let graphControls;
|
||||||
|
if (isGraph) {
|
||||||
|
graphControls = leaf.view.dataEngine.controlsEl;
|
||||||
|
graphControls.classList.remove("animate", "hide");
|
||||||
|
} else if (!this.app.vault.getConfig("readableLineLength")) {
|
||||||
|
leaf.view.editMode.editorEl.classList.remove("is-readable-line-width");
|
||||||
|
}
|
||||||
|
viewEl.classList.remove("vignette-linear", "vignette-radial", "animate", "noscroll");
|
||||||
|
header.classList.remove("animate", "hide");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var ProzenSettingTab = class extends import_obsidian.PluginSettingTab {
|
||||||
|
constructor(app, plugin) {
|
||||||
|
super(app, plugin);
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
display() {
|
||||||
|
const { containerEl } = this;
|
||||||
|
containerEl.empty();
|
||||||
|
this.containerEl.createEl("h3", {
|
||||||
|
text: "Vignette"
|
||||||
|
});
|
||||||
|
let vignetteOpacityNumber;
|
||||||
|
new import_obsidian.Setting(containerEl).setName("Opacity").setDesc("Intensity of vignette's dimming effect. Set to 0 to turn vignetting off.").addSlider((slider) => slider.setLimits(0, 1, 0.01).setValue(this.plugin.settings.vignetteOpacity).onChange(async (value) => {
|
||||||
|
vignetteOpacityNumber.innerText = " " + value.toString();
|
||||||
|
this.plugin.settings.vignetteOpacity = value;
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
})).settingEl.createDiv("", (el) => {
|
||||||
|
vignetteOpacityNumber = el;
|
||||||
|
el.style.minWidth = "2.0em";
|
||||||
|
el.style.textAlign = "right";
|
||||||
|
el.innerText = " " + this.plugin.settings.vignetteOpacity.toString();
|
||||||
|
});
|
||||||
|
let vignetteScaleLinearNumber;
|
||||||
|
new import_obsidian.Setting(containerEl).setName("Scale in text views").setDesc("Determines how close to the screen's center vignetting spreads from both sides of the screen, as linear gradients.").addSlider((slider) => slider.setLimits(5, 50, 5).setValue(this.plugin.settings.vignetteScaleLinear).onChange(async (value) => {
|
||||||
|
vignetteScaleLinearNumber.innerText = " " + value.toString();
|
||||||
|
this.plugin.settings.vignetteScaleLinear = value;
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
})).settingEl.createDiv("", (el) => {
|
||||||
|
vignetteScaleLinearNumber = el;
|
||||||
|
el.style.minWidth = "2.0em";
|
||||||
|
el.style.textAlign = "right";
|
||||||
|
el.innerText = " " + this.plugin.settings.vignetteScaleLinear.toString();
|
||||||
|
});
|
||||||
|
let vignetteScaleRadialNumber;
|
||||||
|
new import_obsidian.Setting(containerEl).setName("Scale in graph view").setDesc("Determines how close to the screen's center vignetting spreads from borders of the screen, as a radial gradient.").addSlider((slider) => slider.setLimits(5, 100, 5).setValue(this.plugin.settings.vignetteScaleRadial).onChange(async (value) => {
|
||||||
|
vignetteScaleRadialNumber.innerText = " " + value.toString();
|
||||||
|
this.plugin.settings.vignetteScaleRadial = value;
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
})).settingEl.createDiv("", (el) => {
|
||||||
|
vignetteScaleRadialNumber = el;
|
||||||
|
el.style.minWidth = "2.0em";
|
||||||
|
el.style.textAlign = "right";
|
||||||
|
el.innerText = " " + this.plugin.settings.vignetteScaleRadial.toString();
|
||||||
|
});
|
||||||
|
this.containerEl.createEl("h3", {
|
||||||
|
text: "Animation"
|
||||||
|
});
|
||||||
|
new import_obsidian.Setting(containerEl).setName("Fade-in duration").setDesc("The duration (in seconds) of fade-in animation on entering Zen mode").addText((text) => text.setPlaceholder("1.2").setValue(String(this.plugin.settings.animationDuration)).onChange(async (value) => {
|
||||||
|
this.plugin.settings.animationDuration = Number(value);
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
}));
|
||||||
|
this.containerEl.createEl("h3", {
|
||||||
|
text: "Element Toggles"
|
||||||
|
});
|
||||||
|
new import_obsidian.Setting(containerEl).setName("Show header").setDesc("Show the tab's header in Zen mode").addToggle((toggle) => toggle.setValue(this.plugin.settings.showHeader).onChange(async (value) => {
|
||||||
|
this.plugin.settings.showHeader = value;
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
}));
|
||||||
|
new import_obsidian.Setting(containerEl).setName("Show scrollbar").setDesc("Show the scrollbar in Zen mode. If it is hidden, scrolling is still available with mousewheel, arrows, touchpad, etc.").addToggle((toggle) => toggle.setValue(this.plugin.settings.showScroll).onChange(async (value) => {
|
||||||
|
this.plugin.settings.showScroll = value;
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
}));
|
||||||
|
new import_obsidian.Setting(containerEl).setName("Show graph controls").setDesc("Show the graph view's controls in Zen mode").addToggle((toggle) => toggle.setValue(this.plugin.settings.showGraphControls).onChange(async (value) => {
|
||||||
|
this.plugin.settings.showGraphControls = value;
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
}));
|
||||||
|
this.containerEl.createEl("h3", {
|
||||||
|
text: "Misc"
|
||||||
|
});
|
||||||
|
new import_obsidian.Setting(containerEl).setName("Force content centering").setDesc("Center text content in Zen mode, even if in regular view it takes all of the screen's width (ignore 'Editor -> Readable line length' being off in Zen mode)").addToggle((toggle) => toggle.setValue(this.plugin.settings.forceReadable).onChange(async (value) => {
|
||||||
|
this.plugin.settings.forceReadable = value;
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* nosourcemap */
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"id": "obsidian-prozen",
|
||||||
|
"name": "ProZen",
|
||||||
|
"version": "0.3",
|
||||||
|
"minAppVersion": "0.15.0",
|
||||||
|
"description": "Enter Zen mode to focus on writing. The plugin expands current tab to full screen removing everything but content.",
|
||||||
|
"author": "Moskvitin",
|
||||||
|
"authorUrl": "https://moskvit.in",
|
||||||
|
"isDesktopOnly": true
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
:root {
|
||||||
|
--vignette-opacity: 1;
|
||||||
|
--fadeIn-duration: "2s";
|
||||||
|
--vignette-scale-linear: 20%;
|
||||||
|
--vignette-scale-radial: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.noscroll ::-webkit-scrollbar-thumb{
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vignette-linear {
|
||||||
|
background: linear-gradient(
|
||||||
|
90deg,
|
||||||
|
rgba(0, 0, 0, var(--vignette-opacity)) 0%,
|
||||||
|
rgba(0, 0, 0, 0) var(--vignette-scale-linear),
|
||||||
|
rgba(0, 0, 0, 0) calc(100% - var(--vignette-scale-linear)),
|
||||||
|
rgba(0, 0, 0, var(--vignette-opacity)) 100%
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
.vignette-radial {
|
||||||
|
background: radial-gradient(
|
||||||
|
circle,
|
||||||
|
rgba(0, 0, 0, 0) calc(100% - var(--vignette-scale-radial)),
|
||||||
|
rgba(0, 0, 0, var(--vignette-opacity)) 100%
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
.animate {
|
||||||
|
animation: fadeIn var(--fadeIn-duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hide {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fadeIn {
|
||||||
|
0% {
|
||||||
|
opacity: 0;
|
||||||
|
transform: scale(1.05);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
opacity: 1;
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
Vendored
+174
@@ -0,0 +1,174 @@
|
|||||||
|
{
|
||||||
|
"main": {
|
||||||
|
"id": "4dce6d2131d80a7b",
|
||||||
|
"type": "split",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "c1657b069f3403bb",
|
||||||
|
"type": "tabs",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "8647a1a7ea34b009",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "markdown",
|
||||||
|
"state": {
|
||||||
|
"file": "WS/Welcome.md",
|
||||||
|
"mode": "source",
|
||||||
|
"source": false
|
||||||
|
},
|
||||||
|
"icon": "lucide-file",
|
||||||
|
"title": "Welcome"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"direction": "vertical"
|
||||||
|
},
|
||||||
|
"left": {
|
||||||
|
"id": "b0fbf53297d24057",
|
||||||
|
"type": "split",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "181497fca9eccc89",
|
||||||
|
"type": "tabs",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "078de3f57c1ad7e4",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "file-explorer",
|
||||||
|
"state": {
|
||||||
|
"sortOrder": "alphabetical",
|
||||||
|
"autoReveal": false
|
||||||
|
},
|
||||||
|
"icon": "lucide-folder-closed",
|
||||||
|
"title": "Files"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "b501cf4687ed923e",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "search",
|
||||||
|
"state": {
|
||||||
|
"query": "",
|
||||||
|
"matchingCase": false,
|
||||||
|
"explainSearch": false,
|
||||||
|
"collapseAll": false,
|
||||||
|
"extraContext": false,
|
||||||
|
"sortOrder": "alphabetical"
|
||||||
|
},
|
||||||
|
"icon": "lucide-search",
|
||||||
|
"title": "Search"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "3059ec290437ffeb",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "bookmarks",
|
||||||
|
"state": {},
|
||||||
|
"icon": "lucide-bookmark",
|
||||||
|
"title": "Bookmarks"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"direction": "horizontal",
|
||||||
|
"width": 300
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
"id": "66b02d9b83652f9c",
|
||||||
|
"type": "split",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "78b83f9bd8b427f3",
|
||||||
|
"type": "tabs",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "6241b5db8266074e",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "backlink",
|
||||||
|
"state": {
|
||||||
|
"file": "WS/Welcome.md",
|
||||||
|
"collapseAll": false,
|
||||||
|
"extraContext": false,
|
||||||
|
"sortOrder": "alphabetical",
|
||||||
|
"showSearch": false,
|
||||||
|
"searchQuery": "",
|
||||||
|
"backlinkCollapsed": false,
|
||||||
|
"unlinkedCollapsed": true
|
||||||
|
},
|
||||||
|
"icon": "links-coming-in",
|
||||||
|
"title": "Backlinks for Welcome"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "5f49c332d179c319",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "outgoing-link",
|
||||||
|
"state": {
|
||||||
|
"file": "WS/Welcome.md",
|
||||||
|
"linksCollapsed": false,
|
||||||
|
"unlinkedCollapsed": true
|
||||||
|
},
|
||||||
|
"icon": "links-going-out",
|
||||||
|
"title": "Outgoing links from Welcome"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "2b3c8e958d000a35",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "tag",
|
||||||
|
"state": {
|
||||||
|
"sortOrder": "frequency",
|
||||||
|
"useHierarchy": true,
|
||||||
|
"showSearch": false,
|
||||||
|
"searchQuery": ""
|
||||||
|
},
|
||||||
|
"icon": "lucide-tags",
|
||||||
|
"title": "Tags"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "57cad7f1ff3dd67c",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "outline",
|
||||||
|
"state": {
|
||||||
|
"file": "WS/Welcome.md",
|
||||||
|
"followCursor": false,
|
||||||
|
"showSearch": false,
|
||||||
|
"searchQuery": ""
|
||||||
|
},
|
||||||
|
"icon": "lucide-list",
|
||||||
|
"title": "Outline of Welcome"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"direction": "horizontal",
|
||||||
|
"width": 300,
|
||||||
|
"collapsed": true
|
||||||
|
},
|
||||||
|
"left-ribbon": {
|
||||||
|
"hiddenItems": {
|
||||||
|
"switcher:Open quick switcher": false,
|
||||||
|
"graph:Open graph view": false,
|
||||||
|
"canvas:Create new canvas": false,
|
||||||
|
"daily-notes:Open today's daily note": false,
|
||||||
|
"templates:Insert template": false,
|
||||||
|
"command-palette:Open command palette": false,
|
||||||
|
"bases:Create new base": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"active": "8647a1a7ea34b009",
|
||||||
|
"lastOpenFiles": []
|
||||||
|
}
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
[
|
||||||
|
"obsidian-prozen",
|
||||||
|
"cm-typewriter-scroll-obsidian"
|
||||||
|
]
|
||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"file-explorer": true,
|
||||||
|
"global-search": true,
|
||||||
|
"switcher": true,
|
||||||
|
"graph": true,
|
||||||
|
"backlink": true,
|
||||||
|
"canvas": true,
|
||||||
|
"outgoing-link": true,
|
||||||
|
"tag-pane": true,
|
||||||
|
"footnotes": false,
|
||||||
|
"properties": false,
|
||||||
|
"page-preview": true,
|
||||||
|
"daily-notes": true,
|
||||||
|
"templates": true,
|
||||||
|
"note-composer": true,
|
||||||
|
"command-palette": true,
|
||||||
|
"slash-command": false,
|
||||||
|
"editor-status": true,
|
||||||
|
"bookmarks": true,
|
||||||
|
"markdown-importer": false,
|
||||||
|
"zk-prefixer": false,
|
||||||
|
"random-note": false,
|
||||||
|
"outline": true,
|
||||||
|
"word-count": true,
|
||||||
|
"slides": false,
|
||||||
|
"audio-recorder": false,
|
||||||
|
"workspaces": false,
|
||||||
|
"file-recovery": true,
|
||||||
|
"publish": false,
|
||||||
|
"sync": true,
|
||||||
|
"bases": true,
|
||||||
|
"webviewer": false
|
||||||
|
}
|
||||||
Vendored
+22
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"collapse-filter": true,
|
||||||
|
"search": "",
|
||||||
|
"showTags": false,
|
||||||
|
"showAttachments": false,
|
||||||
|
"hideUnresolved": false,
|
||||||
|
"showOrphans": true,
|
||||||
|
"collapse-color-groups": true,
|
||||||
|
"colorGroups": [],
|
||||||
|
"collapse-display": true,
|
||||||
|
"showArrow": false,
|
||||||
|
"textFadeMultiplier": 0,
|
||||||
|
"nodeSizeMultiplier": 1,
|
||||||
|
"lineSizeMultiplier": 1,
|
||||||
|
"collapse-forces": true,
|
||||||
|
"centerStrength": 0.518713248970312,
|
||||||
|
"repelStrength": 10,
|
||||||
|
"linkStrength": 1,
|
||||||
|
"linkDistance": 250,
|
||||||
|
"scale": 1,
|
||||||
|
"close": true
|
||||||
|
}
|
||||||
Vendored
+10
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"obsidian-prozen:zenmode": [
|
||||||
|
{
|
||||||
|
"modifiers": [
|
||||||
|
"Alt"
|
||||||
|
],
|
||||||
|
"key": "Z"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,427 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var obsidian = require('obsidian');
|
||||||
|
var state = require('@codemirror/state');
|
||||||
|
var view = require('@codemirror/view');
|
||||||
|
|
||||||
|
/*! *****************************************************************************
|
||||||
|
Copyright (c) Microsoft Corporation.
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
***************************************************************************** */
|
||||||
|
/* global Reflect, Promise */
|
||||||
|
|
||||||
|
var extendStatics = function(d, b) {
|
||||||
|
extendStatics = Object.setPrototypeOf ||
|
||||||
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||||
|
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||||
|
return extendStatics(d, b);
|
||||||
|
};
|
||||||
|
|
||||||
|
function __extends(d, b) {
|
||||||
|
if (typeof b !== "function" && b !== null)
|
||||||
|
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||||
|
extendStatics(d, b);
|
||||||
|
function __() { this.constructor = d; }
|
||||||
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||||
|
}
|
||||||
|
|
||||||
|
function __awaiter(thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function __generator(thisArg, body) {
|
||||||
|
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||||
|
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||||
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||||
|
function step(op) {
|
||||||
|
if (f) throw new TypeError("Generator is already executing.");
|
||||||
|
while (_) try {
|
||||||
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||||
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||||
|
switch (op[0]) {
|
||||||
|
case 0: case 1: t = op; break;
|
||||||
|
case 4: _.label++; return { value: op[1], done: false };
|
||||||
|
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||||
|
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||||
|
default:
|
||||||
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||||
|
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||||
|
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||||
|
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||||
|
if (t[2]) _.ops.pop();
|
||||||
|
_.trys.pop(); continue;
|
||||||
|
}
|
||||||
|
op = body.call(thisArg, _);
|
||||||
|
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||||
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// all credit to azu: https://github.com/azu/codemirror-typewriter-scrolling/blob/b0ac076d72c9445c96182de87d974de2e8cc56e2/typewriter-scrolling.js
|
||||||
|
var movedByMouse = false;
|
||||||
|
CodeMirror.commands.scrollSelectionToCenter = function (cm) {
|
||||||
|
var cursor = cm.getCursor('head');
|
||||||
|
var charCoords = cm.charCoords(cursor, "local");
|
||||||
|
var top = charCoords.top;
|
||||||
|
var halfLineHeight = (charCoords.bottom - top) / 2;
|
||||||
|
var halfWindowHeight = cm.getWrapperElement().offsetHeight / 2;
|
||||||
|
var scrollTo = Math.round((top - halfWindowHeight + halfLineHeight));
|
||||||
|
cm.scrollTo(null, scrollTo);
|
||||||
|
};
|
||||||
|
CodeMirror.defineOption("typewriterScrolling", false, function (cm, val, old) {
|
||||||
|
if (old && old != CodeMirror.Init) {
|
||||||
|
const linesEl = cm.getScrollerElement().querySelector('.CodeMirror-lines');
|
||||||
|
linesEl.style.paddingTop = null;
|
||||||
|
linesEl.style.paddingBottom = null;
|
||||||
|
cm.off("cursorActivity", onCursorActivity);
|
||||||
|
cm.off("refresh", onRefresh);
|
||||||
|
cm.off("mousedown", onMouseDown);
|
||||||
|
cm.off("keydown", onKeyDown);
|
||||||
|
cm.off("beforeChange", onBeforeChange);
|
||||||
|
}
|
||||||
|
if (val) {
|
||||||
|
onRefresh(cm);
|
||||||
|
cm.on("cursorActivity", onCursorActivity);
|
||||||
|
cm.on("refresh", onRefresh);
|
||||||
|
cm.on("mousedown", onMouseDown);
|
||||||
|
cm.on("keydown", onKeyDown);
|
||||||
|
cm.on("beforeChange", onBeforeChange);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
function onMouseDown() {
|
||||||
|
movedByMouse = true;
|
||||||
|
}
|
||||||
|
const modiferKeys = ["Alt", "AltGraph", "CapsLock", "Control", "Fn", "FnLock", "Hyper", "Meta", "NumLock", "ScrollLock", "Shift", "Super", "Symbol", "SymbolLock"];
|
||||||
|
function onKeyDown(cm, e) {
|
||||||
|
if (!modiferKeys.includes(e.key)) {
|
||||||
|
movedByMouse = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function onBeforeChange() {
|
||||||
|
movedByMouse = false;
|
||||||
|
}
|
||||||
|
function onCursorActivity(cm) {
|
||||||
|
const linesEl = cm.getScrollerElement().querySelector('.CodeMirror-lines');
|
||||||
|
if (cm.getSelection().length !== 0) {
|
||||||
|
linesEl.classList.add("selecting");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
linesEl.classList.remove("selecting");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!movedByMouse) {
|
||||||
|
cm.execCommand("scrollSelectionToCenter");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function onRefresh(cm) {
|
||||||
|
const halfWindowHeight = cm.getWrapperElement().offsetHeight / 2;
|
||||||
|
const linesEl = cm.getScrollerElement().querySelector('.CodeMirror-lines');
|
||||||
|
linesEl.style.paddingTop = `${halfWindowHeight}px`;
|
||||||
|
linesEl.style.paddingBottom = `${halfWindowHeight}px`; // Thanks @walulula!
|
||||||
|
if (cm.getSelection().length === 0) {
|
||||||
|
cm.execCommand("scrollSelectionToCenter");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var allowedUserEvents = /^(select|input|delete|undo|redo)(\..+)?$/;
|
||||||
|
var disallowedUserEvents = /^(select.pointer)$/;
|
||||||
|
var typewriterOffset = state.Facet.define({
|
||||||
|
combine: function (values) { return values.length ? Math.min.apply(Math, values) : 0.5; }
|
||||||
|
});
|
||||||
|
var resetTypewriterScrollPaddingPlugin = view.ViewPlugin.fromClass(/** @class */ (function () {
|
||||||
|
function class_1(view) {
|
||||||
|
this.view = view;
|
||||||
|
}
|
||||||
|
class_1.prototype.update = function (update) {
|
||||||
|
if (this.view.contentDOM.style.paddingTop) {
|
||||||
|
this.view.contentDOM.style.paddingTop = "";
|
||||||
|
this.view.contentDOM.style.paddingBottom = (update.view.dom.clientHeight / 2) + "px";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return class_1;
|
||||||
|
}()));
|
||||||
|
var typewriterScrollPaddingPlugin = view.ViewPlugin.fromClass(/** @class */ (function () {
|
||||||
|
function class_2(view) {
|
||||||
|
this.view = view;
|
||||||
|
this.topPadding = null;
|
||||||
|
}
|
||||||
|
class_2.prototype.update = function (update) {
|
||||||
|
var offset = (update.view.dom.clientHeight * update.view.state.facet(typewriterOffset)) - (update.view.defaultLineHeight / 2);
|
||||||
|
this.topPadding = offset + "px";
|
||||||
|
if (this.topPadding != this.view.contentDOM.style.paddingTop) {
|
||||||
|
this.view.contentDOM.style.paddingTop = this.topPadding;
|
||||||
|
this.view.contentDOM.style.paddingBottom = (update.view.dom.clientHeight - offset) + "px";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return class_2;
|
||||||
|
}()));
|
||||||
|
var typewriterScrollPlugin = view.ViewPlugin.fromClass(/** @class */ (function () {
|
||||||
|
function class_3(view) {
|
||||||
|
this.view = view;
|
||||||
|
this.myUpdate = false;
|
||||||
|
}
|
||||||
|
class_3.prototype.update = function (update) {
|
||||||
|
if (this.myUpdate)
|
||||||
|
this.myUpdate = false;
|
||||||
|
else {
|
||||||
|
var userEvents = update.transactions.map(function (tr) { return tr.annotation(state.Transaction.userEvent); });
|
||||||
|
var isAllowed = userEvents.reduce(function (result, event) { return result && allowedUserEvents.test(event) && !disallowedUserEvents.test(event); }, userEvents.length > 0);
|
||||||
|
if (isAllowed) {
|
||||||
|
this.myUpdate = true;
|
||||||
|
this.centerOnHead(update);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
class_3.prototype.centerOnHead = function (update) {
|
||||||
|
return __awaiter(this, void 0, void 0, function () {
|
||||||
|
var _this = this;
|
||||||
|
return __generator(this, function (_a) {
|
||||||
|
// can't update inside an update, so request the next animation frame
|
||||||
|
window.requestAnimationFrame(function () {
|
||||||
|
// current selection range
|
||||||
|
if (update.state.selection.ranges.length == 1) {
|
||||||
|
// only act on the one range
|
||||||
|
var head = update.state.selection.main.head;
|
||||||
|
var prevHead = update.startState.selection.main.head;
|
||||||
|
// TODO: work out line number and use that instead? Is that even possible?
|
||||||
|
// don't bother with this next part if the range (line??) hasn't changed
|
||||||
|
if (prevHead != head) {
|
||||||
|
// this is the effect that does the centering
|
||||||
|
var offset = (update.view.dom.clientHeight * update.view.state.facet(typewriterOffset)) - (update.view.defaultLineHeight / 2);
|
||||||
|
var effect = view.EditorView.scrollIntoView(head, { y: "start", yMargin: offset });
|
||||||
|
// const effect = EditorView.scrollIntoView(head, { y: "center" });
|
||||||
|
var transaction = _this.view.state.update({ effects: effect });
|
||||||
|
_this.view.dispatch(transaction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return [2 /*return*/];
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
return class_3;
|
||||||
|
}()));
|
||||||
|
function typewriterScroll(options) {
|
||||||
|
if (options === void 0) { options = {}; }
|
||||||
|
return [
|
||||||
|
options.typewriterOffset == null ? [] : typewriterOffset.of(options.typewriterOffset),
|
||||||
|
typewriterScrollPaddingPlugin,
|
||||||
|
typewriterScrollPlugin
|
||||||
|
];
|
||||||
|
}
|
||||||
|
function resetTypewriterSrcoll() {
|
||||||
|
return [
|
||||||
|
resetTypewriterScrollPaddingPlugin
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
var DEFAULT_SETTINGS = {
|
||||||
|
enabled: true,
|
||||||
|
typewriterOffset: 0.5,
|
||||||
|
zenEnabled: false,
|
||||||
|
zenOpacity: 0.25
|
||||||
|
};
|
||||||
|
var CMTypewriterScrollPlugin = /** @class */ (function (_super) {
|
||||||
|
__extends(CMTypewriterScrollPlugin, _super);
|
||||||
|
function CMTypewriterScrollPlugin() {
|
||||||
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||||
|
_this.extArray = [];
|
||||||
|
_this.toggleTypewriterScroll = function (newValue) {
|
||||||
|
if (newValue === void 0) { newValue = null; }
|
||||||
|
// if no value is passed in, toggle the existing value
|
||||||
|
if (newValue === null)
|
||||||
|
newValue = !_this.settings.enabled;
|
||||||
|
// assign the new value and call the correct enable / disable function
|
||||||
|
(_this.settings.enabled = newValue)
|
||||||
|
? _this.enableTypewriterScroll() : _this.disableTypewriterScroll();
|
||||||
|
// save the new settings
|
||||||
|
_this.saveData(_this.settings);
|
||||||
|
};
|
||||||
|
_this.changeTypewriterOffset = function (newValue) {
|
||||||
|
_this.settings.typewriterOffset = newValue;
|
||||||
|
if (_this.settings.enabled) {
|
||||||
|
_this.disableTypewriterScroll();
|
||||||
|
// delete the extension, so it gets recreated with the new value
|
||||||
|
delete _this.ext;
|
||||||
|
_this.enableTypewriterScroll();
|
||||||
|
}
|
||||||
|
_this.saveData(_this.settings);
|
||||||
|
};
|
||||||
|
_this.toggleZen = function (newValue) {
|
||||||
|
if (newValue === void 0) { newValue = null; }
|
||||||
|
// if no value is passed in, toggle the existing value
|
||||||
|
if (newValue === null)
|
||||||
|
newValue = !_this.settings.zenEnabled;
|
||||||
|
// assign the new value and call the correct enable / disable function
|
||||||
|
(_this.settings.zenEnabled = newValue)
|
||||||
|
? _this.enableZen() : _this.disableZen();
|
||||||
|
// save the new settings
|
||||||
|
_this.saveData(_this.settings);
|
||||||
|
};
|
||||||
|
_this.changeZenOpacity = function (newValue) {
|
||||||
|
if (newValue === void 0) { newValue = 0.25; }
|
||||||
|
_this.settings.zenOpacity = newValue;
|
||||||
|
_this.css.innerText = "body{--zen-opacity: ".concat(newValue, ";}");
|
||||||
|
// save the new settings
|
||||||
|
_this.saveData(_this.settings);
|
||||||
|
};
|
||||||
|
_this.enableTypewriterScroll = function () {
|
||||||
|
// add the class
|
||||||
|
document.body.classList.add('plugin-cm-typewriter-scroll');
|
||||||
|
// register the codemirror add on setting
|
||||||
|
_this.registerCodeMirror(function (cm) {
|
||||||
|
// @ts-ignore
|
||||||
|
cm.setOption("typewriterScrolling", true);
|
||||||
|
});
|
||||||
|
if (!_this.ext) {
|
||||||
|
_this.ext = typewriterScroll({ typewriterOffset: _this.settings.typewriterOffset });
|
||||||
|
_this.extArray = [_this.ext];
|
||||||
|
_this.registerEditorExtension(_this.extArray);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_this.extArray.splice(0, _this.extArray.length);
|
||||||
|
_this.extArray.push(_this.ext);
|
||||||
|
_this.app.workspace.updateOptions();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
_this.disableTypewriterScroll = function () {
|
||||||
|
// remove the class
|
||||||
|
document.body.classList.remove('plugin-cm-typewriter-scroll');
|
||||||
|
// remove the codemirror add on setting
|
||||||
|
_this.app.workspace.iterateCodeMirrors(function (cm) {
|
||||||
|
// @ts-ignore
|
||||||
|
cm.setOption("typewriterScrolling", false);
|
||||||
|
});
|
||||||
|
// clear out the registered extension
|
||||||
|
_this.extArray.splice(0, _this.extArray.length);
|
||||||
|
_this.extArray.push(resetTypewriterSrcoll());
|
||||||
|
_this.app.workspace.updateOptions();
|
||||||
|
};
|
||||||
|
_this.enableZen = function () {
|
||||||
|
// add the class
|
||||||
|
document.body.classList.add('plugin-cm-typewriter-scroll-zen');
|
||||||
|
};
|
||||||
|
_this.disableZen = function () {
|
||||||
|
// remove the class
|
||||||
|
document.body.classList.remove('plugin-cm-typewriter-scroll-zen');
|
||||||
|
};
|
||||||
|
return _this;
|
||||||
|
}
|
||||||
|
CMTypewriterScrollPlugin.prototype.onload = function () {
|
||||||
|
return __awaiter(this, void 0, void 0, function () {
|
||||||
|
var _a, _b, _c, _d;
|
||||||
|
return __generator(this, function (_e) {
|
||||||
|
switch (_e.label) {
|
||||||
|
case 0:
|
||||||
|
_a = this;
|
||||||
|
_c = (_b = Object).assign;
|
||||||
|
_d = [DEFAULT_SETTINGS];
|
||||||
|
return [4 /*yield*/, this.loadData()];
|
||||||
|
case 1:
|
||||||
|
_a.settings = _c.apply(_b, _d.concat([_e.sent()]));
|
||||||
|
// enable the plugin (based on settings)
|
||||||
|
if (this.settings.enabled)
|
||||||
|
this.enableTypewriterScroll();
|
||||||
|
if (this.settings.zenEnabled)
|
||||||
|
this.enableZen();
|
||||||
|
this.css = document.createElement('style');
|
||||||
|
this.css.id = 'plugin-typewriter-scroll';
|
||||||
|
this.css.setAttr('type', 'text/css');
|
||||||
|
document.getElementsByTagName("head")[0].appendChild(this.css);
|
||||||
|
this.css.innerText = "body{--zen-opacity: ".concat(this.settings.zenOpacity, ";}");
|
||||||
|
// add the settings tab
|
||||||
|
this.addSettingTab(new CMTypewriterScrollSettingTab(this.app, this));
|
||||||
|
// add the commands / keyboard shortcuts
|
||||||
|
this.addCommands();
|
||||||
|
return [2 /*return*/];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
CMTypewriterScrollPlugin.prototype.onunload = function () {
|
||||||
|
// disable the plugin
|
||||||
|
this.disableTypewriterScroll();
|
||||||
|
this.disableZen();
|
||||||
|
};
|
||||||
|
CMTypewriterScrollPlugin.prototype.addCommands = function () {
|
||||||
|
var _this = this;
|
||||||
|
// add the toggle on/off command
|
||||||
|
this.addCommand({
|
||||||
|
id: 'toggle-typewriter-sroll',
|
||||||
|
name: 'Toggle On/Off',
|
||||||
|
callback: function () { _this.toggleTypewriterScroll(); }
|
||||||
|
});
|
||||||
|
// toggle zen mode
|
||||||
|
this.addCommand({
|
||||||
|
id: 'toggle-typewriter-sroll-zen',
|
||||||
|
name: 'Toggle Zen Mode On/Off',
|
||||||
|
callback: function () { _this.toggleZen(); }
|
||||||
|
});
|
||||||
|
};
|
||||||
|
return CMTypewriterScrollPlugin;
|
||||||
|
}(obsidian.Plugin));
|
||||||
|
var CMTypewriterScrollSettingTab = /** @class */ (function (_super) {
|
||||||
|
__extends(CMTypewriterScrollSettingTab, _super);
|
||||||
|
function CMTypewriterScrollSettingTab(app, plugin) {
|
||||||
|
var _this = _super.call(this, app, plugin) || this;
|
||||||
|
_this.plugin = plugin;
|
||||||
|
return _this;
|
||||||
|
}
|
||||||
|
CMTypewriterScrollSettingTab.prototype.display = function () {
|
||||||
|
var _this = this;
|
||||||
|
var containerEl = this.containerEl;
|
||||||
|
containerEl.empty();
|
||||||
|
new obsidian.Setting(containerEl)
|
||||||
|
.setName("Toggle Typewriter Scrolling")
|
||||||
|
.setDesc("Turns typewriter scrolling on or off globally")
|
||||||
|
.addToggle(function (toggle) {
|
||||||
|
return toggle.setValue(_this.plugin.settings.enabled)
|
||||||
|
.onChange(function (newValue) { _this.plugin.toggleTypewriterScroll(newValue); });
|
||||||
|
});
|
||||||
|
new obsidian.Setting(containerEl)
|
||||||
|
.setName("Center offset")
|
||||||
|
.setDesc("Positions the typewriter text at the specified percentage of the screen")
|
||||||
|
.addSlider(function (slider) {
|
||||||
|
return slider.setLimits(0, 100, 5)
|
||||||
|
.setValue(_this.plugin.settings.typewriterOffset * 100)
|
||||||
|
.onChange(function (newValue) { _this.plugin.changeTypewriterOffset(newValue / 100); });
|
||||||
|
});
|
||||||
|
new obsidian.Setting(containerEl)
|
||||||
|
.setName("Zen Mode")
|
||||||
|
.setDesc("Darkens non-active lines in the editor so you can focus on what you're typing")
|
||||||
|
.addToggle(function (toggle) {
|
||||||
|
return toggle.setValue(_this.plugin.settings.zenEnabled)
|
||||||
|
.onChange(function (newValue) { _this.plugin.toggleZen(newValue); });
|
||||||
|
});
|
||||||
|
new obsidian.Setting(containerEl)
|
||||||
|
.setName("Zen Opacity")
|
||||||
|
.setDesc("The opacity of unfocused lines in zen mode")
|
||||||
|
.addSlider(function (slider) {
|
||||||
|
return slider.setLimits(0, 100, 5)
|
||||||
|
.setValue(_this.plugin.settings.zenOpacity * 100)
|
||||||
|
.onChange(function (newValue) { _this.plugin.changeZenOpacity(newValue / 100); });
|
||||||
|
});
|
||||||
|
};
|
||||||
|
return CMTypewriterScrollSettingTab;
|
||||||
|
}(obsidian.PluginSettingTab));
|
||||||
|
|
||||||
|
module.exports = CMTypewriterScrollPlugin;
|
||||||
|
|
||||||
|
|
||||||
|
/* nosourcemap */
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"id": "cm-typewriter-scroll-obsidian",
|
||||||
|
"name": "Typewriter Scroll",
|
||||||
|
"author": "death_au",
|
||||||
|
"authorUrl": "https://github.com/deathau",
|
||||||
|
"description": "Typewriter-style scrolling which keeps the view centered in the editor.",
|
||||||
|
"isDesktopOnly": false,
|
||||||
|
"version": "0.2.2",
|
||||||
|
"minAppVersion": "0.10.0"
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
body.plugin-cm-typewriter-scroll-zen .CodeMirror-lines:not(.selecting) .CodeMirror-code > :not(.CodeMirror-activeline) {
|
||||||
|
opacity: var(--zen-opacity);
|
||||||
|
}
|
||||||
|
body.plugin-cm-typewriter-scroll-zen .cm-editor.cm-focused .cm-line:not(.cm-active) {
|
||||||
|
opacity: var(--zen-opacity);
|
||||||
|
}
|
||||||
@@ -0,0 +1,197 @@
|
|||||||
|
/*
|
||||||
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||||||
|
if you want to view the source, please visit the github repository of this plugin
|
||||||
|
*/
|
||||||
|
|
||||||
|
var __defProp = Object.defineProperty;
|
||||||
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||||
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||||
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||||
|
var __export = (target, all) => {
|
||||||
|
for (var name in all)
|
||||||
|
__defProp(target, name, { get: all[name], enumerable: true });
|
||||||
|
};
|
||||||
|
var __copyProps = (to, from, except, desc) => {
|
||||||
|
if (from && typeof from === "object" || typeof from === "function") {
|
||||||
|
for (let key of __getOwnPropNames(from))
|
||||||
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||||
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||||
|
}
|
||||||
|
return to;
|
||||||
|
};
|
||||||
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||||
|
|
||||||
|
// main.ts
|
||||||
|
var main_exports = {};
|
||||||
|
__export(main_exports, {
|
||||||
|
default: () => Prozen
|
||||||
|
});
|
||||||
|
module.exports = __toCommonJS(main_exports);
|
||||||
|
var import_obsidian = require("obsidian");
|
||||||
|
var DEFAULT_SETTINGS = {
|
||||||
|
animationDuration: 2,
|
||||||
|
showHeader: false,
|
||||||
|
showScroll: false,
|
||||||
|
showGraphControls: false,
|
||||||
|
forceReadable: true,
|
||||||
|
vignetteOpacity: 0.75,
|
||||||
|
vignetteScaleLinear: 20,
|
||||||
|
vignetteScaleRadial: 75
|
||||||
|
};
|
||||||
|
var Prozen = class extends import_obsidian.Plugin {
|
||||||
|
async onload() {
|
||||||
|
await this.loadSettings();
|
||||||
|
this.addCommand({
|
||||||
|
id: "zenmode",
|
||||||
|
name: "Zen mode",
|
||||||
|
callback: this.fullscreenMode.bind(this)
|
||||||
|
});
|
||||||
|
this.addSettingTab(new ProzenSettingTab(this.app, this));
|
||||||
|
}
|
||||||
|
onunload() {
|
||||||
|
}
|
||||||
|
async loadSettings() {
|
||||||
|
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
|
||||||
|
}
|
||||||
|
async saveSettings() {
|
||||||
|
await this.saveData(this.settings);
|
||||||
|
}
|
||||||
|
fullscreenMode() {
|
||||||
|
const leaf = this.app.workspace.getActiveViewOfType(import_obsidian.ItemView).leaf;
|
||||||
|
if (!leaf)
|
||||||
|
return;
|
||||||
|
if (leaf.view.getViewType() === "empty")
|
||||||
|
return;
|
||||||
|
const root = document.documentElement;
|
||||||
|
root.style.setProperty("--fadeIn-duration", this.settings.animationDuration + "s");
|
||||||
|
root.style.setProperty("--vignette-opacity", this.settings.vignetteOpacity);
|
||||||
|
root.style.setProperty("--vignette-scale-linear", this.settings.vignetteScaleLinear + "%");
|
||||||
|
root.style.setProperty("--vignette-scale-radial", this.settings.vignetteScaleRadial + "%");
|
||||||
|
const containerEl = leaf.containerEl;
|
||||||
|
if (!document.fullscreenElement) {
|
||||||
|
containerEl.requestFullscreen();
|
||||||
|
this.addStyles(leaf);
|
||||||
|
} else {
|
||||||
|
document.exitFullscreen();
|
||||||
|
this.removeStyles(leaf);
|
||||||
|
}
|
||||||
|
containerEl.onfullscreenchange = () => {
|
||||||
|
if (!document.fullscreenElement) {
|
||||||
|
this.removeStyles(leaf);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
addStyles(leaf) {
|
||||||
|
const viewEl = leaf.view.contentEl;
|
||||||
|
const header = leaf.view.headerEl;
|
||||||
|
const isGraph = leaf.view.getViewType() === "graph";
|
||||||
|
let graphControls;
|
||||||
|
if (isGraph) {
|
||||||
|
graphControls = leaf.view.dataEngine.controlsEl;
|
||||||
|
}
|
||||||
|
if (!this.settings.showScroll) {
|
||||||
|
viewEl.classList.add("noscroll");
|
||||||
|
}
|
||||||
|
if (isGraph && !this.settings.showGraphControls) {
|
||||||
|
graphControls.classList.add("hide");
|
||||||
|
}
|
||||||
|
isGraph ? viewEl.classList.add("vignette-radial") : viewEl.classList.add("vignette-linear");
|
||||||
|
if (!isGraph && this.settings.forceReadable) {
|
||||||
|
leaf.view.editMode.editorEl.classList.add("is-readable-line-width");
|
||||||
|
}
|
||||||
|
viewEl.classList.add("animate");
|
||||||
|
this.settings.showHeader ? header.classList.add("animate") : header.classList.add("hide");
|
||||||
|
}
|
||||||
|
removeStyles(leaf) {
|
||||||
|
const viewEl = leaf.view.contentEl;
|
||||||
|
const header = leaf.view.headerEl;
|
||||||
|
const isGraph = leaf.view.getViewType() === "graph";
|
||||||
|
let graphControls;
|
||||||
|
if (isGraph) {
|
||||||
|
graphControls = leaf.view.dataEngine.controlsEl;
|
||||||
|
graphControls.classList.remove("animate", "hide");
|
||||||
|
} else if (!this.app.vault.getConfig("readableLineLength")) {
|
||||||
|
leaf.view.editMode.editorEl.classList.remove("is-readable-line-width");
|
||||||
|
}
|
||||||
|
viewEl.classList.remove("vignette-linear", "vignette-radial", "animate", "noscroll");
|
||||||
|
header.classList.remove("animate", "hide");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var ProzenSettingTab = class extends import_obsidian.PluginSettingTab {
|
||||||
|
constructor(app, plugin) {
|
||||||
|
super(app, plugin);
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
display() {
|
||||||
|
const { containerEl } = this;
|
||||||
|
containerEl.empty();
|
||||||
|
this.containerEl.createEl("h3", {
|
||||||
|
text: "Vignette"
|
||||||
|
});
|
||||||
|
let vignetteOpacityNumber;
|
||||||
|
new import_obsidian.Setting(containerEl).setName("Opacity").setDesc("Intensity of vignette's dimming effect. Set to 0 to turn vignetting off.").addSlider((slider) => slider.setLimits(0, 1, 0.01).setValue(this.plugin.settings.vignetteOpacity).onChange(async (value) => {
|
||||||
|
vignetteOpacityNumber.innerText = " " + value.toString();
|
||||||
|
this.plugin.settings.vignetteOpacity = value;
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
})).settingEl.createDiv("", (el) => {
|
||||||
|
vignetteOpacityNumber = el;
|
||||||
|
el.style.minWidth = "2.0em";
|
||||||
|
el.style.textAlign = "right";
|
||||||
|
el.innerText = " " + this.plugin.settings.vignetteOpacity.toString();
|
||||||
|
});
|
||||||
|
let vignetteScaleLinearNumber;
|
||||||
|
new import_obsidian.Setting(containerEl).setName("Scale in text views").setDesc("Determines how close to the screen's center vignetting spreads from both sides of the screen, as linear gradients.").addSlider((slider) => slider.setLimits(5, 50, 5).setValue(this.plugin.settings.vignetteScaleLinear).onChange(async (value) => {
|
||||||
|
vignetteScaleLinearNumber.innerText = " " + value.toString();
|
||||||
|
this.plugin.settings.vignetteScaleLinear = value;
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
})).settingEl.createDiv("", (el) => {
|
||||||
|
vignetteScaleLinearNumber = el;
|
||||||
|
el.style.minWidth = "2.0em";
|
||||||
|
el.style.textAlign = "right";
|
||||||
|
el.innerText = " " + this.plugin.settings.vignetteScaleLinear.toString();
|
||||||
|
});
|
||||||
|
let vignetteScaleRadialNumber;
|
||||||
|
new import_obsidian.Setting(containerEl).setName("Scale in graph view").setDesc("Determines how close to the screen's center vignetting spreads from borders of the screen, as a radial gradient.").addSlider((slider) => slider.setLimits(5, 100, 5).setValue(this.plugin.settings.vignetteScaleRadial).onChange(async (value) => {
|
||||||
|
vignetteScaleRadialNumber.innerText = " " + value.toString();
|
||||||
|
this.plugin.settings.vignetteScaleRadial = value;
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
})).settingEl.createDiv("", (el) => {
|
||||||
|
vignetteScaleRadialNumber = el;
|
||||||
|
el.style.minWidth = "2.0em";
|
||||||
|
el.style.textAlign = "right";
|
||||||
|
el.innerText = " " + this.plugin.settings.vignetteScaleRadial.toString();
|
||||||
|
});
|
||||||
|
this.containerEl.createEl("h3", {
|
||||||
|
text: "Animation"
|
||||||
|
});
|
||||||
|
new import_obsidian.Setting(containerEl).setName("Fade-in duration").setDesc("The duration (in seconds) of fade-in animation on entering Zen mode").addText((text) => text.setPlaceholder("1.2").setValue(String(this.plugin.settings.animationDuration)).onChange(async (value) => {
|
||||||
|
this.plugin.settings.animationDuration = Number(value);
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
}));
|
||||||
|
this.containerEl.createEl("h3", {
|
||||||
|
text: "Element Toggles"
|
||||||
|
});
|
||||||
|
new import_obsidian.Setting(containerEl).setName("Show header").setDesc("Show the tab's header in Zen mode").addToggle((toggle) => toggle.setValue(this.plugin.settings.showHeader).onChange(async (value) => {
|
||||||
|
this.plugin.settings.showHeader = value;
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
}));
|
||||||
|
new import_obsidian.Setting(containerEl).setName("Show scrollbar").setDesc("Show the scrollbar in Zen mode. If it is hidden, scrolling is still available with mousewheel, arrows, touchpad, etc.").addToggle((toggle) => toggle.setValue(this.plugin.settings.showScroll).onChange(async (value) => {
|
||||||
|
this.plugin.settings.showScroll = value;
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
}));
|
||||||
|
new import_obsidian.Setting(containerEl).setName("Show graph controls").setDesc("Show the graph view's controls in Zen mode").addToggle((toggle) => toggle.setValue(this.plugin.settings.showGraphControls).onChange(async (value) => {
|
||||||
|
this.plugin.settings.showGraphControls = value;
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
}));
|
||||||
|
this.containerEl.createEl("h3", {
|
||||||
|
text: "Misc"
|
||||||
|
});
|
||||||
|
new import_obsidian.Setting(containerEl).setName("Force content centering").setDesc("Center text content in Zen mode, even if in regular view it takes all of the screen's width (ignore 'Editor -> Readable line length' being off in Zen mode)").addToggle((toggle) => toggle.setValue(this.plugin.settings.forceReadable).onChange(async (value) => {
|
||||||
|
this.plugin.settings.forceReadable = value;
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* nosourcemap */
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"id": "obsidian-prozen",
|
||||||
|
"name": "ProZen",
|
||||||
|
"version": "0.3",
|
||||||
|
"minAppVersion": "0.15.0",
|
||||||
|
"description": "Enter Zen mode to focus on writing. The plugin expands current tab to full screen removing everything but content.",
|
||||||
|
"author": "Moskvitin",
|
||||||
|
"authorUrl": "https://moskvit.in",
|
||||||
|
"isDesktopOnly": true
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
:root {
|
||||||
|
--vignette-opacity: 1;
|
||||||
|
--fadeIn-duration: "2s";
|
||||||
|
--vignette-scale-linear: 20%;
|
||||||
|
--vignette-scale-radial: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.noscroll ::-webkit-scrollbar-thumb{
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vignette-linear {
|
||||||
|
background: linear-gradient(
|
||||||
|
90deg,
|
||||||
|
rgba(0, 0, 0, var(--vignette-opacity)) 0%,
|
||||||
|
rgba(0, 0, 0, 0) var(--vignette-scale-linear),
|
||||||
|
rgba(0, 0, 0, 0) calc(100% - var(--vignette-scale-linear)),
|
||||||
|
rgba(0, 0, 0, var(--vignette-opacity)) 100%
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
.vignette-radial {
|
||||||
|
background: radial-gradient(
|
||||||
|
circle,
|
||||||
|
rgba(0, 0, 0, 0) calc(100% - var(--vignette-scale-radial)),
|
||||||
|
rgba(0, 0, 0, var(--vignette-opacity)) 100%
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
.animate {
|
||||||
|
animation: fadeIn var(--fadeIn-duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hide {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fadeIn {
|
||||||
|
0% {
|
||||||
|
opacity: 0;
|
||||||
|
transform: scale(1.05);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
opacity: 1;
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
+173
@@ -0,0 +1,173 @@
|
|||||||
|
{
|
||||||
|
"main": {
|
||||||
|
"id": "818dc27015a3a8b9",
|
||||||
|
"type": "split",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "507fe4cb9fb40b05",
|
||||||
|
"type": "tabs",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "4eace81f2bc87c42",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "markdown",
|
||||||
|
"state": {
|
||||||
|
"file": "Welcome.md",
|
||||||
|
"mode": "source",
|
||||||
|
"source": false
|
||||||
|
},
|
||||||
|
"icon": "lucide-file",
|
||||||
|
"title": "Welcome"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"direction": "vertical"
|
||||||
|
},
|
||||||
|
"left": {
|
||||||
|
"id": "6a08ba34065ab16a",
|
||||||
|
"type": "split",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "b61a4c0173c80ac0",
|
||||||
|
"type": "tabs",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "95e8321afc2fdf5a",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "file-explorer",
|
||||||
|
"state": {
|
||||||
|
"sortOrder": "alphabetical",
|
||||||
|
"autoReveal": false
|
||||||
|
},
|
||||||
|
"icon": "lucide-folder-closed",
|
||||||
|
"title": "Files"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "74269fb2e22d8599",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "search",
|
||||||
|
"state": {
|
||||||
|
"query": "",
|
||||||
|
"matchingCase": false,
|
||||||
|
"explainSearch": false,
|
||||||
|
"collapseAll": false,
|
||||||
|
"extraContext": false,
|
||||||
|
"sortOrder": "alphabetical"
|
||||||
|
},
|
||||||
|
"icon": "lucide-search",
|
||||||
|
"title": "Search"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "583ff41e239bbced",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "bookmarks",
|
||||||
|
"state": {},
|
||||||
|
"icon": "lucide-bookmark",
|
||||||
|
"title": "Bookmarks"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"direction": "horizontal",
|
||||||
|
"width": 300
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
"id": "d5fe95067370bf78",
|
||||||
|
"type": "split",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "de827558bc33dc13",
|
||||||
|
"type": "tabs",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "fd81265e589917be",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "backlink",
|
||||||
|
"state": {
|
||||||
|
"collapseAll": false,
|
||||||
|
"extraContext": false,
|
||||||
|
"sortOrder": "alphabetical",
|
||||||
|
"showSearch": false,
|
||||||
|
"searchQuery": "",
|
||||||
|
"backlinkCollapsed": false,
|
||||||
|
"unlinkedCollapsed": true
|
||||||
|
},
|
||||||
|
"icon": "links-coming-in",
|
||||||
|
"title": "Backlinks"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "0d57ff02e0b48af5",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "outgoing-link",
|
||||||
|
"state": {
|
||||||
|
"linksCollapsed": false,
|
||||||
|
"unlinkedCollapsed": true
|
||||||
|
},
|
||||||
|
"icon": "links-going-out",
|
||||||
|
"title": "Outgoing links"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "437389f203bf15c2",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "tag",
|
||||||
|
"state": {
|
||||||
|
"sortOrder": "frequency",
|
||||||
|
"useHierarchy": true,
|
||||||
|
"showSearch": false,
|
||||||
|
"searchQuery": ""
|
||||||
|
},
|
||||||
|
"icon": "lucide-tags",
|
||||||
|
"title": "Tags"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "ffc3e152d6264c18",
|
||||||
|
"type": "leaf",
|
||||||
|
"state": {
|
||||||
|
"type": "outline",
|
||||||
|
"state": {
|
||||||
|
"followCursor": false,
|
||||||
|
"showSearch": false,
|
||||||
|
"searchQuery": ""
|
||||||
|
},
|
||||||
|
"icon": "lucide-list",
|
||||||
|
"title": "Outline"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"direction": "horizontal",
|
||||||
|
"width": 300,
|
||||||
|
"collapsed": true
|
||||||
|
},
|
||||||
|
"left-ribbon": {
|
||||||
|
"hiddenItems": {
|
||||||
|
"switcher:Open quick switcher": false,
|
||||||
|
"graph:Open graph view": false,
|
||||||
|
"canvas:Create new canvas": false,
|
||||||
|
"daily-notes:Open today's daily note": false,
|
||||||
|
"templates:Insert template": false,
|
||||||
|
"command-palette:Open command palette": false,
|
||||||
|
"bases:Create new base": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"active": "4eace81f2bc87c42",
|
||||||
|
"lastOpenFiles": [
|
||||||
|
"Welcome.md"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
This is your new *vault*.
|
||||||
|
|
||||||
|
Make a note of something, [[create a link]], or try [the Importer](https://help.obsidian.md/Plugins/Importer)!
|
||||||
|
|
||||||
|
When you're ready, delete this note and make the vault your own.
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 324 KiB |
Reference in New Issue
Block a user