From 842bb7fd0e5929190f51c5937b06b3e8ff1ccddc Mon Sep 17 00:00:00 2001 From: Hektor Misplon Date: Fri, 28 Aug 2020 10:03:45 +0200 Subject: [PATCH] Add atom hydra config --- .atom/config.cson | 16 + .atom/init.coffee | 1 + .atom/keymap.cson | 13 + .../atom-hydra/styles/atom-hydra.less | 91 +++++ .../vim-mode-plus/styles/vim-mode-plus.less | 320 ++++++++++++++++++ .bin/save-vimwiki | 5 + 6 files changed, 446 insertions(+) create mode 100644 .atom/config.cson create mode 100644 .atom/init.coffee create mode 100644 .atom/keymap.cson create mode 100644 .atom/packages/atom-hydra/styles/atom-hydra.less create mode 100644 .atom/packages/vim-mode-plus/styles/vim-mode-plus.less create mode 100755 .bin/save-vimwiki diff --git a/.atom/config.cson b/.atom/config.cson new file mode 100644 index 0000000..426a699 --- /dev/null +++ b/.atom/config.cson @@ -0,0 +1,16 @@ +"*": + core: + autoHideMenuBar: true + telemetryConsent: "no" + themes: [ + "one-dark-ui" + "dun-syntax" + ] + editor: + fontSize: 17 + "exception-reporting": + userId: "6f9fc289-7b3c-4490-937e-5e58e9765c5e" + "status-bar": + isVisible: false + welcome: + showOnStartup: false diff --git a/.atom/init.coffee b/.atom/init.coffee new file mode 100644 index 0000000..47468e3 --- /dev/null +++ b/.atom/init.coffee @@ -0,0 +1 @@ +atom.commands.dispatch(document.querySelector('atom-workspace'), 'atom-hydra:toggle') diff --git a/.atom/keymap.cson b/.atom/keymap.cson new file mode 100644 index 0000000..7b4d43a --- /dev/null +++ b/.atom/keymap.cson @@ -0,0 +1,13 @@ +'atom-text-editor.vim-mode-plus:not(.insert-mode)': + 'space s h': 'window:focus-pane-on-left' + 'space s l': 'window:focus-pane-on-right' + 'space s k': 'window:focus-pane-above' + 'space s j': 'window:focus-pane-below' + 'space s v': 'pane:split-right-and-copy-active-item' + 'space s s': 'pane:split-down-and-copy-active-item' + 'space q': 'core:close' + 's': 'unset!' + 'space p': 'fuzzy-finder:toggle-file-finder' + +'atom-text-editor': + 'ctrl-b': 'tree-view:toggle' diff --git a/.atom/packages/atom-hydra/styles/atom-hydra.less b/.atom/packages/atom-hydra/styles/atom-hydra.less new file mode 100644 index 0000000..b37a3f9 --- /dev/null +++ b/.atom/packages/atom-hydra/styles/atom-hydra.less @@ -0,0 +1,91 @@ +@import "ui-variables"; + +&.hydra-flash { + background: rgba(255, 255, 255, 0.5) !important; +} + +&.evalFlash { + background: rgba(255, 255, 255, 0.8) !important; +} + +.hydra, +.hydra canvas { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: -1; + background: #000; +} + +body.hydra-enabled { + &, + atom-workspace, + .header *, + .footer *, + atom-workspace-axis, + atom-workspace-axis + :not(.cursor):not(autocomplete-suggestion-list):not(atom-overlay):not(span):not(.region), + atom-workspace *:before, + atom-workspace *:after { + background: transparent; + border: none !important; + text-shadow: 0 1px 1px black; + box-shadow: none !important; + } + + .line > span { + background: rgba(0, 0, 0, 1); + } + + .cursor { + border-color: solid #0ff !important; + } + autocomplete-suggestion-list, + atom-overlay { + background: rgba(0, 0, 0, 0.9) !important; + } + .region { + background: rgba(0, 255, 255, 0.4) !important; + z-index: 9 !important; + } + .selected:before { + background: #0005 !important; + border-left: 8px #8888 solid !important; + } + li.texteditor.tab{ + background: rgba(0, 0, 0, 0.0)!important; + } + } + +atom-text-editor.editor .line { + transition: background-color .8s ease-out; + -webkit-transition: background-color .8s ease-out; + background-color: rgba(0, 0, 0, 0.6); + + &.line-error { + background-color: fadeout(@background-color-error, 95%); + border: 1px solid fadeout(@background-color-error, 50%); + } + + &.line-highlight { + background-color: @background-color-highlight; + } + + &.eval-success { + color: @text-color-success; + background-color: fadeout(@background-color-success, 50%); + } + + &.eval-error, + &.eval-syntax-error { + color: @text-color-error; + background-color: @background-color-error; + } +} + +.elegante { + background-color: #f00; + font-family: fantasy; +} diff --git a/.atom/packages/vim-mode-plus/styles/vim-mode-plus.less b/.atom/packages/vim-mode-plus/styles/vim-mode-plus.less new file mode 100644 index 0000000..2b19f31 --- /dev/null +++ b/.atom/packages/vim-mode-plus/styles/vim-mode-plus.less @@ -0,0 +1,320 @@ +@import "syntax-variables"; +@import "ui-variables"; + +.cursor-base () { + border: none; + background: none; + opacity: 0.5; +} + +.underline-cursor(@bottom-width: 0.2em) { + .cursor-base(); + border-bottom-width: @bottom-width; + border-bottom-style: solid; + border-bottom-color: @syntax-cursor-color; +} + +atom-text-editor.vim-mode-plus.normal-mode, +atom-text-editor.vim-mode-plus.visual-mode, +atom-text-editor.vim-mode-plus.operator-pending-mode, +atom-text-editor.vim-mode-plus.insert-mode.replace { + &.is-focused, + &.vim-mode-plus-input-focused, + &.vim-mode-plus-search-input-focused { + .cursor { + .cursor-base(); + background-color: @syntax-cursor-color; // block-cursor + } + } + &.vim-mode-plus-input-focused.hide-cursor { + .cursor { opacity: 0; } + .cursors.blink-off .cursor { opacity: 0; } + } +} + +atom-text-editor.vim-mode-plus.operator-pending-mode { + &.is-focused, + &.vim-mode-plus-search-input-focused { + .cursor { .underline-cursor(0.6em); } + .cursors.blink-off .cursor { opacity: 0; } + } +} + +atom-text-editor.vim-mode-plus.insert-mode.replace { + &.is-focused { + .cursor { + .underline-cursor(0.3em); + opacity: 0.8; + } + } +} + +// vim-mode-plus-input-focused for surround, f, F, t, T, r etc. +atom-text-editor.vim-mode-plus.normal-mode, +atom-text-editor.vim-mode-plus.visual-mode, +atom-text-editor.vim-mode-plus.operator-pending-mode, { + &.vim-mode-plus-input-focused { + .cursor { .underline-cursor(); } + } +} + +atom-text-editor.vim-mode-plus-input-char-waiting { + &.is-focused { .cursor { .underline-cursor(); } } +} + +// Flash ranges e.g. flashing yanked range. +// ========================= +.flash-animation (@animation-name, @color) { + @keyframes @animation-name { + from { background-color: @color; } + to { background-color: transparent; } + } +} +.flash (@animation-name; @duration) { + animation-name: @animation-name; + animation-duration: @duration; + animation-iteration-count: 1; +} + +@flash-base-color: contrast(@syntax-background-color, darken(@syntax-selection-color, 3%), lighten(@syntax-selection-color, 3%)); +@flash-search-color: fadeout(darken(@syntax-selection-flash-color, 10%), 20%); +@flash-added-color: fadeout(darken(@syntax-color-added, 10%), 50%); +@flash-removed-color: fadeout(@syntax-color-removed, 50%); + +// flashOnOperate +.flash-animation(flash-operator, @flash-base-color); +.flash-animation(flash-operator-occurrence, @flash-added-color); +.flash-animation(flash-operator-remove-occurrence, @flash-removed-color); + +// flashOnUndoRedo +.flash-animation(flash-undo-redo, @flash-base-color); +.flash-animation(flash-undo-redo-multiple-changes, @flash-added-color); +.flash-animation(flash-undo-redo-multiple-deletes, @flash-removed-color); + +// flashOnSearch +.flash-animation(flash-search, @flash-search-color); +.flash-animation(flash-screen, @flash-base-color); + +atom-text-editor .vim-mode-plus-flash { + // flashOnOperate + &.operator .region { .flash(flash-operator, 0.5s); } + &.operator-long .region { .flash(flash-operator, 0.8s); } + &.operator-occurrence .region { .flash(flash-operator-occurrence, 0.8s); } + &.operator-remove-occurrence .region { .flash(flash-operator-remove-occurrence, 0.8s); } + + // flashOnUndoRedo + &.undo-redo .region { .flash(flash-undo-redo, 0.5s); } + &.undo-redo-multiple-changes .region { .flash(flash-undo-redo-multiple-changes, 0.5s); } + &.undo-redo-multiple-deletes .region { .flash(flash-undo-redo-multiple-deletes, 0.5s); } + + // flashOnSearch + &.search .region { .flash(flash-search, 1.0s); z-index: 1; } + &.screen .region { .flash(flash-screen, 0.3s); } + + // demo-mode pkg integration to stop flash while demo-mode's hover is active + &.operator-demo .region { background: @flash-base-color; } + &.operator-long-demo .region { background: @flash-base-color; } + &.operator-occurrence-demo .region { background: @flash-added-color; } + &.operator-remove-occurrence-demo .region { background: @flash-removed-color; } + &.undo-redo-demo .region { background: @flash-base-color; } + &.undo-redo-multiple-changes-demo .region { background: @flash-added-color; } + &.undo-redo-multiple-deletes-demo .region { background: @flash-removed-color; } +} + +// Hover Counter +// ========================= +.vim-mode-plus-hover { + display: block; + color: @text-color-highlight; + background-color: @base-background-color; + border-radius: @component-border-radius; + box-shadow: 0 0 1px @syntax-text-color; + + margin-top: -3.0em; + margin-left: -0.3em; + padding-left: 0.2em; + padding-right: 0.2em; + text-align: center; + + &.first { background-color: @background-color-info; } + &.last { background-color: @background-color-error; } +} + +atom-text-editor[mini].vim-mode-plus-input { + background-color: inherit; + font-weight: normal; + color: @text-color; + line-height: 1.28; + cursor: default; + white-space: nowrap; + padding-left: 10px; + height: 0px !important; + width: 0px !important; + overflow: hidden !important; + border: none !important; + padding: 0 !important; + display: block !important; + position: fixed !important; + top: -10px !important; + left: -10px !important; +} + +// Search +// ========================= +// input +.vim-mode-plus-search-container { + display: flex; + > div { + padding: @component-padding/2 @component-padding; + border: none; + } + .editor-container { width: 100%; } +} + +atom-text-editor[mini].vim-mode-plus-search { + border: none; + color: @text-color; + cursor: default; + &.is-focused { box-shadow: none; } + &::before { + font-size: 1.2em; + padding-right: 0.5em; + content: "/"; + } + &.backwards::before { content: "?"; } +} + +@search-match-base: @syntax-result-marker-color; +@search-match: hsla(hue(@search-match-base), saturation(@search-match-base), lightness(@search-match-base), 0.4); +@search-match-first: fadeout(@syntax-color-renamed, 60%); +@search-match-last: fadeout(@syntax-color-removed, 60%); +@search-match-border-current: hsla(hue(@search-match-base), saturation(@search-match-base), lightness(@search-match-base), 1.0); +@search-match-border-first: syntax-color-renamed; +@search-match-border-last: syntax-color-removed; + +atom-text-editor:not(.silent) { + .vim-mode-plus-search-match { + .region { background-color: @search-match; } + &.first .region { background-color: @search-match-first; } + &.last .region { background-color: @search-match-last; } + } +} + +@keyframes flash-find-char { + from { border-color: @syntax-color-function; } + to { border-color: transparent; } +} + +// highlight +.round-box { + box-sizing: border-box; + border-radius: @component-border-radius; +} + +atom-text-editor { + .vim-mode-plus-search-match { + .region { + .round-box(); + border: 2px solid transparent; + transition: border-color 0.2s; + } + &.current .region { + border-color: @search-match-border-current; + transition-duration: 0.1s; + } + &.first.current .region { + border-color: search-match-border-first; + } + &.last.current .region { + border-color: @search-match-border-last; + } + } + .vim-mode-plus-highlight-search .region { + .round-box(); + border: 1px solid fadeout(@syntax-text-color, 70%); + background-color: @syntax-selection-color; + } + .vim-mode-plus-persistent-selection .region { + background-color: @syntax-selection-color; + } + .vim-mode-plus-target-range .region { + background-color: @syntax-selection-color; + } + .vim-mode-plus-occurrence-base .region { + box-sizing: border-box; + border-bottom-width: 2px; + border-bottom-style: dotted; + + z-index: 1; + border-color: @syntax-color-modified; + } + + .vim-mode-plus-find-char { + .region { + box-sizing: border-box; + border-width: 0px; + border-bottom-width: 2px; + border-style: solid; + } + &.pre-confirm .region { + border-color: @syntax-color-modified; + &.current { border-bottom-width: 5px; } + } + &.post-confirm .region { + .flash(flash-find-char, 2.0s); + &.long { animation-duration: 4.0s; } + } + } +} + +// Maximize Pane +// ========================= +atom-workspace.vim-mode-plus--pane-maximized { + atom-dock.left { display: none; } + atom-dock.right { display: none; } + atom-dock.bottom { display: none; } + atom-pane-container { + position: relative; + atom-pane-axis:not(.vim-mode-plus--active-pane-axis) { display: none; } + atom-pane { + .item-views { background: @syntax-background-color !important; } + display: none; + &.vim-mode-plus--active-pane { + display: flex; + position: absolute; + top: 0; + right: 0; + left: 0; + bottom: 0; + z-index: 100; + } + } + } + &.vim-mode-plus--hide-tab-bar { .tab-bar { display: none; } } + &.vim-mode-plus--hide-status-bar { .status-bar { display: none; } } + &.vim-mode-plus--pane-centered { + atom-text-editor:not(.mini) { + margin-left: 20%; + atom-text-editor { + // Some package embed another text-editor into normal text-editor by using block decoration. + // But we don't want this editor in editor centered again. + // E.g. git-diff-details, inline-git-diff + margin-left: 0%; + } + } + } +} + + +// SelectList Highlight matched text +// ========================= +.vim-mode-plus-select-list .list-group .character-match { + color: @text-color-highlight; + font-weight: bold; +} + +.demo-mode-container { + .kind { + color: @text-color-selected; + } +} diff --git a/.bin/save-vimwiki b/.bin/save-vimwiki new file mode 100755 index 0000000..fa5af86 --- /dev/null +++ b/.bin/save-vimwiki @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +cd $HOME/.vimwiki +git a $HOME/.vimwiki +git cm 'Update' +git push