diff --git a/.config/nvim/config b/.config/nvim/config index 6aa3820..2a09f49 100755 --- a/.config/nvim/config +++ b/.config/nvim/config @@ -116,17 +116,29 @@ vmap c :%norm $ vmap C :%norm I nnoremap :term + nnoremap :NERDTreeFind nnoremap :NERDTreeToggle + nnoremap :bnext nnoremap :bprevious nnoremap :badd New file nnoremap :bdelete! + nnoremap :split nnoremap :vsplit nnoremap :only + nnoremap :CtrlP +nnoremap fl :SLoad +nnoremap fs :SSave +nnoremap fd :SDelete +nnoremap fc :SClose + +nnoremap mci :!if [ -x "$(command -v doas)" ]; then; doas make clean install; else; sudo make clean install; fi +nnoremap mci :!if [ -x "$(command -v doas)" ]; then; doas make clean install; else; sudo make clean install; fi + nmap j (accelerated_jk_gj) nmap k (accelerated_jk_gk) @@ -142,6 +154,8 @@ if !exists('g:airline_symbols') let g:airline_symbols = {} endif +let g:startify_custom_header = startify#pad(split(system('[ -e "$HOME/.config/nvim/start.sh" ] && $HOME/.config/nvim/start.sh'), '\n')) + let g:airline_powerline_fonts = 1 let g:airline#extensions#tabline#enabled = 1 let g:airline_left_sep = 'ยป' @@ -184,5 +198,8 @@ hi CocErrorHighlight gui=undercurl guisp=red hi SpellBad guisp=red gui=undercurl guifg=NONE guibg=NONE ctermfg=NONE ctermbg=NONE term=underline cterm=undercurl hi SpellCap guisp=yellow gui=undercurl guifg=NONE guibg=NONE ctermfg=NONE ctermbg=NONE term=underline cterm=undercurl +autocmd VimEnter :lcd %:p:h autocmd FileType scss setl iskeyword+=@-@ autocmd BufWritePre * %s/\s\+$//e + +"autocmd BufWritePost options.h !command -v sudo > /dev/null && sudo make clean install || doas make clean install diff --git a/.config/nvim/start.sh b/.config/nvim/start.sh new file mode 100755 index 0000000..4fc62d2 --- /dev/null +++ b/.config/nvim/start.sh @@ -0,0 +1,47 @@ +#!/bin/sh +# neovim start page +# +# The output of this shell script will be displayed on startup. +# +# -- Function map -- +# +# main(); - The first function that gets called. It calls all the other functions so you don't need to touch it for most things. +# prepare(); - This function sets basic variables. +# print_text(); - Prints text helpful to new users. You can change anything there. +# drw_ascii(); - Creates ASCII art from an image, or if it's a text file it will print it out. + +print_text() { + # text that will be printed + printf -- "\ + - Run ':h' for help.\n\ + - Press CTRL+E to configure.\n\ + - Edit ~/.config/nvim/start.sh to customize this start page.\n\ +" + + # if there is no image + [ "$no_image" = "true" ] && printf -- "\ + - Add an image or text file to ~/.config/nvim/images and it will be displayed on startup.\n\ +" + +} + +drw_ascii() { + file="$(find $dir/images -type f | shuf | head -n 1 | grep -E "png|txt")" + [ ! -f "$file" ] && printf "neovim %s\n" "$(nvim -v | awk '{ print $2 }' | head -n 1)" && no_image="true" + printf "$file" | grep -q txt && cat "$file" + printf "$file" | grep -q png && jp2a "$file" --size="80x20" + printf "\n" +} + +prepare() { + dir="$(dirname $0)" + [ -d "$dir/images" ] || mkdir -p $dir/images +} + +main() { + prepare + [ -x $(command -v jp2a) ] && drw_ascii + print_text +} + +main