dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 92d86ac87b1180e931e8122f578eea011f277f4d
parent e14222e9d064948d8f328dfc992a462b21db3290
Author: Anders Damsgaard <andersd@riseup.net>
Date:   Thu, 19 Oct 2017 14:25:08 -0400

fix goyo mode, bind to <leader>y

Diffstat:
Mlinks/.vim/keybinds.vim | 33+++------------------------------
Mlinks/.vim/plugins.vim | 28+++++++++++++++++++++++++---
2 files changed, 28 insertions(+), 33 deletions(-)

diff --git a/links/.vim/keybinds.vim b/links/.vim/keybinds.vim @@ -7,6 +7,9 @@ nmap \a :set formatoptions-=a<CR>:echo "autowrap disabled"<CR> " Save with ZX nmap ZX :w<CR> +" toggle distraction-free editing +nmap <leader>y :set nolist<CR>:Goyo<CR> + " use , instead of \ as leader "let mapleader="," " use space instead of \ as leader @@ -104,12 +107,6 @@ if has('nvim') nmap <leader><CR> :terminal<CR> endif -" Switch split focus with Alt+{h,j,k,l} -"nnoremap <C-h> <C-w>h -"nnoremap <C-j> <C-w>j -"nnoremap <C-k> <C-w>k -"nnoremap <C-l> <C-w>l - let g:tmux_navigator_no_mappings = 1 nnoremap <silent> <C-h> :TmuxNavigateLeft<CR> nnoremap <silent> <C-j> :TmuxNavigateDown<CR> @@ -136,12 +133,6 @@ nmap <leader>F zA " zM: close all folds " zR: open all folds -" Switch split focus with <C-h>, <C-j>, <C-k> and <C-l> -"map <C-h> <C-w>h -"map <C-j> <C-w>j -"map <C-k> <C-w>k -"map <C-l> <C-w>l - " Use home row keys as Esc inoremap jk <Esc> inoremap lkj <Esc>:write<CR> @@ -190,10 +181,6 @@ nmap <leader>c :Start ctags -R --python-kinds=-i --langmap=c++:.cu,c++:.cuh .<CR " When the cursor is on a function call, press <Ctrl-[> to go to its definition. " Press <Ctrl-t> to go back " Use the Ctrl-P plugin to search the tags -"nmap <leader>P :CtrlPTag<CR> -"nmap <leader>b :CtrlPBuffer<CR> -"nmap <leader>O :CtrlPMRUFiles<CR> -"nmap <leader>o :CtrlP<CR> " file search if executable("rg") @@ -216,19 +203,6 @@ nmap <leader>l :Lines<CR> nmap <leader>L :BLines<CR> nmap <leader>t :Tags<CR> -" use git or silver searcher (ag) for CtrlP autocompletion -let g:ctrlp_use_caching = 0 -if executable('ag') - set grepprg=ag\ --nogroup\ --nocolor - - let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' -else - let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . -co --exclude-standard', 'find %s -type f'] - let g:ctrlp_prompt_mappings = { - \ 'AcceptSelection("e")': ['<space>', '<cr>', '<2-LeftMouse>'], - \ } -endif - " Copy and paste to system clipboard with <Space>v and <Space>y vmap <Leader>y "+y vmap <Leader>d "+d @@ -248,4 +222,3 @@ let g:startify_custom_header = \ map(split(system('fortune -s | cowthink'), '\n'), '" ".v:val') \ + ['',''] -nnoremap <leader>M :CtrlPMpc<cr> diff --git a/links/.vim/plugins.vim b/links/.vim/plugins.vim @@ -18,12 +18,11 @@ Plug 'mhinz/vim-startify' " startup screen Plug 'guns/xterm-color-table.vim' " show color table with :XtermColorTable Plug 'Yggdroot/indentLine' " show indent levels with thin vertical lines Plug 'embear/vim-foldsearch' " hide/show lines matching a patter - +Plug 'junegunn/goyo.vim' " distraction-free editing in prose mode +Plug 'junegunn/limelight.vim' " highlight current paragraph in goyo """""" File system """"""" Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } -Plug 'kien/ctrlp.vim' -Plug 'lucidstack/ctrlp-mpc.vim' " Control mpd by CtrlP Plug 'justinmk/vim-gtfo' " open file manager (gof)/tmux pane (got) @ current dir Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } Plug 'junegunn/fzf.vim' @@ -127,3 +126,26 @@ let g:vim_markdown_math=1 " let g:ackprg = 'ag --vimgrep' "end + +function! s:goyo_enter() + silent !tmux set status off + silent !tmux list-panes -F '\#F' | grep -q Z || tmux resize-pane -Z + set noshowmode + set noshowcmd + set nolist + set scrolloff=999 + Limelight +endfunction + +function! s:goyo_leave() + silent !tmux set status on + silent !tmux list-panes -F '\#F' | grep -q Z && tmux resize-pane -Z + set showmode + set showcmd + set list + set scrolloff=3 + Limelight! +endfunction + +autocmd! User GoyoEnter nested call <SID>goyo_enter() +autocmd! User GoyoLeave nested call <SID>goyo_leave()