speedie-nvim | Add new config

This commit is contained in:
speedie 2023-03-05 00:30:29 +01:00
parent 1d82d07955
commit 72b37e3165
2 changed files with 64 additions and 0 deletions

View file

@ -116,17 +116,29 @@ vmap c :%norm $
vmap C :%norm I
nnoremap <C-t> :term<cr>
nnoremap <C-f> :NERDTreeFind<cr>
nnoremap <C-z> :NERDTreeToggle<cr>
nnoremap <C-N> :bnext<cr>
nnoremap <C-P> :bprevious<cr>
nnoremap <C-A> :badd New file<cr>
nnoremap <C-X> :bdelete!<cr>
nnoremap <C-s> :split<cr>
nnoremap <C-w> :vsplit<cr>
nnoremap <C-q> :only<cr>
nnoremap <C-F> :CtrlP<cr>
nnoremap fl :SLoad<cr>
nnoremap fs :SSave<cr>
nnoremap fd :SDelete<cr>
nnoremap fc :SClose<cr>
nnoremap mci :!if [ -x "$(command -v doas)" ]; then; doas make clean install; else; sudo make clean install; fi<cr>
nnoremap mci :!if [ -x "$(command -v doas)" ]; then; doas make clean install; else; sudo make clean install; fi<cr>
nmap j <Plug>(accelerated_jk_gj)
nmap k <Plug>(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

47
.config/nvim/start.sh Executable file
View file

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