From 6d39ed2980479fa972cb2d51c592120899281662 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Tue, 6 Jun 2023 12:24:49 -0400 Subject: [PATCH] neovim: Add vim-startify --- modules/neovim/default.nix | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/modules/neovim/default.nix b/modules/neovim/default.nix index 997fbbb..0f07196 100644 --- a/modules/neovim/default.nix +++ b/modules/neovim/default.nix @@ -44,6 +44,7 @@ nnoremap e :set nu! nnoremap t :OverCommandLine%s/ nnoremap a :NvimTreeToggle + nnoremap s :Startify nnoremap f :Files nnoremap g :set hlsearch! nnoremap j :Buffers @@ -178,6 +179,31 @@ nnoremap c (vimtex-env-change) ''; } + { + plugin = vim-startify; + config = '' + let g:startify_custom_header = startify#pad(split(system("cat (random choice (fd . ${pkgs.ponysay}/share/ponysay/quotes))"), '\n')) + + let g:startify_change_to_dir = 0 + + function! s:gitModified() + let files = systemlist('git ls-files -m 2>/dev/null') + return map(files, "{'line': v:val, 'path': v:val}") + endfunction + + function! s:gitUntracked() + let files = systemlist('git ls-files -o --exclude-standard 2>/dev/null') + return map(files, "{'line': v:val, 'path': v:val}") + endfunction + + let g:startify_lists = [ + \ { 'type': 'dir', 'header': [' 歴史 '. getcwd()] }, + \ { 'type': function('s:gitModified'), 'header': [' 変化']}, + \ { 'type': function('s:gitUntracked'), 'header': [' 新規']}, + \ { 'type': 'commands', 'header': [' Commands']}, + \ ] + ''; + } fzf-vim vim-caddyfile vim-graphql