From a83cb055c3b0360fdf48a56099c4c039b26b5a07 Mon Sep 17 00:00:00 2001 From: Sakooooo <78461130+Sakooooo@users.noreply.github.com> Date: Thu, 10 Aug 2023 18:22:34 +0300 Subject: [PATCH] add neovim start --- config/nvim/init.lua | 2 +- config/nvim/lua/core/plugin_config/init.lua | 1 + config/nvim/lua/core/plugin_config/start.lua | 1 + config/nvim/lua/core/start.lua | 219 +++++++++++++++++++ 4 files changed, 222 insertions(+), 1 deletion(-) create mode 100644 config/nvim/lua/core/plugin_config/start.lua create mode 100644 config/nvim/lua/core/start.lua diff --git a/config/nvim/init.lua b/config/nvim/init.lua index 7e4750f6..36ac2552 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -1,4 +1,4 @@ require("core.keymaps") require("core.plugins") require("core.plugin_config") - +require("core.start") diff --git a/config/nvim/lua/core/plugin_config/init.lua b/config/nvim/lua/core/plugin_config/init.lua index eb35f111..f491ad5b 100644 --- a/config/nvim/lua/core/plugin_config/init.lua +++ b/config/nvim/lua/core/plugin_config/init.lua @@ -11,3 +11,4 @@ require("core.plugin_config.null_ls") require("core.plugin_config.colorscheme") require("core.plugin_config.liveserver") require("core.plugin_config.color-picker") +require("core.plugin_config.start") diff --git a/config/nvim/lua/core/plugin_config/start.lua b/config/nvim/lua/core/plugin_config/start.lua new file mode 100644 index 00000000..1d431fe7 --- /dev/null +++ b/config/nvim/lua/core/plugin_config/start.lua @@ -0,0 +1 @@ +require'start'.set_background_ascii(require'start'.added_neovim_1) diff --git a/config/nvim/lua/core/start.lua b/config/nvim/lua/core/start.lua new file mode 100644 index 00000000..9a305f3f --- /dev/null +++ b/config/nvim/lua/core/start.lua @@ -0,0 +1,219 @@ +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