cvim wrapper

This commit is contained in:
tavo 2025-07-05 14:20:49 -06:00
parent e470fb910f
commit 62b7efe7e8
5 changed files with 15 additions and 149 deletions

View file

@ -1,10 +0,0 @@
[Appearance]
color_scheme_path=/usr/share/qt5ct/colors/darker.conf
custom_palette=true
icon_theme=breeze-dark
standard_dialogs=default
style=Breeze
[Fonts]
fixed=@Variant(\0\0\0@\0\0\0\x12\0N\0o\0t\0o\0 \0S\0\x61\0n\0s@$\0\0\0\0\0\0\xff\xff\xff\xff\x5\x1\0\x32\x10)
general=@Variant(\0\0\0@\0\0\0\x12\0N\0o\0t\0o\0 \0S\0\x61\0n\0s@$\0\0\0\0\0\0\xff\xff\xff\xff\x5\x1\0\x32\x10)

View file

@ -42,7 +42,6 @@ alias \
calc="bc -l" \
cp="cp -iv" \
mv="mv -iv" \
vim="nvim" \
df-short="df -h | grep -v '\s/dev.*$\|\s/run.*$\|\s/boot.*$'" \
qr-png="qrencode -s 16 -o qr.png" \
qr="qrencode -t ansiutf8" \

View file

@ -1,5 +1,5 @@
export \
TERM="xterm-256color" \
BROWSER="firefox-hardened" \
EDITOR="lvim" \
VISUAL="lvim"
EDITOR="cvim" \
VISUAL="cvim"

147
vim/vimrc
View file

@ -1,137 +1,14 @@
" XDG Specifications
let g:customrtp = expand('~/.config/vim')
let rtp = &runtimepath
set runtimepath=~/.config/vim
let &runtimepath.=','.rtp.',~/.config/vim/after'
set directory=~/.config/vim/swap//,.,~/tmp,/var/tmp,/tmp
set backupdir=~/.config/vim/backup//,.,~/tmp,~/
set spellfile=~/.config/vim/spell/en.utf-8.add
set viminfo+=n~/.config/vim/viminfo
set viewdir=~/.config/vim/view/
set undodir=~/.config/vim/undo//,.
let &runtimepath = g:customrtp . ',' . rtp . ',' . g:customrtp . '/after'
execute 'set directory=' . g:customrtp . '/swap//,.,~/tmp,/var/tmp,/tmp'
execute 'set backupdir=' . g:customrtp . '/backup//,.,~/tmp,~/'
execute 'set spellfile=' . g:customrtp . '/spell/en.utf-8.add'
execute 'set viminfo+=n' . g:customrtp . '/viminfo'
execute 'set viewdir=' . g:customrtp . '/view/'
execute 'set undodir=' . g:customrtp . '/undo//,.'
" Preferences
let mapleader = "\<Space>"
set list listchars=tab:⎸\ ,trail:~
set clipboard=unnamedplus
set gp=git\ grep\ -n
set shellcmdflag=-c
set encoding=utf-8
set relativenumber
filetype plugin on
set shiftwidth=4
set nocompatible
set cursorline
set ignorecase
set smartcase
set expandtab
set autoread
set wildmenu
set hlsearch
set swapfile
set undofile
set mouse=a
set showcmd
set number
syntax on
if (empty($TMUX) && getenv('TERM_PROGRAM') != 'Apple_Terminal')
if (has("nvim"))
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
endif
if (has("termguicolors"))
set termguicolors
endif
endif
" Keybinds
noremap <F5> :setlocal spell! spelllang=en<CR>
noremap <F6> :setlocal spell! spelllang=es<CR>
noremap <F8> :TagbarToggle<CR>
noremap <C-e> !!$SHELL<CR>
noremap <tab> :bn<CR>
noremap <C-c> :bd<CR>
noremap <C-s> :w<CR>
noremap <A-h> 5<C-w><
noremap <A-j> 5<C-w>-
noremap <A-k> 5<C-w>+
noremap <A-l> 5<C-w>>
noremap H :nohl<CR>
noremap <leader><Space> za
autocmd BufWinLeave *.* mkview
" QuickFix
autocmd QuickFixCmdPost [^l]* nested cwindow
autocmd QuickFixCmdPost l* nested lwindow
autocmd QuickFixCmdPost * if &ft ==# 'qf' | wincmd J | endif
function! WrapQuickfixNext()
try
execute 'cnext'
catch /^Vim\%((\a\+)\)\=:E553/
cfirst
endtry
endfunction
function! WrapQuickfixPrev()
try
execute 'cprevious'
catch /^Vim\%((\a\+)\)\=:E553/
clast
endtry
endfunction
nnoremap <silent> <Leader>n :call WrapQuickfixNext()<CR>
nnoremap <silent> <Leader>p :call WrapQuickfixPrev()<CR>
nnoremap <leader>m :make<CR><CR>
nnoremap <F9> :make<CR><CR>
" c/c++
autocmd FileType c :compiler gcc | setlocal makeprg=gcc\ -Wall\ -c\ %
autocmd FileType cpp :compiler gcc | setlocal makeprg=g++\ -Wall\ -c\ %
" groff
autocmd FileType troff noremap <buffer> <silent> <F9> :!zathura --fork %:r.pdf<CR> & disown
autocmd FileType troff noremap <buffer> <C-s> :w<CR> :!grofftex %<CR><CR>
" Python
autocmd FileType python noremap <buffer> <F9> :!python %<CR>
function! SetMakeprg()
if filereadable('Makefile')
set makeprg=make
else
endif
endfunction
autocmd VimEnter * call SetMakeprg()
" Functions
"Open a shell on a vertical split
set splitright
function OpenTerminal()
execute "normal \<C-l>"
execute "normal \<C-l>"
execute "normal \<C-l>"
execute "normal \<C-l>"
let bufNum = bufnr("%")
let bufType = getbufvar(bufNum, "&buftype", "not found")
if bufType == "terminal"
execute "q"
else
execute "bot sp term://bash"
execute "resize -8"
execute "set nonu"
execute "set nornu"
silent au BufLeave <buffer> stopinsert!
silent au BufWinEnter,WinEnter <buffer> startinsert!
execute "tnoremap <buffer> <C-h> <C-\\><C-n><C-w><C-h>"
execute "tnoremap <buffer> <C-t> <C-\\><C-n>:q<CR>"
execute "tnoremap <buffer> <C-\\><C-\\> <C-\\><C-n>"
execute "IndentLinesDisable"
startinsert!
endif
endfunction
nnoremap <C-t> :call OpenTerminal()<CR>
for dir in ['swap', 'backup', 'spell', 'view', 'undo', 'after']
call mkdir(g:customrtp . '/' . dir, 'p', 0700)
endfor

View file

@ -1,3 +1,3 @@
#!/bin/sh
VIMINIT="source $HOME/.config/cvim/vimrc" nvim $@
VIMINIT="source $HOME/.config/cvim/vimrc" vim $@