neovim: add template for shell.nix files

This commit is contained in:
teutat3s 2022-04-26 11:31:50 +02:00
parent 895cdc30b9
commit a7215fa101
Signed by: teutat3s
GPG key ID: 4FA1D3FA524F22C1
2 changed files with 22 additions and 0 deletions

View file

@ -8,6 +8,14 @@ set completeopt=menuone,noinsert,noselect
" Avoid showing extra messages when using completion " Avoid showing extra messages when using completion
set shortmess+=c set shortmess+=c
function AddTemplate(tmpl_file)
exe "0read " . a:tmpl_file
set nomodified
6
endfunction
autocmd BufNewFile shell.nix call AddTemplate("$XDG_DATA_HOME/nvim/templates/shell.nix.tmpl")
" Configure neovim 0.6+ experimental LSPs " Configure neovim 0.6+ experimental LSPs
" https://github.com/neovim/nvim-lspconfig " https://github.com/neovim/nvim-lspconfig
" https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md " https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md

View file

@ -54,6 +54,20 @@ in
# Ensure nvim backup directory gets created # Ensure nvim backup directory gets created
# Workaround for E510: Can't make backup file (add ! to override) # Workaround for E510: Can't make backup file (add ! to override)
xdg.dataFile."nvim/backup/.keep".text = ""; xdg.dataFile."nvim/backup/.keep".text = "";
xdg.dataFile."nvim/templates/.keep".text = "";
xdg.dataFile."shell.nix.tmpl" = {
text = ''
let
unstable = import (fetchTarball https://github.com/nixos/nixpkgs/archive/nixos-unstable.tar.gz) { };
in
{ nixpkgs ? import <nixpkgs> {} }:
with nixpkgs; mkShell {
buildInputs = [
];
}
'';
target = "nvim/templates/shell.nix.tmpl";
};
# Allow unfree packages only on a user basis, not on a system-wide basis # Allow unfree packages only on a user basis, not on a system-wide basis
xdg.configFile."nixpkgs/config.nix".text = " { allowUnfree = true; } "; xdg.configFile."nixpkgs/config.nix".text = " { allowUnfree = true; } ";