nixos/config/nvim/lua/core/start.lua
2023-08-10 18:22:34 +03:00

219 lines
7.7 KiB
Lua

local api = vim.api
local M = {}
local function string_to_lines_table(ascii)
local lines = {}
local line_start = 1
for i = 1, #ascii do
if string.sub(ascii, i, i) == '\n' then
local this_line = string.sub(ascii, line_start, i - 1)
line_start = i + 1
table.insert(lines, this_line)
end
end
return lines
end
M['added_neovim_1'] = [[
.__ __. _______ ______ ____ ____ __ .___ ___.
| \ | | | ____| / __ \ \ \ / / | | | \/ |
| \| | | |__ | | | | \ \/ / | | | \ / |
| . ` | | __| | | | | \ / | | | |\/| |
| |\ | | |____ | `--' | \ / | | | | | |
|__| \__| |_______| \______/ \__/ |__| |__| |__|
]]
M['default_ascii_1'] = [[
_ _ __ _______ __ __
| \ | | \ \ / /_ _| \/ |
| \| | ___ __\ \ / / | | | \ / |
| . ` |/ _ \/ _ \ \/ / | | | |\/| |
| |\ | __/ (_) \ / _| |_| | | |
|_| \_|\___|\___/ \/ |_____|_| |_|
]]
M['default_ascii_2'] = [[
/‾| /‾/__ ____|‾| /‾(_)___ ___
/ |/ / _ \/ __ \ | / / / __ `__ \
/ /| / __/ /_/ / |/ / / / / / / /
/_/ |_/\___/\____/|___/_/_/ /_/ /_/
]]
M['neovim_is_awesome'] = [[
_ _ _ _ ___
| \ | | (_) (_) / _ \
| \| | ___ _____ ___ _ __ ___ _ ___ / /_\ \_ _____ ___ ___ _ __ ___ ___
| . ` |/ _ \/ _ \ \ / / | '_ ` _ \ | / __| | _ \ \ /\ / / _ \/ __|/ _ \| '_ ` _ \ / _ \
| |\ | __/ (_) \ V /| | | | | | | | \__ \ | | | |\ V V / __/\__ \ (_) | | | | | | __/
\_| \_/\___|\___/ \_/ |_|_| |_| |_| |_|___/ \_| |_/ \_/\_/ \___||___/\___/|_| |_| |_|\___|
]]
M['neovim_wetletter'] = [[
.-. .-.,---. .---..-. .-.,-.
| \| || .-' / .-. )\ \ / / |(||\ /|
| | || `-. | | |(_)\ V / (_)|(\ / |
| |\ || .-' | | | | ) / | |(_)\/ |
| | |)|| `--.\ `-' / (_) | || \ / |
/( (_)/( __.' )---' `-'| |\/| |
(__) (__) (_) '-' '-'
]]
M['neovim_varsity'] = [[ ____ _____ _
|_ \|_ _| (_)
| \ | | .---. .--. _ __ __ _ .--..--.
| |\ \| | / /__\\/ .'`\ \[ \ [ ][ | [ `.-. .-. |
_| |_\ |_| \__.,| \__. | \ \/ / | | | | | | | |
|_____|\____|'.__.' '.__.' \__/ [___][___||__||__]
]]
M['neovim_twisted'] = [[
__ __ _____ _____ _ _ __ __ __
/_/\ /\_\ /\_____\ ) ___ ( /_/\ /\_\ /\_\ /_/\ /\_\
) ) \ ( (( (_____// /\_/\ \ ) ) ) ( ( \/_/ ) ) \/ ( (
/_/ \ \_\\ \__\ / /_/ (_\ \/_/ / \ \_\ /\_\/_/ \ / \_\
\ \ \ / // /__/_\ \ )_/ / /\ \ \_/ / // / /\ \ \\// / /
)_) \ (_(( (_____\\ \/_\/ / \ \ / /( (_( )_) )( (_(
\_\/ \/_/ \/_____/ )_____( \_\_/_/ \/_/ \_\/ \/_/
]]
M['neovim_this'] = [[
▄▀▀▄ ▀▄ ▄▀▀█▄▄▄▄ ▄▀▀▀▀▄ ▄▀▀▄ ▄▀▀▄ ▄▀▀█▀▄ ▄▀▀▄ ▄▀▄
█ █ █ █ ▐ ▄▀ ▐ █ █ █ █ █ █ █ █ █ █ ▀ █
▐ █ ▀█ █▄▄▄▄▄ █ █ ▐ █ █ ▐ █ ▐ ▐ █ █
█ █ █ ▌ ▀▄ ▄▀ █ ▄▀ █ █ █
▄▀ █ ▄▀▄▄▄▄ ▀▀▀▀ ▀▄▀ ▄▀▀▀▀▀▄ ▄▀ ▄▀
█ ▐ █ ▐ █ █ █ █
▐ ▐ ▐ ▐ ▐ ▐
]]
M['neovim_sweet'] = [[
.-.
___ .-. .--. .--. ___ ___ ( __) ___ .-. .-.
( ) \ / \ / \ ( )( ) (''") ( ) ' \
| .-. . | .-. ; | .-. ; | | | | | | | .-. .-. ;
| | | | | | | | | | | | | | | | | | | | | | | |
| | | | | |/ | | | | | | | | | | | | | | | | |
| | | | | ' _.' | | | | | | | | | | | | | | | |
| | | | | .'.-. | ' | | ' ' ; ' | | | | | | | |
| | | | ' `-' / ' `-' / \ `' / | | | | | | | |
(___)(___) `.__.' `.__.' '_.' (___) (___)(___)(___)
]]
M['neovim_swampland'] = [[
___ __ ______ ______ __ __ ________ ___ __ __
/__/\ /__/\ /_____/\ /_____/\ /_/\ /_/\ /_______/\/__//_//_/\
\::\_\\ \ \\::::_\/_\:::_ \ \\:\ \\ \ \\__.::._\/\::\| \| \ \
\:. `-\ \ \\:\/___/\\:\ \ \ \\:\ \\ \ \ \::\ \ \:. \ \
\:. _ \ \\::___\/_\:\ \ \ \\:\_/.:\ \ _\::\ \__\:.\-/\ \ \
\. \`-\ \ \\:\____/\\:\_\ \ \\ ..::/ //__\::\__/\\. \ \ \ \
\__\/ \__\/ \_____\/ \_____\/ \___/_( \________\/ \__\/ \__\/
]]
M['neovim_srelif'] = [[
__/\\\\\_____/\\\______________________________________________________________________
_\/\\\\\\___\/\\\______________________________________________________________________
_\/\\\/\\\__\/\\\_____________________________________________/\\\_____________________
_\/\\\//\\\_\/\\\_____/\\\\\\\\______/\\\\\_____/\\\____/\\\_\///_____/\\\\\__/\\\\\___
_\/\\\\//\\\\/\\\___/\\\/////\\\___/\\\///\\\__\//\\\__/\\\___/\\\__/\\\///\\\\\///\\\_
_\/\\\_\//\\\/\\\__/\\\\\\\\\\\___/\\\__\//\\\__\//\\\/\\\___\/\\\_\/\\\_\//\\\__\/\\\_
_\/\\\__\//\\\\\\_\//\\///////___\//\\\__/\\\____\//\\\\\____\/\\\_\/\\\__\/\\\__\/\\\_
_\/\\\___\//\\\\\__\//\\\\\\\\\\__\///\\\\\/______\//\\\_____\/\\\_\/\\\__\/\\\__\/\\\_
_\///_____\/////____\//////////_____\/////_________\///______\///__\///___\///___\///__
]]
M['neovim_poison'] = [[
@@@ @@@ @@@@@@@@ @@@@@@ @@@ @@@ @@@ @@@@@@@@@@
@@@@ @@@ @@@@@@@@ @@@@@@@@ @@@ @@@ @@@ @@@@@@@@@@@
@@!@!@@@ @@! @@! @@@ @@! @@@ @@! @@! @@! @@!
!@!!@!@! !@! !@! @!@ !@! @!@ !@! !@! !@! !@!
@!@ !!@! @!!!:! @!@ !@! @!@ !@! !!@ @!! !!@ @!@
!@! !!! !!!!!: !@! !!! !@! !!! !!! !@! ! !@!
!!: !!! !!: !!: !!! :!: !!: !!: !!: !!:
:!: !:! :!: :!: !:! ::!!:! :!: :!: :!:
:: :: :: :::: ::::: :: :::: :: ::: ::
:: : : :: :: : : : : : : :
]]
M['neovim_serifcap'] = [[
_ _ ___ __ _ _ __ __ __
( \( )( _) / \( )( )( )( \/ )
) ( ) _)( () )\\// )( ) (
(_)\_)(___) \__/ (__) (__)(_/\/\_)
]]
M['neovim_sblood'] = [[
@@@ @@@ @@@@@@@@ @@@@@@ @@@ @@@ @@@ @@@@@@@@@@
@@!@!@@@ @@! @@! @@@ @@! @@@ @@! @@! @@! @@!
@!@@!!@! @!!!:! @!@ !@! @!@ !@! !!@ @!! !!@ @!@
!!: !!! !!: !!: !!! !: .:! !!: !!: !!:
:: : : :: ::: : :. : :: : : :
]]
M['neovim_script'] = [[
, _
/|/ \ o
| | _ __ _ _ _
| | |/ / \_| |_| / |/ |/ |
| |_/|__/\__/ \/ |_/ | | |_/
]]
M['location'] = {
center = function(width, height, ascii_col, ascii_lines)
local h = math.floor((height / 2) - (ascii_lines / 2))
local w = math.floor((width / 2) - (ascii_col / 2))
return w, h
end
}
local function str_repeat(str, number)
local s = ""
for _ = 1, number do
s = s .. str
end
return s
end
M['set_background_ascii'] = function(ascii)
local height = vim.api.nvim_get_option('lines')
local width = vim.api.nvim_get_option('columns')
local lines = string_to_lines_table(ascii)
local ascii_col = #lines[1]
local ascii_lines = #lines
local start_col, start_row = M.location.center(width, height, ascii_col, ascii_lines)
if vim.fn.argc() < 1 then
local buf = vim.api.nvim_create_buf(true, true)
for i, _ in ipairs(lines) do
lines[i] = (str_repeat(' ', start_col)) .. (lines[i])
end
local new_lines = {}
for _ = 1, start_row do
table.insert(new_lines, '')
end
for _, l in ipairs(lines) do
table.insert(new_lines, l)
end
vim.api.nvim_buf_set_lines(buf, 0, -1, false, new_lines)
vim.api.nvim_buf_set_option(buf, 'modifiable', false)
vim.api.nvim_buf_set_option(buf, 'buflisted', false)
local win = api.nvim_get_current_win()
api.nvim_set_current_buf(buf)
end
end
return M