mirror of
https://github.com/Misterio77/Foundry.git
synced 2026-08-28 10:04:20 -05:00
add vim medieval
This commit is contained in:
@@ -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 { };
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"; };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user