Improve vim visual-execute logic

This commit is contained in:
Talia 2020-07-30 16:25:46 +02:00
parent c52ff69d2a
commit 9244944247
3 changed files with 9 additions and 8 deletions

View file

@ -10,6 +10,7 @@ export LUA_PATH_5_3="$HOME/.luarocks/share/lua/5.3/?.lua;"\
"$HOME/.luarocks/share/lua/5.3/?/init.lua;"\
"lua_modules/share/lua/5.3/?.lua;"\
"lua_modules/share/lua/5.3/?/init.lua;"\
"$HOME/darkrc/lua/?.lua"\
";"
export LUA_CPATH_5_3="$HOME/.luarocks/lib/lua/5.3/?.so;"\
"$HOME/.luarocks/lib/lua/5.3/?/init.so;"\
@ -21,6 +22,7 @@ export LUA_PATH_5_1="$HOME/.luarocks/share/lua/5.1/?.lua;"\
"$HOME/.luarocks/share/lua/5.1/?/init.lua;"\
"lua_modules/share/lua/5.1/?.lua;"\
"lua_modules/share/lua/5.1/?/init.lua;"\
"$HOME/darkrc/lua/?.lua"\
";"
export LUA_CPATH_5_1="$HOME/.luarocks/lib/lua/5.1/?.so;"\
"$HOME/.luarocks/lib/lua/5.1/?/init.so;"\

View file

@ -76,7 +76,7 @@ set swapfile
set gdefault
" set wrap
set nowrap
set breakat=\ .,{
au BufEnter,BufRead * set linebreak
set display+=lastline
@ -545,16 +545,10 @@ noremap gk k
" --- CLIPBOARD ---
nnoremap Y y$
" --- VISUAL EXECUTE ---
vnoremap <C-CR> ""y<CR>
\ :call setreg("\"", substitute(getreg("\""), "\n", "", ""), "v")<CR>
\ :<C-r>"<CR>`<
" --- MOONSCRIPT ---
let g:mooncompile = "!moonc ".expand("<sfile>:p:h")."/lua"
command! Mooncompile silent exec g:mooncompile
let g:exe_prg = 'moonc -- | lua -e "package.path=package.path..[[;'.expand('<sfile>:p:h:h').'/lua/?.lua]];vim=require[[vim]]" -'
vnoremap <CR> :<C-U>exec "'<,'>!".g:exe_prg<CR>
inoremap <C-Space> <C-[>0v$:<C-U>exec "'<,'>!".g:exe_prg<CR>
" --- OTHER ---
" Don't exit visual mode when "shifting"

5
vim/plugin/vexe.vim Normal file
View file

@ -0,0 +1,5 @@
" --- VISUAL EXECUTE ---
let $LUA_PATH=expand('<sfile>:p:h:h')."/lua/?.lua;;"
let g:exe_prg = 'lua -e "vim=require[[vim]]" -'
vnoremap <CR> :<C-U>exec "'<,'>!".g:exe_prg<CR>
inoremap <C-Space> <C-[>0v$:<C-U>exec "'<,'>!".g:exe_prg<CR>