From d34c0431a8f986103c5498bb63dbec1cbfa7b307 Mon Sep 17 00:00:00 2001 From: Steffen Rademacker Date: Sun, 4 Oct 2020 12:58:09 +0200 Subject: [PATCH] Update everything, remove no longer needed configs/plugins, simplify --- hammerspoon/hs/tiling/README.md | 191 -------------------------------- nvim/gotofile.vim | 15 --- nvim/init.vim | 8 +- nvim/keymappings.vim | 14 --- nvim/leaderkeys.vim | 21 ++-- nvim/plugins.vim | 22 ++-- office/mutt/bindings | 2 + zsh/zsh-completions | 2 +- 8 files changed, 23 insertions(+), 252 deletions(-) delete mode 100755 hammerspoon/hs/tiling/README.md delete mode 100644 nvim/gotofile.vim diff --git a/hammerspoon/hs/tiling/README.md b/hammerspoon/hs/tiling/README.md deleted file mode 100755 index a013651c..00000000 --- a/hammerspoon/hs/tiling/README.md +++ /dev/null @@ -1,191 +0,0 @@ -# hs.tiling - -Add tiling window management powers to your [hammerspoon][hammerspoon]. (Fork of nathankot's [mjolnir.tiling](https://github.com/nathankot/mjolnir.tiling).) - -## Features - -* Different layouts per space ([with this magic][magic]) -* Multi-monitor supported -* Custom layouts - -## Quick start - -First up, install [Hammerspoon][hammerspoon] if you haven't already. - -Then install `hs.tiling` by cloning into your hammerspoon configuration directory: - -``` -mkdir -p $HOME/.hammerspoon/hs -git clone https://github.com/dsanson/hs.tiling $HOME/.hammerspoon/hs/tiling -``` - -In your `~/.hammerspoon/init.lua`: - -```lua -local tiling = require "hs.tiling" -local hotkey = require "hs.hotkey" -local mash = {"ctrl", "cmd"} - -hotkey.bind(mash, "c", function() tiling.cycleLayout() end) -hotkey.bind(mash, "j", function() tiling.cycle(1) end) -hotkey.bind(mash, "k", function() tiling.cycle(-1) end) -hotkey.bind(mash, "space", function() tiling.promote() end) -hotkey.bind(mash, "f", function() tiling.goToLayout("fullscreen") end) - --- If you want to set the layouts that are enabled -tiling.set('layouts', { - 'fullscreen', 'main-vertical' -}) -``` - -## Updating - -To update to the latest `hs.tiling`, pull the latest from git: - -``` -cd $HOME/.hammerspoon/hs/tiling -git pull -``` - -## Using custom layouts - -You can define your own layouts like so (please see [layouts.lua](/layouts.lua) for definition examples:) - -```lua -tiling.addLayout('custom', function(windows) - fnutils.each(windows, function(window) - window:maximize() - end) -end) -``` - -## Floating Windows - -Using `tiling.toggleFloat` you can toggle whether or not a window that is on your desktop will be -included in your tiling calculations. You can optionally pass in a function as a callback to process -the window if it was tiled. - -```lua --- Push the window into the exact center of the screen -local function center(window) - frame = window:screen():frame() - frame.x = (frame.w / 2) - (frame.w / 4) - frame.y = (frame.h / 2) - (frame.h / 4) - frame.w = frame.w / 2 - frame.h = frame.h / 2 - window:setFrame(frame) -end - -hotkey.bind(mash, "f", function() tiling.toggleFloat(center) end) -``` - -## Layouts - -These are the layouts that come with `hs.tiling`: - -Name | Screenshot -------------------------------------------- | ------------------------------------ -`fullscreen` | ![fullscreen](https://raw.github.com/dsanson/hs.tiling/master/screenshots/fullscreen.png) -`main-vertical` | ![main-vertical](https://raw.github.com/dsanson/hs.tiling/master/screenshots/main-vertical.png) -`main-horizontal` | ![main-horizontal](https://raw.github.com/dsanson/hs.tiling/master/screenshots/main-horizontal.png) -`rows` | ![rows](https://raw.github.com/dsanson/hs.tiling/master/screenshots/rows.png) -`columns` | ![columns](https://raw.github.com/dsanson/hs.tiling/master/screenshots/columns.png) -`gp-vertical` | ![gp-vertical](https://raw.github.com/dsanson/hs.tiling/master/screenshots/gp-vertical.png) -`gp-horizontal` | ![gp-horizontal](https://raw.github.com/dsanson/hs.tiling/master/screenshots/gp-horizontal.png) - -## Variable Layouts - -I am experimenting with adding support for variable width layouts. - -For now, I have added a variable width variant of `main-vertical`, called -`main-vertical-variable`. It it just like `main-vertical`, except the -proportion of the screen filled by the main window is determined by the value -of the global variable, `mainVertical`, which defaults to `0.5`. I've also -added two functions, `tiling.setMainVertical(val)`, which takes a value -between `0` and `1` (`0.25` means that the main window takes a quarter of the -screen, while the other windows take the remaining three quarters; `0.75` -means that the main window takes 3/4 of the screen, while the remaining -windows take 1/4, and so on) and `tiling.adjustMainVertical(factor)`, which -takes a negative or positive factor by which to adjust the value of -`mainVertical` (e.g., if `mainVertical` is `0.5`, then -`tiling.adjustMainVertical(-0.1)` sets it to `0.4`). - -Here is how I use them in my `init.lua` (as -part of a "windows" mode using `hotkeys.modal`: - -``` -w:bind({},"left", function() tiling.adjustMainVertical(-0.05) end) -w:bind({},"right", function() tiling.adjustMainVertical(0.05) end) -w:bind({},"=", function() tiling.setMainVertical(0.5) end) -``` - -Once I have all the kinks worked out, I plan to enable this feature for -`main-vertical` and `gp-vertical`, as well as a corresponding feature for -`main-horizontal` and `gp-horizontal`. - -## Contributing - -Yes! Please :) - -```sh -git clone https://github.com/dsanson/hs.tiling.git -cd hs.tiling -``` - -## Contributors - -This is a port of [nathankot's](https://github.com/nathankot) [mjolnir.tiling][mjolnir.tiling]. - -I replaced -references to mjolnir extensions (e.g., `mjolnir.window`) with references to -the corresponding hammerspoon extensions (e.g., `hs.window`). I rewrote -function calls in camelCase where necessary. I renamed `tiling.lua` to -`init.lua`. It seems to work. - -Nathan lists, as contributors to mjolnir.tiling, - -* [csaunders](https://github.com/csaunders) -* [acmcelwee](https://github.com/acmcelwee) -* [iveney](https://github.com/iveney) -* [mavant](https://github.com/mavant) -* [OrBaruk](https://github.com/OrBaruk) -* [peterjcaulfield](https://github.com/peterjcaulfield) - -Thanks to Nathan and all these contributors for making mjolnir.tiling, and making it so easy to port over to hammerspoon! - -## To-do - -* [x] Better documentation -* [x] More layouts -* [x] Allow globally enabling/disabling layouts -* [ ] Functions to move windows across spaces -* [ ] Event-based tiling, although requires [sdegutis/mjolnir#72][72] - -[72]: https://github.com/sdegutis/mjolnir/issues/72 -[magic]: https://github.com/dsanson/hs.tiling/blob/master/init.lua#L95-L124 -[hammerspoon]: https://github.com/Hammerspoon/hammerspoon -[mjolnir.tiling]: https://github.com/nathankot/mjolnir.tiling - -## License - -> The MIT License (MIT) -> -> Copyright (c) 2015 Nathan Kot -> -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in -> all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -> THE SOFTWARE. diff --git a/nvim/gotofile.vim b/nvim/gotofile.vim deleted file mode 100644 index c24ea73e..00000000 --- a/nvim/gotofile.vim +++ /dev/null @@ -1,15 +0,0 @@ -set path=.,src -set suffixesadd=.js,.jsx,.scss - -function! LoadMainNodeModule(fname) - let nodeModules = "./node_modules/" - let packageJsonPath = nodeModules . a:fname . "/package.json" - - if filereadable(packageJsonPath) - return nodeModules . a:fname . "/" . json_decode(join(readfile(packageJsonPath))).main - else - return nodeModules . a:fname - endif -endfunction - -set includeexpr=LoadMainNodeModule(v:fname) diff --git a/nvim/init.vim b/nvim/init.vim index 3e60f802..4857f0eb 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -10,10 +10,12 @@ call dein#begin(expand('~/.config/nvim/dein')) call dein#add('editorconfig/editorconfig-vim') call dein#add('junegunn/fzf', { 'merged': 0 }) call dein#add('junegunn/fzf.vim', { 'depends': 'fzf' }) + call dein#add('junegunn/gv.vim') call dein#add('neoclide/coc.nvim', { 'merged': 0, 'rev': 'release' }) call dein#add('sheerun/vim-polyglot') call dein#add('tpope/vim-commentary') call dein#add('tpope/vim-eunuch') + call dein#add('tpope/vim-fugitive') call dein#add('tpope/vim-ragtag') call dein#add('tpope/vim-repeat') call dein#add('tpope/vim-surround') @@ -23,18 +25,12 @@ call dein#begin(expand('~/.config/nvim/dein')) call dein#add('wellle/targets.vim') call dein#add('wellle/tmux-complete.vim') call dein#add('wincent/terminus') - - " group these, since vim-twiggy/GV requires fugitive - call dein#add('tpope/vim-fugitive') - call dein#add('junegunn/gv.vim') - call dein#add('sodapopcan/vim-twiggy') call dein#end() " load the default config and mappings source ~/.config/nvim/config.vim source ~/.config/nvim/autocommands.vim source ~/.config/nvim/statusline.vim -source ~/.config/nvim/gotofile.vim source ~/.config/nvim/keymappings.vim source ~/.config/nvim/leaderkeys.vim source ~/.config/nvim/plugins.vim diff --git a/nvim/keymappings.vim b/nvim/keymappings.vim index d830f8cd..4fd121e2 100644 --- a/nvim/keymappings.vim +++ b/nvim/keymappings.vim @@ -44,20 +44,6 @@ vmap ∆ ]egv vmap ˙ gv -" no help while mishitting ESC - awesome -" just type :help if you need help is easier -noremap - -" hitting jj in insert mode escapes -inoremap jj -inoremap jk - " deactivate stupid ex-mode and man-page stuff nnoremap Q nnoremap K - -" reload files when set autoread is active with F5 -nnoremap :checktime:redraw! - -" For when you forget to sudo.. Really Write the file. -cmap w!! w !sudo tee % >/dev/null diff --git a/nvim/leaderkeys.vim b/nvim/leaderkeys.vim index bca8d642..e0372878 100644 --- a/nvim/leaderkeys.vim +++ b/nvim/leaderkeys.vim @@ -15,30 +15,23 @@ function! s:ToggleZoom() abort endfunction command! ToggleZoom call s:ToggleZoom() -nnoremap z :ToggleZoom +nnoremap z :ToggleZoom " open new vertical split and change to split nnoremap \ vl nnoremap - sj -" open a new split and edit the vimrc // easy sourcing vimrc -nnoremap ve vl :e ~/.config/nvim/init.vim -nnoremap vs :source ~/.config/nvim/init.vim - " Opens an edit command with the path of the currently edited file filled in -nnoremap o :e =expand("%:p:h") . "/" +nnoremap o :e =expand("%:p:h") . "/" " Yank to clipboard with clipper -- see https://github.com/wincent/clipper -nnoremap y :call system('nc localhost 8377', @0) +nnoremap y :call system('nc localhost 8377', @0) " Find merge conflict markers -nnoremap gf /\v^[<\|=>]{7}( .*\|$) - -" paste keeping indentation -nnoremap p p`[v`]= +nnoremap gf /\v^[<\|=>]{7}( .*\|$) " toggle wrapping -nnoremap w :set wrap! wrap? +nnoremap w :set wrap! wrap? -" reload files when set autoread is active with F5 -nnoremap r :checktime +" reload files and redraw +nnoremap r :checktime:redraw! diff --git a/nvim/plugins.vim b/nvim/plugins.vim index 216ad8c7..987df619 100644 --- a/nvim/plugins.vim +++ b/nvim/plugins.vim @@ -1,9 +1,9 @@ " fugitive -nnoremap gs :G20+ -nnoremap gd :Gvdiff20+ -nnoremap gc :Gcommit20+ -nnoremap gw :Gwrite20+ -nnoremap gb :Gblame20+ +nnoremap gs :G20+ +nnoremap gd :Gvdiff20+ +nnoremap gc :Gcommit20+ +nnoremap gw :Gwrite20+ +nnoremap gb :Gblame20+ " fzf nnoremap , :Files @@ -21,7 +21,7 @@ nmap S (easymotion-overwin-f2) " COC.vim inoremap \ pumvisible() ? coc#_select_confirm() : - \ coc#expandableOrJumpable() ? "\=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\" : + \ coc#expandableOrJumpable() ? "\=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\" : \ check_back_space() ? "\" : \ coc#refresh() @@ -34,11 +34,11 @@ let g:coc_snippet_next = '' " Use to confirm completion, `u` means break undo chain at current " position. Coc only does snippet and additional edit on confirm. -" could be remapped by other vim plugin, try `:verbose imap `. +" could be remapped by other vim plugin, try `:verbose imap `. if exists('*complete_info') - inoremap complete_info()["selected"] != "-1" ? "\" : "\u\" + inoremap complete_info()["selected"] != "-1" ? "\" : "\u\" else - inoremap pumvisible() ? "\" : "\u\" + inoremap pumvisible() ? "\" : "\u\" endif " GoTo code navigation. @@ -48,7 +48,7 @@ nmap gi (coc-implementation) nmap gr (coc-references) " Use K to show documentation in preview window. -nnoremap K :call show_documentation() +nnoremap K :call show_documentation() function! s:show_documentation() if (index(['vim','help'], &filetype) >= 0) @@ -88,4 +88,4 @@ nnoremap π :CocList -A --normal yank " coc multiple cursors (very helpful for when in CocSearch) hi CocCursorRange ctermbg=139 ctermfg=234 nmap (coc-cursors-word)* -xmap y/\V=escape(@",'/\')gN(coc-cursors-range)gn +xmap y/\V=escape(@",'/\')gN(coc-cursors-range)gn diff --git a/office/mutt/bindings b/office/mutt/bindings index 8de4d869..3797f7c8 100644 --- a/office/mutt/bindings +++ b/office/mutt/bindings @@ -26,6 +26,8 @@ macro index,pager \cb "urlscan" "call urlscan to extract UR # Sync all email macro index,pager O "mbsync -a" "run mbsync to sync all mail" +macro index,pager B "| /Users/webgefrickel/Downloads/savemail.sh /Users/Downloads" + # View attachments properly. bind attach view-mailcap diff --git a/zsh/zsh-completions b/zsh/zsh-completions index 454d236d..2e009c7a 160000 --- a/zsh/zsh-completions +++ b/zsh/zsh-completions @@ -1 +1 @@ -Subproject commit 454d236d3a793668b873a7b522353c68ec182cfa +Subproject commit 2e009c7ab8e9c7496ed86473ede0917a3cefee01