add vim medieval

This commit is contained in:
Gabriel Fontes
2022-02-08 12:08:55 -03:00
parent 001da06bc6
commit 8ff657bd4e
4 changed files with 60 additions and 10 deletions
+1
View File
@@ -1,4 +1,5 @@
{ pkgs }: {
gemini-vim-syntax = pkgs.callPackage ./gemini-vim-syntax { };
vim-syntax-shakespeare = pkgs.callPackage ./vim-syntax-shakespeare { };
vim-medieval = pkgs.callPackage ./vim-medieval { };
}
+12
View File
@@ -0,0 +1,12 @@
{ lib, vimUtils, fetchFromGitHub }: vimUtils.buildVimPlugin rec {
pname = "vim-medieval";
version = "2022-02-07";
dontBuild = true;
src = fetchFromGitHub {
owner = "gpanders";
repo = "${pname}";
rev = "029ba76340cc51d481d5fa0ad19e25b0ee13b3c5";
sha256 = "sha256-JYkevNxW/RYLVfxXSGYvVSQwmjk2zSvzxLVTbR0lzek=";
};
patches = [ ./preview-instead-of-scratch.patch ];
}
@@ -0,0 +1,31 @@
diff --git a/autoload/medieval.vim b/autoload/medieval.vim
index eee3adc..91e99b9 100644
--- a/autoload/medieval.vim
+++ b/autoload/medieval.vim
@@ -1,3 +1,4 @@
+let s:tempfile = fnamemodify(tempname(), ':h') . '/medieval'
let s:fences = [{'start': '[`~]\{3,}'}, {'start': '\$\$'}]
let s:opts = ['name', 'target', 'require', 'tangle']
let s:optspat = '\(' . join(s:opts, '\|') . '\):\s*\([0-9A-Za-z_+.$#&/-]\+\)'
@@ -196,18 +197,9 @@ function! s:callback(context, output) abort
call append(tstart + 1, a:output)
endif
else
- " Open result in scratch buffer
- if &splitbelow
- botright new
- else
- topleft new
- endif
-
- call append(0, a:output)
- call deletebufline('%', '$')
- exec 'resize' &previewheight
- setlocal buftype=nofile bufhidden=delete nobuflisted noswapfile winfixheight
- wincmd p
+ " Open result in preview window
+ call writefile(a:output, s:tempfile)
+ exec 'pedit ' . s:tempfile
endif
endfunction
+16 -10
View File
@@ -35,9 +35,6 @@ with inputs.nix-colors.lib { inherit pkgs; };
"Clipboard
set clipboard=unnamedplus
"Conceal
set conceallevel=2
"Fix nvim size according to terminal
"(https://github.com/neovim/neovim/issues/11330)
autocmd VimEnter * silent exec "!kill -s SIGWINCH" getpid()
@@ -76,16 +73,25 @@ with inputs.nix-colors.lib { inherit pkgs; };
plugin = vimThemeFromScheme { scheme = config.colorscheme; };
config = "colorscheme nix-${config.colorscheme.slug}";
}
{
plugin = vim-medieval;
config = ''
nmap <buffer> Z <Plug>(medieval-eval)
let g:medieval_langs = ['haskell=runghc', 'sh']
'';
}
];
};
xdg.configFile."nvim/init.vim".onChange = let
nvr = "${pkgs.neovim-remote}/bin/nvr";
in ''
${nvr} --serverlist | while read server; do
${nvr} --servername $server --nostart -c ':so $MYVIMRC' & \
done
'';
xdg.configFile."nvim/init.vim".onChange =
let
nvr = "${pkgs.neovim-remote}/bin/nvr";
in
''
${nvr} --serverlist | while read server; do
${nvr} --servername $server --nostart -c ':so $MYVIMRC' & \
done
'';
home.sessionVariables = { EDITOR = "nvim"; };