Update everything, remove no longer needed configs/plugins, simplify

main
Steffen Rademacker 4 years ago
parent 5b0178120d
commit d34c0431a8

@ -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.

@ -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)

@ -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

@ -44,20 +44,6 @@ vmap ∆ ]egv
vmap ˙ <gv
vmap ¬ >gv
" no help while mishitting ESC - awesome
" just type :help if you need help is easier
noremap <F1> <ESC>
" hitting jj in insert mode escapes
inoremap jj <ESC>
inoremap jk <ESC>
" deactivate stupid ex-mode and man-page stuff
nnoremap Q <nop>
nnoremap K <nop>
" reload files when set autoread is active with F5
nnoremap <F5> :checktime<CR>:redraw!<CR>
" For when you forget to sudo.. Really Write the file.
cmap w!! w !sudo tee % >/dev/null

@ -15,30 +15,23 @@ function! s:ToggleZoom() abort
endfunction
command! ToggleZoom call s:ToggleZoom()
nnoremap <leader>z :ToggleZoom<CR>
nnoremap <leader>z :ToggleZoom<cr>
" open new vertical split and change to split
nnoremap <leader>\ <C-w>v<C-w>l
nnoremap <leader>- <C-w>s<C-w>j
" open a new split and edit the vimrc // easy sourcing vimrc
nnoremap <leader>ve <C-w>v<C-w>l :e ~/.config/nvim/init.vim<cr>
nnoremap <leader>vs :source ~/.config/nvim/init.vim<cr>
" Opens an edit command with the path of the currently edited file filled in
nnoremap <leader>o :e <C-R>=expand("%:p:h") . "/" <CR>
nnoremap <leader>o :e <C-R>=expand("%:p:h") . "/" <cr>
" Yank to clipboard with clipper -- see https://github.com/wincent/clipper
nnoremap <leader>y :call system('nc localhost 8377', @0)<CR>
nnoremap <leader>y :call system('nc localhost 8377', @0)<cr>
" Find merge conflict markers
nnoremap <leader>gf /\v^[<\|=>]{7}( .*\|$)<CR>
" paste keeping indentation
nnoremap <leader>p p`[v`]=
nnoremap <leader>gf /\v^[<\|=>]{7}( .*\|$)<cr>
" toggle wrapping
nnoremap <leader>w :set wrap! wrap?<CR>
nnoremap <leader>w :set wrap! wrap?<cr>
" reload files when set autoread is active with F5
nnoremap <leader>r :checktime<CR>
" reload files and redraw
nnoremap <leader>r :checktime<cr>:redraw!<cr>

@ -1,9 +1,9 @@
" fugitive
nnoremap <silent> <leader>gs :G<CR><C-w>20+
nnoremap <silent> <leader>gd :Gvdiff<CR><C-w>20+
nnoremap <silent> <leader>gc :Gcommit<CR><C-w>20+
nnoremap <silent> <leader>gw :Gwrite<CR><C-w>20+
nnoremap <silent> <leader>gb :Gblame<CR><C-w>20+
nnoremap <silent> <leader>gs :G<cr><C-w>20+
nnoremap <silent> <leader>gd :Gvdiff<cr><C-w>20+
nnoremap <silent> <leader>gc :Gcommit<cr><C-w>20+
nnoremap <silent> <leader>gw :Gwrite<cr><C-w>20+
nnoremap <silent> <leader>gb :Gblame<cr><C-w>20+
" fzf
nnoremap <silent> <space>, :Files<cr>
@ -21,7 +21,7 @@ nmap <leader>S <Plug>(easymotion-overwin-f2)
" COC.vim
inoremap <silent><expr> <C-j>
\ pumvisible() ? coc#_select_confirm() :
\ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
\ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<cr>" :
\ <SID>check_back_space() ? "\<C-j>" :
\ coc#refresh()
@ -34,11 +34,11 @@ let g:coc_snippet_next = '<c-j>'
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current
" position. Coc only does snippet and additional edit on confirm.
" <cr> could be remapped by other vim plugin, try `:verbose imap <CR>`.
" <cr> could be remapped by other vim plugin, try `:verbose imap <cr>`.
if exists('*complete_info')
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<cr>"
else
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<cr>"
endif
" GoTo code navigation.
@ -48,7 +48,7 @@ nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Use K to show documentation in preview window.
nnoremap <silent> K :call <SID>show_documentation()<CR>
nnoremap <silent> K :call <SID>show_documentation()<cr>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
@ -88,4 +88,4 @@ nnoremap π :<C-u>CocList -A --normal yank<cr>
" coc multiple cursors (very helpful for when in CocSearch)
hi CocCursorRange ctermbg=139 ctermfg=234
nmap <silent> <c-n> <Plug>(coc-cursors-word)*
xmap <silent> <c-n> y/\V<C-r>=escape(@",'/\')<CR><CR>gN<Plug>(coc-cursors-range)gn
xmap <silent> <c-n> y/\V<C-r>=escape(@",'/\')<cr><cr>gN<Plug>(coc-cursors-range)gn

@ -26,6 +26,8 @@ macro index,pager \cb "<pipe-message>urlscan<enter>" "call urlscan to extract UR
# Sync all email
macro index,pager O "<shell-escape>mbsync -a<enter>" "run mbsync to sync all mail"
macro index,pager B "| /Users/webgefrickel/Downloads/savemail.sh /Users/Downloads<enter>"
# View attachments properly.
bind attach <return> view-mailcap

@ -1 +1 @@
Subproject commit 454d236d3a793668b873a7b522353c68ec182cfa
Subproject commit 2e009c7ab8e9c7496ed86473ede0917a3cefee01
Loading…
Cancel
Save