Compare commits
16 Commits
12a3293fff
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 3db17f9849 | |||
| 8564daf4b5 | |||
| f19f71c182 | |||
| 084fff8e1a | |||
| 82226b4f78 | |||
| c4c65c4e65 | |||
| 8ecfde7ce1 | |||
|
|
437ce3ff2e | ||
|
|
4ad4a777f6 | ||
| 7daedc0b31 | |||
| 5ee0540a2e | |||
| 41ec16380b | |||
| d79f1fd6d4 | |||
| 742e6f614a | |||
| 730ec3b4bd | |||
| 1234f9bd4c |
@@ -95,7 +95,7 @@ else:
|
||||
for variable in variables:
|
||||
if not variable == "" and not variable.startswith("typ"):
|
||||
variableless = variable.replace("\t", "").replace (" ", "")
|
||||
snip.rv += f"-- @variable {variableless}\n"
|
||||
snip.rv += f"\t-- @variable {variableless}\n"
|
||||
`-- @description $4
|
||||
procedure ${1:`!p snip.rv = fn.split('.')[0].capitalize()`} `!p snip.rv = "" if t[2] == "" else "("`${2:N : Natural}`!p snip.rv = "" if t[2] == "" else ")"` is
|
||||
$3
|
||||
@@ -129,7 +129,7 @@ for parameter in parameters:
|
||||
for parameter in parameter_list:
|
||||
if not parameter == "" and not parameter.startswith("typ"):
|
||||
parameterless = parameter.replace("\t", "")
|
||||
snip.rv += f"-- @parameter {parameterless}\n"
|
||||
snip.rv += f"\t-- @parameter {parameterless}\n"
|
||||
``!p
|
||||
snip.rv = ""
|
||||
if t[4].startswith("l"):
|
||||
@@ -139,7 +139,7 @@ else:
|
||||
for variable in variables:
|
||||
if not variable == "" and not variable.startswith("typ") and not variable.startswith("--"):
|
||||
variableless = variable.replace("\t", "").replace (" ", "")
|
||||
snip.rv += f"-- @variable {variableless}\n"
|
||||
snip.rv += f"\t-- @variable {variableless}\n"
|
||||
` -- @description $5
|
||||
function ${1:`!p snip.rv = fn.split('.')[0].capitalize()`} `!p snip.rv = "" if t[2] == "" else "("`${2:N : Natural}`!p snip.rv = "" if t[2] == "" else ")"` return ${3:Natural} is
|
||||
$4
|
||||
@@ -187,7 +187,8 @@ if t[6] == "y":
|
||||
endsnippet
|
||||
|
||||
snippet package "Create package configuration" b
|
||||
package ${1:body }${2:`!p snip.rv = fn.split('.')[0]`} is
|
||||
package ${1:body }${2:`!p package_name = fn.split('.')[0]
|
||||
snip.rv = package_name[0].upper() + package_name[1:]`} is
|
||||
$0
|
||||
end $2;
|
||||
endsnippet
|
||||
|
||||
@@ -10,6 +10,42 @@ snippet credhsrm "Credentials HSRM"
|
||||
Yannick Reiß <yannick.reiss@student.hs-rm.de>
|
||||
endsnippet
|
||||
|
||||
global !p
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
def get_datetime():
|
||||
now = datetime.now()
|
||||
now_as_list = [
|
||||
now.strftime("%d"),
|
||||
now.strftime("%m"),
|
||||
now.strftime("%Y"),
|
||||
now.strftime("%H"),
|
||||
now.strftime("%M")
|
||||
]
|
||||
return now_as_list
|
||||
|
||||
def complete(t, opts):
|
||||
if t:
|
||||
opts = [ m[len(t):] for m in opts if m.startswith(t) ]
|
||||
if len(opts) == 1:
|
||||
return opts[0]
|
||||
else:
|
||||
return "(" + '|'.join(opts) + ")"
|
||||
|
||||
endglobal
|
||||
|
||||
snippet mail "Template for a new delayed Mail" b
|
||||
time:${1:`!p snip.rv = get_datetime()[0]`}.${2:`!p snip.rv = get_datetime()[1]`}.${3:`!p snip.rv = get_datetime()[2]`} ${4:`!p snip.rv = get_datetime()[3]`}:${5:`!p snip.rv = get_datetime()[4]`}
|
||||
from:$6`!p snip.rv = complete(t[6], ['yannick.reiss@nickr.eu', 'schnick@nickr.eu'])`
|
||||
to:${7:schnick@nickr.eu}
|
||||
subject:${8:Subject}
|
||||
|
||||
${9:Message}
|
||||
|
||||
${10:`cat ~/.signature.txt`}
|
||||
endsnippet
|
||||
|
||||
snippet crednina "My true credentials"
|
||||
Nina Chloé Kassandra Reiß <nina.reiss@nickr.eu>
|
||||
endsnippet
|
||||
|
||||
37
UltiSnips/lean.snippets
Normal file
37
UltiSnips/lean.snippets
Normal file
@@ -0,0 +1,37 @@
|
||||
snippet ß "Backslash" A
|
||||
\\
|
||||
endsnippet
|
||||
|
||||
snippet <> "Add sharp brackets"
|
||||
⟨$1⟩$0
|
||||
endsnippet
|
||||
|
||||
snippet | "dvd"
|
||||
∣
|
||||
endsnippet
|
||||
|
||||
snippet () "Braces"
|
||||
($1)$0
|
||||
endsnippet
|
||||
|
||||
# Mengen
|
||||
snippet N "Natural number"
|
||||
ℕ
|
||||
endsnippet
|
||||
|
||||
snippet Z "Whole numbers"
|
||||
ℤ
|
||||
endsnippet
|
||||
|
||||
snippet R "Real"
|
||||
ℝ
|
||||
endsnippet
|
||||
|
||||
# Quantoren
|
||||
snippet E "Exists"
|
||||
∃
|
||||
endsnippet
|
||||
|
||||
snippet A "All"
|
||||
∀
|
||||
endsnippet
|
||||
@@ -52,3 +52,17 @@ endsnippet
|
||||
snippet ,m "Math equation" A
|
||||
\$$1\$ $0
|
||||
endsnippet
|
||||
|
||||
snippet bookshelf "Tagline for bookshelf" b
|
||||
`!p
|
||||
if t[1] != "":
|
||||
snip.rv = "[CW: "
|
||||
else:
|
||||
snip.rv = ""`$1`!p
|
||||
if t[1] != "":
|
||||
snip.rv = "]"
|
||||
else:
|
||||
snip.rv = ""`
|
||||
${2:Title} by ${3:Author}
|
||||
${4:Description}
|
||||
endsnippet
|
||||
|
||||
@@ -11,7 +11,7 @@ if __name__ == "__main__":
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet docmodule "Documentation for modules" A
|
||||
snippet docmodule "Documentation for modules"
|
||||
"""
|
||||
File: `!p snip.rv = fn`
|
||||
Author: ${1:Yannick Reiß}
|
||||
@@ -21,7 +21,7 @@ Description: ${2:No further description}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet def "Python Function" A
|
||||
snippet def "Python Function"
|
||||
def ${1:function}(${2}):
|
||||
"""
|
||||
@name $1
|
||||
@@ -35,12 +35,12 @@ for param in params:
|
||||
snip.rv += f"\t\t@param {param}\n"
|
||||
`
|
||||
Returns:
|
||||
$4
|
||||
@return $4
|
||||
"""
|
||||
$5
|
||||
`!p
|
||||
if t[4] != "":
|
||||
snip.rv = f"\n return {t[4]}"`
|
||||
if t[4] != "" and len(t[4].split(":")) > 1:
|
||||
snip.rv = f"return {t[4].split(':')[0]}"`
|
||||
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
@@ -61,3 +61,7 @@ snippet def "Definition/Constant" b
|
||||
\`define ${1:NAME} ${2:VALUE}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet filename "Get Filename" b
|
||||
// `pwd`/`!p snip.rv = fn`
|
||||
endsnippet
|
||||
|
||||
@@ -3,6 +3,41 @@ if vim == nil then
|
||||
local vim = {}
|
||||
end
|
||||
|
||||
-- @name Prove
|
||||
-- @param
|
||||
-- @short Run gnatprove
|
||||
function Prove()
|
||||
vim.cmd("new")
|
||||
local run_cmd = { "alr gnatprove" }
|
||||
vim.api.nvim_buf_set_lines(0, 0, -1, false, run_cmd)
|
||||
vim.cmd(":%!bash")
|
||||
|
||||
buffer_loaded = true
|
||||
end
|
||||
|
||||
-- @name Run
|
||||
-- @param
|
||||
-- @short Run program using alire
|
||||
function Run()
|
||||
vim.cmd("new")
|
||||
local run_cmd = { "alr run" }
|
||||
vim.api.nvim_buf_set_lines(0, 0, -1, false, run_cmd)
|
||||
vim.cmd(":%!bash")
|
||||
|
||||
buffer_loaded = true
|
||||
end
|
||||
|
||||
function Close_Prove()
|
||||
if buffer_loaded then
|
||||
buffer_loaded = false
|
||||
vim.cmd("bd!")
|
||||
end
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "pp", ":lua Close_Prove()<cr>")
|
||||
vim.keymap.set("n", "<leader>pp", ":lua Prove()<cr>")
|
||||
vim.keymap.set("n", "<leader>op", ":lua Run()<cr>")
|
||||
|
||||
-- @name setup_ada
|
||||
-- @param
|
||||
-- @short Verify installation of ada tools or install them.
|
||||
|
||||
@@ -12,9 +12,7 @@ local linters = {
|
||||
ada = { "gnat", "gcc", "adals", "cspell" },
|
||||
}
|
||||
|
||||
vim.g.ale_linters = linters
|
||||
vim.g.ale_fix_on_save = 0
|
||||
vim.g.ale_fixers = {
|
||||
local fixers = {
|
||||
ada = { "gnatpp" },
|
||||
asm = { "gcc" },
|
||||
bash = { "bashate" },
|
||||
@@ -28,5 +26,9 @@ vim.g.ale_fixers = {
|
||||
haskell = { "fourmolu" },
|
||||
}
|
||||
|
||||
vim.g.ale_linters = linters
|
||||
vim.g.ale_fix_on_save = 0
|
||||
vim.g.ale_fixers = fixers
|
||||
|
||||
vim.keymap.set("n", "<leader>lf", ":ALEFix<CR>")
|
||||
vim.keymap.set("n", "<leader>ld", ":ALEDetail<CR>")
|
||||
vim.keymap.set("n", "<leader>lp", ":ALEFindReferences<CR>")
|
||||
|
||||
@@ -15,38 +15,38 @@ require("mason-lspconfig").setup({
|
||||
},
|
||||
})
|
||||
|
||||
require("mason-lspconfig").setup_handlers({
|
||||
function(asm_lsp)
|
||||
require("lspconfig")[asm_lsp].setup({})
|
||||
end,
|
||||
function(clangd)
|
||||
require("lspconfig")[clangd].setup({})
|
||||
end,
|
||||
function(lua_ls)
|
||||
require("lspconfig")[lua_ls].setup({})
|
||||
end,
|
||||
function(hls)
|
||||
require("lspconfig")[hls].setup({})
|
||||
end,
|
||||
function(rust_analyzer)
|
||||
require("lspconfig")[rust_analyzer].setup({})
|
||||
end,
|
||||
function(vhdl_ls)
|
||||
require("lspconfig")[vhdl_ls].setup({})
|
||||
end,
|
||||
function(verible)
|
||||
require("lspconfig")[verible].setup({})
|
||||
end,
|
||||
function(vimls)
|
||||
require("lspconfig")[vimls].setup({})
|
||||
end,
|
||||
function(texlab)
|
||||
require("lspconfig")[texlab].setup({})
|
||||
end,
|
||||
function(als)
|
||||
require("lspconfig")[als].setup({})
|
||||
end,
|
||||
})
|
||||
-- require("mason-lspconfig").setup_handlers({
|
||||
-- function(asm_lsp)
|
||||
-- require("lspconfig")[asm_lsp].setup({})
|
||||
-- end,
|
||||
-- function(clangd)
|
||||
-- require("lspconfig")[clangd].setup({})
|
||||
-- end,
|
||||
-- function(lua_ls)
|
||||
-- require("lspconfig")[lua_ls].setup({})
|
||||
-- end,
|
||||
-- function(hls)
|
||||
-- require("lspconfig")[hls].setup({})
|
||||
-- end,
|
||||
-- function(rust_analyzer)
|
||||
-- require("lspconfig")[rust_analyzer].setup({})
|
||||
-- end,
|
||||
-- function(vhdl_ls)
|
||||
-- require("lspconfig")[vhdl_ls].setup({})
|
||||
-- end,
|
||||
-- function(verible)
|
||||
-- require("lspconfig")[verible].setup({})
|
||||
-- end,
|
||||
-- function(vimls)
|
||||
-- require("lspconfig")[vimls].setup({})
|
||||
-- end,
|
||||
-- function(texlab)
|
||||
-- require("lspconfig")[texlab].setup({})
|
||||
-- end,
|
||||
-- function(als)
|
||||
-- require("lspconfig")[als].setup({})
|
||||
-- end,
|
||||
-- })
|
||||
|
||||
require("lspconfig").verible.setup({
|
||||
cmd = { "verible-verilog-ls", "--rules_config_search" },
|
||||
|
||||
35
lua/mail.lua
35
lua/mail.lua
@@ -1,35 +0,0 @@
|
||||
vim.g.iris_name = "Nina Chloé Kassandra Reiß"
|
||||
vim.g.iris_mail = "nina.reiss@nickr.eu"
|
||||
|
||||
local cmd = io.popen("whoami")
|
||||
local get_lua_configuration_directory
|
||||
|
||||
if cmd == nil then
|
||||
get_lua_configuration_directory = "root"
|
||||
else
|
||||
get_lua_configuration_directory = cmd:read("*a")
|
||||
cmd:close()
|
||||
end
|
||||
|
||||
local directory_path
|
||||
if get_lua_configuration_directory == "root" then
|
||||
directory_path = "/root/.config/nvim"
|
||||
else
|
||||
directory_path = "/home/" .. get_lua_configuration_directory .. "/.config/nvim"
|
||||
end
|
||||
|
||||
vim.g.iris_imap_host = "mail.nickr.eu"
|
||||
vim.g.iris_imap_port = 143
|
||||
vim.g.iris_imap_login = "yannick.reiss@nickr.eu"
|
||||
vim.g.iris_imap_passwd_filepath = directory_path .. "mail_password.gpg"
|
||||
|
||||
vim.g.iris_smtp_host = "smtp.nickr.eu"
|
||||
vim.g.iris_smtp_port = 587
|
||||
vim.g.iris_smtp_login = "yannick.reiss@nickr.eu"
|
||||
vim.g.iris_smtp_passwd_filepath = directory_path .. "mail_password.gpg"
|
||||
|
||||
-- specify mail configuration
|
||||
vim.g.iris_idle_enabled = 0
|
||||
vim.g.iris_idle_timeout = 300
|
||||
vim.g.iris_emails_chunk_size = 25
|
||||
vim.g.iris_download_dir = "~/Downloads"
|
||||
@@ -25,11 +25,10 @@ require("pascal_mode")
|
||||
-- Ada mode (supported by plugins)
|
||||
require("ada_mode")
|
||||
|
||||
-- Mail configuration
|
||||
-- require("mail")
|
||||
|
||||
-- IRC configuration
|
||||
require("irc_client")
|
||||
-- Markdown Preview
|
||||
vim.g.mkdp_auto_start = 0
|
||||
vim.g.mkdp_browser = "epiphany"
|
||||
vim.g.mkdp_echo_preview_url = 1
|
||||
|
||||
-- Misc configuration
|
||||
if vim == nil then
|
||||
@@ -38,7 +37,7 @@ end
|
||||
|
||||
-- Update function and call
|
||||
function Update_Sys()
|
||||
vim.cmd("TSUpdate")
|
||||
--vim.cmd("TSUpdate")
|
||||
vim.cmd("MasonUpdate")
|
||||
vim.cmd("Lazy sync")
|
||||
end
|
||||
@@ -56,9 +55,6 @@ vim.g.gitblame_date_format = "%r"
|
||||
-- Floating terminal
|
||||
vim.keymap.set("n", "<C-t>", ":FloatermNew --height=0.9 --width=0.9 --wintype=float --name=terminal <CR>")
|
||||
|
||||
-- Key plugin
|
||||
require("screenkeyconfig")
|
||||
|
||||
-- Set default colorscheme
|
||||
-- vim.cmd("colo vim-monokai-tasty")
|
||||
vim.cmd("colo vim-monokai-tasty")
|
||||
|
||||
@@ -57,14 +57,27 @@ return {
|
||||
"dense-analysis/ale",
|
||||
"f-person/git-blame.nvim",
|
||||
"dstein64/vim-startuptime",
|
||||
"NStefan002/screenkey.nvim",
|
||||
"hiphish/rainbow-delimiters.nvim",
|
||||
{
|
||||
"iamcco/markdown-preview.nvim",
|
||||
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
|
||||
build = "cd app && npm install",
|
||||
init = function()
|
||||
vim.g.mkdp_filetypes = { "markdown" }
|
||||
end,
|
||||
ft = { "markdown" },
|
||||
},
|
||||
|
||||
-- Themes
|
||||
"folke/tokyonight.nvim",
|
||||
"patstockwell/vim-monokai-tasty",
|
||||
"hiroakis/cyberspace.vim",
|
||||
"jaredgorski/spacecamp",
|
||||
{
|
||||
"scottmckendry/cyberdream.nvim",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
},
|
||||
|
||||
-- Code completion / Menu
|
||||
"hrsh7th/nvim-cmp",
|
||||
@@ -93,7 +106,49 @@ return {
|
||||
-- Plugins to test
|
||||
"https://git.nickr.eu/yannickreiss/nvim-macrotool.git",
|
||||
|
||||
-- Message clients and office setup
|
||||
"soywod/iris.vim",
|
||||
{ "shadmansaleh/IRC.nvim", rocks = "openssl" },
|
||||
-- Wiki
|
||||
{
|
||||
"echaya/neowiki.nvim",
|
||||
opts = {
|
||||
wiki_dirs = {
|
||||
-- neowiki.nvim supports both absolute and relative paths
|
||||
{ name = "Personal", path = "~/.wiki" },
|
||||
{ name = "RiscVar", path = "~/Documents/HSRM/riscvar.wiki" },
|
||||
{ name = "Ada/Spark", path = "~/Documents/Science/ada_spark_wiki" },
|
||||
{ name = "FPGA Book", path = "~/Documents/Science/FPGA_Design" },
|
||||
{ name = "Spark-Shell", path = "~/Documents/Programming/spark/spark_shell/spark_shell.wiki" },
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>ww", "<cmd>lua require('neowiki').open_wiki()<cr>", desc = "Open Wiki" },
|
||||
{ "<leader>wW", "<cmd>lua require('neowiki').open_wiki_floating()<cr>", desc = "Open Floating Wiki" },
|
||||
{ "<leader>wT", "<cmd>lua require('neowiki').open_wiki_new_tab()<cr>", desc = "Open Wiki in Tab" },
|
||||
},
|
||||
},
|
||||
|
||||
-- Lean
|
||||
{
|
||||
"Julian/lean.nvim",
|
||||
event = { "BufReadPre *.lean", "BufNewFile *.lean" },
|
||||
|
||||
dependencies = {
|
||||
"neovim/nvim-lspconfig",
|
||||
"nvim-lua/plenary.nvim",
|
||||
|
||||
-- optional dependencies:
|
||||
|
||||
-- a completion engine
|
||||
-- hrsh7th/nvim-cmp or Saghen/blink.cmp are popular choices
|
||||
|
||||
-- 'nvim-telescope/telescope.nvim', -- for 2 Lean-specific pickers
|
||||
-- 'andymass/vim-matchup', -- for enhanced % motion behavior
|
||||
-- 'andrewradev/switch.vim', -- for switch support
|
||||
-- 'tomtom/tcomment_vim', -- for commenting
|
||||
},
|
||||
|
||||
---@type lean.Config
|
||||
opts = { -- see below for full configuration options
|
||||
mappings = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
require("screenkey").setup({
|
||||
win_opts = {
|
||||
row = vim.o.lines - vim.o.cmdheight - 1,
|
||||
col = vim.o.columns - 1,
|
||||
relative = "editor",
|
||||
anchor = "SE",
|
||||
width = 40,
|
||||
height = 3,
|
||||
border = "single",
|
||||
title = "Screenkey",
|
||||
title_pos = "center",
|
||||
style = "minimal",
|
||||
focusable = false,
|
||||
noautocmd = true,
|
||||
},
|
||||
compress_after = 3,
|
||||
clear_after = 3,
|
||||
disable = {
|
||||
filetypes = {},
|
||||
buftypes = {},
|
||||
events = false,
|
||||
},
|
||||
show_leader = true,
|
||||
group_mappings = false,
|
||||
display_infront = {},
|
||||
display_behind = {},
|
||||
filter = function(keys)
|
||||
return keys
|
||||
end,
|
||||
keys = {
|
||||
["<TAB>"] = "",
|
||||
["<CR>"] = "",
|
||||
["<ESC>"] = "Esc",
|
||||
["<SPACE>"] = "␣",
|
||||
["<BS>"] = "",
|
||||
["<DEL>"] = "Del",
|
||||
["<LEFT>"] = "",
|
||||
["<RIGHT>"] = "",
|
||||
["<UP>"] = "",
|
||||
["<DOWN>"] = "",
|
||||
["<HOME>"] = "Home",
|
||||
["<END>"] = "End",
|
||||
["<PAGEUP>"] = "PgUp",
|
||||
["<PAGEDOWN>"] = "PgDn",
|
||||
["<INSERT>"] = "Ins",
|
||||
["<F1>"] = "",
|
||||
["<F2>"] = "",
|
||||
["<F3>"] = "",
|
||||
["<F4>"] = "",
|
||||
["<F5>"] = "",
|
||||
["<F6>"] = "",
|
||||
["<F7>"] = "",
|
||||
["<F8>"] = "",
|
||||
["<F9>"] = "",
|
||||
["<F10>"] = "",
|
||||
["<F11>"] = "",
|
||||
["<F12>"] = "",
|
||||
["CTRL"] = "Ctrl",
|
||||
["ALT"] = "Alt",
|
||||
["SUPER"] = "",
|
||||
["<leader>"] = "<leader>",
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<leader>kk", ":Screenkey<CR>")
|
||||
@@ -16,7 +16,7 @@ vim.opt.shiftwidth = 4
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.splitright = true
|
||||
vim.opt.splitbelow = true
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.relativenumber = false
|
||||
vim.g.mapleader = ","
|
||||
vim.cmd("set clipboard+=unnamedplus")
|
||||
vim.cmd("autocmd! CursorHold,CursorHoldI *.md write")
|
||||
@@ -29,7 +29,6 @@ vim.opt.encoding = "UTF-8"
|
||||
vim.g.tex_flavor = "latex"
|
||||
vim.opt.conceallevel = 2
|
||||
vim.opt.showmatch = true
|
||||
vim.o.guifont = "Source Code Pro:h13"
|
||||
|
||||
-- set color scheme
|
||||
vim.opt.termguicolors = true
|
||||
@@ -46,3 +45,61 @@ vim.keymap.set("n", "<leader>lm", ":set number<cr>")
|
||||
-- switch mode
|
||||
vim.keymap.set("n", "<leader>na", ":set norelativenumber<cr>")
|
||||
vim.keymap.set("n", "<leader>nr", ":set relativenumber<cr>")
|
||||
|
||||
-- Nix mode
|
||||
local nix_interpreter_buffer = -1
|
||||
local nix_interpreter_window = -1
|
||||
|
||||
-- @name run_nix_interpreter
|
||||
-- @param
|
||||
-- @short Run nix and output to a buffer on the right
|
||||
local function run_nix_interpreter()
|
||||
local original_win = vim.api.nvim_get_current_win()
|
||||
vim.cmd("vsplit")
|
||||
nix_interpreter_buffer = vim.api.nvim_create_buf(false, true)
|
||||
vim.api.nvim_win_set_buf(0, nix_interpreter_buffer)
|
||||
nix_interpreter_window = vim.api.nvim_get_current_win()
|
||||
vim.api.nvim_set_current_win(original_win)
|
||||
end
|
||||
|
||||
-- @name update_nix_interpreter
|
||||
-- @param
|
||||
-- @short Run nix enterpreter on that file.
|
||||
local function update_nix_interpreter()
|
||||
local filename = vim.api.nvim_buf_get_name(0)
|
||||
if filename == "" then
|
||||
vim.api.nvim_buf_set_lines(nix_interpreter_buffer, 0, -1, false, {
|
||||
"Error: Current buffer has no file name.",
|
||||
})
|
||||
return
|
||||
end
|
||||
local cmd = { "nix-instantiate", "--eval", "--strict", filename }
|
||||
local output = vim.fn.systemlist(cmd)
|
||||
if vim.v.shell_error ~= 0 then
|
||||
table.insert(output, 1, "Error running nix-instantiate:")
|
||||
end
|
||||
vim.api.nvim_buf_set_lines(nix_interpreter_buffer, 0, -1, false, output)
|
||||
end
|
||||
|
||||
-- @name close_nix_interpreter
|
||||
-- @param
|
||||
-- @short Closes the window and buffer of the interpreter
|
||||
local function close_nix_interpreter()
|
||||
vim.api.nvim_buf_delete(nix_interpreter_buffer, { unload = true })
|
||||
vim.api.nvim_win_close(nix_interpreter_window, true)
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufEnter" }, {
|
||||
pattern = { "*.nix" },
|
||||
callback = run_nix_interpreter,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||
pattern = { "*.nix" },
|
||||
callback = update_nix_interpreter,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufLeave" }, {
|
||||
pattern = { "*.nix" },
|
||||
callback = close_nix_interpreter,
|
||||
})
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
-----BEGIN PGP MESSAGE-----
|
||||
|
||||
hF4D7SdwCs0TtR8SAQdAnK7+vhdEeHAQMkTbfuC9F4DuPtbNff2CGXMcFuv1k3Yw
|
||||
Tj/wXDP1IV5mJdGVCH3PAbZme+UX4jybW934fIo8je109OIyAPra4bn75S1A4klb
|
||||
1MDjAQkCEBd5WJKvyyF8NwmavnF7JMHOl9pzuo26BwakfmWhJaTH3Wt5YDkk94C8
|
||||
ebqCJB7ER2Yqbos2/Ln8h2f7E20qKaWe2oWklJZTnSGiwcs0CKs3rgRkOP84glP+
|
||||
+SH/L5Epu6APawedrW+Sm2o7HZF0/reZMFB10gqDSMW19VuzRhmPDejldco37ME5
|
||||
cd9WVeRNXv7LlSjU1JIcgm6M5FFNsDBFw1Gz4RGic3flN4yulWQx5GgPWU1ePpml
|
||||
+AUzZGSpgmWB6pMvZrlf+HaQMc3zUoNRdSyB78SiCJcl+9iDpprCMxsgi43DFB6p
|
||||
ipjQxvXOKT3kko2DW8gcr03VDMQ9P3Pz7E/GSzUlsaOkOCL+/xed+y23IYuOVlt6
|
||||
cHRhrY7nSPpTLuaP/gABJPQLLrUnldSf6LK6hp66SLn5igMfklL6zvDNVPzkz+wT
|
||||
B6nyxD2sEuj/KklhsR3YESJK9QhySq3llgMhOM7m9cFt0+X/rOgROvpwkVApVpDS
|
||||
ymjfPtZo56XvHO+uv8vdt8nk06NySTcfXorTOGgxYlKRmX9OMRU=
|
||||
=pKVC
|
||||
-----END PGP MESSAGE-----
|
||||
Reference in New Issue
Block a user