Compare commits
2 Commits
085ff836c3
...
7452ee9b06
Author | SHA1 | Date |
---|---|---|
|
7452ee9b06 | |
|
d2c68f99ab |
|
@ -0,0 +1,41 @@
|
||||||
|
-- Lua vim-dummy variable
|
||||||
|
if vim == nil then
|
||||||
|
local vim = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
-- @name setup_pascal
|
||||||
|
-- @param
|
||||||
|
-- @short Verify installation of pascal tools or install them.
|
||||||
|
local function setup_pascal()
|
||||||
|
local check_ptop = { os.execute("which ptop") }
|
||||||
|
vim.cmd("set autoread")
|
||||||
|
|
||||||
|
-- if return value is 1, get ptop
|
||||||
|
if check_ptop == 1 then
|
||||||
|
os.execute("wget -o ~/.local/bin/ptop https://www.nickr.eu/data/ptop64")
|
||||||
|
os.execute("chmod +x ~/.local/bin/ptop")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Setup and verify pascal tools when opening a pascal file
|
||||||
|
vim.api.nvim_create_autocmd({ "BufEnter" }, {
|
||||||
|
pattern = { "*.pas" },
|
||||||
|
callback = setup_pascal,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- @name auto_format
|
||||||
|
-- @param
|
||||||
|
-- @short The format function for pascal.
|
||||||
|
local function auto_format()
|
||||||
|
local write_cmd = "ptop -c ~/.config/nvim/ptop.conf "
|
||||||
|
.. vim.api.nvim_buf_get_name(0)
|
||||||
|
.. " "
|
||||||
|
.. vim.api.nvim_buf_get_name(0)
|
||||||
|
os.execute(write_cmd)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Add formatter command
|
||||||
|
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||||
|
pattern = { "*.pas" },
|
||||||
|
callback = auto_format,
|
||||||
|
})
|
|
@ -16,6 +16,9 @@ require("navigation")
|
||||||
-- Mason and builtin lsp configuration
|
-- Mason and builtin lsp configuration
|
||||||
require("lspconfiguration")
|
require("lspconfiguration")
|
||||||
|
|
||||||
|
-- Pascal mode (supported by plugins)
|
||||||
|
require("pascal_mode")
|
||||||
|
|
||||||
-- Misc configuration
|
-- Misc configuration
|
||||||
if vim == nil then
|
if vim == nil then
|
||||||
vim = {}
|
vim = {}
|
||||||
|
|
Loading…
Reference in New Issue