From 2513ea60aef72a93b209026fd736b43233d86426 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Sat, 21 Nov 2020 16:40:42 -0600 Subject: [PATCH] Cleanup todos and the changes fixing some of them --- apps/neovim/init.vim | 59 ++++++++++++------- apps/shell/fish/config.fish | 2 + .../provision.d/20-install-packages.bash | 2 +- readme.md | 6 -- 4 files changed, 40 insertions(+), 29 deletions(-) diff --git a/apps/neovim/init.vim b/apps/neovim/init.vim index 91b73d4..b0a02a2 100644 --- a/apps/neovim/init.vim +++ b/apps/neovim/init.vim @@ -1,12 +1,11 @@ -scriptencoding utf-8 set fileencoding=utf8 let $vimdir = $XDG_CONFIG_HOME.'/nvim' if empty(glob($vimdir.'/autoload/plug.vim')) - silent !curl -fLo $vimdir/autoload/plug.vim --create-dirs - \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim - autocmd VimEnter * PlugInstall --sync | source $vimdir.'init.vim' + silent !curl -fLo $vimdir/autoload/plug.vim --create-dirs + \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + autocmd VimEnter * PlugInstall --sync | source $vimdir.'init.vim' endif let g:completion_enable_auto_popup = 0 @@ -156,44 +155,60 @@ set foldtext=NeatFoldText() " TODO: only update this portion when needed instead of every render? function! StatusLineBufferByNum(bufnum) - let l:prefix = '%#InactiveBuffer#' + let l:prefix = ' %#InactiveBuffer#' let l:suffix = '%* ' let l:bufinfo = getbufinfo(a:bufnum)[0] - if l:bufinfo.listed == 0 - return '%*' - end if l:bufinfo['hidden'] == 0 && index(l:bufinfo['windows'], g:statusline_winid) >= 0 let l:prefix = '%#ActiveBuffer# ' - let l:suffix = ' %* ' + let l:suffix = ' %*' endif return l:prefix . fnamemodify(bufname(a:bufnum), ':t') . l:suffix endfunction au BufReadPost * | if stridx(&ft, 'commit') >= 0 | exe "startinsert!" | endif -let l:status_line_max_length = 5 +let g:status_line_max_length = 5 function! StatusLineBuffers() - let l:since_active = 0 + let l:active_index = -1 let l:acc = [] - for bufnum in nvim_list_bufs() + for l:bufnum in nvim_list_bufs() + let l:bufinfo = getbufinfo(l:bufnum)[0] + if l:bufinfo.listed == 0 + continue + end let l:entry = StatusLineBufferByNum(bufnum) - if l:entry =~ "^%#ActiveBuffer#" - " - endif let l:acc = add(l:acc, l:entry) - if l:since_active > 0 - let l:since_active = l:since_active + 1 + if l:entry =~ "^%#ActiveBuffer#" + let l:active_index = index(l:acc, l:entry) endif endfor - return join(l:acc, '') + if l:active_index >= 0 + " TODO: instead implement this as a wraparound carousel? + let l:offset = g:status_line_max_length / 2 + let l:min_buf_num = max([0, (l:active_index - offset)]) + let l:max_buf_num = min([(len(l:acc) - 1), (l:min_buf_num + g:status_line_max_length - 1)]) + let l:min_buf_num = max([0, (l:max_buf_num - g:status_line_max_length + 1)]) + let l:buflist = join(l:acc[(l:min_buf_num):(l:max_buf_num)], '') + let l:prefix = "" + let l:suffix = "" + if l:min_buf_num > 0 + let l:prefix = "< " + endif + if l:max_buf_num < len(l:acc) - 1 + let l:suffix = " >" + endif + return l:prefix . l:buflist . l:suffix + else + return join(l:acc, '') + endif endfunction function! StatusLine() - try + " try return StatusLineBuffers().'%*%=%c,%l/%L (%p%%)' - catch - return 'buflisterr%*%=%c,%l/%L (%p%%)' - endtry + " catch + " return 'buflisterr%*%=%c,%l/%L (%p%%)' + " endtry endfunction " set laststatus=0 showtabline tabline=%!StatusLine() diff --git a/apps/shell/fish/config.fish b/apps/shell/fish/config.fish index 2e3f28b..dc29b43 100755 --- a/apps/shell/fish/config.fish +++ b/apps/shell/fish/config.fish @@ -20,6 +20,8 @@ set -Ux ERL_AFLAGS "-kernel shell_history enabled -kernel shell_history_file_byt set -Ux LESS "-r" set -Ux LS_COLORS 'ow=01;36;40' # more sane ls colors set -Ux EDITOR nvim +set -Ux VISUAL less +set -Ux PAGER less set -Ux MANPAGER 'env MANWIDTH="" nvim --cmd "let g:prosession_on_startup=0" +Man!' has_command fd && set -Ux FZF_DEFAULT_COMMAND 'fd --type f --hidden --follow --exclude .git' diff --git a/env/arch-linux/provision.d/20-install-packages.bash b/env/arch-linux/provision.d/20-install-packages.bash index 8436a4e..0d94d43 100755 --- a/env/arch-linux/provision.d/20-install-packages.bash +++ b/env/arch-linux/provision.d/20-install-packages.bash @@ -65,7 +65,7 @@ yay -Sy \ alsa-utils `# Audio Utilities` \ alsa-plugins `# Plugins for ALSA` \ pulseaudio pavucontrol pulsemixer `# Audio Backend and Controls` \ - neovim `# Text Editors` \ + neovim-git `# Text Editors` \ sc-im `# Spreadsheets` \ unzip `# Simple Unzipping` \ tmux `# Terminal Multiplexer` \ diff --git a/readme.md b/readme.md index 14483a2..080f503 100644 --- a/readme.md +++ b/readme.md @@ -16,16 +16,10 @@ curl -s -L https://git.lyte.dev/lytedev/dotfiles/raw/branch/master/bin/init-dotf # To Do -+ nvim statusline overflow + **Learn to use `journalctl`** -+ Vim sessions? + Fix sway workspaces on desktop + Neovim LSP -+ Setup `nnn` + Move to NixOS (WIP) or Guix? Declarative is the future! -+ Custom Iosevka font with kitty-compatible ligatures? -+ Makefile instead of setup script -+ `c` (and similar aliases) could utilize `CDPATH` envvar? + Better/more secure remote management configuration in dotfiles? [1][1] + Setup network file share? + Add vim in the terminal as the handler for many MIME types (xdg-open and such)