From 4f8cffc9663dffc687c1207ec55690df23b81846 Mon Sep 17 00:00:00 2001 From: doyle Date: Sun, 25 Sep 2022 23:41:31 +1000 Subject: [PATCH] nvim stuff --- Installer/os_nvim_init.vim | 79 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/Installer/os_nvim_init.vim b/Installer/os_nvim_init.vim index 1e34f66..77cfd92 100644 --- a/Installer/os_nvim_init.vim +++ b/Installer/os_nvim_init.vim @@ -99,6 +99,85 @@ lua < to open the file tree explorer", + " clang format selected lines", + " jump to next compilation error", + " jump to prev compilation error", + " change working directory to current file", + " <\\s> split buffer vertically", + " ", + " Telescope Bindings (Normal Mode)", + " --------------------------------------------------", + " <\\te> open telescope menu", + " <\\ta> search for symbol via tags", + " <\\f> search for file", + " <\\g> search for text", + " <\\b> search for buffer", + " <\\h> search VIM help menu", + " ", + " LSP Bindings (Normal Mode)", + " --------------------------------------------------", + " on (applicable) symbol, jump to declaration", + " on (applicable) symbol, jump to definition", + " on (applicable) symbol, jump to type definition", + " on (applicable) symbol, show caller references", + " on (applicable) symbol, search available symbols", + " on (applicable) symbol, show code-actions prompt", + " on (applicable) symbol, code-aware symbol rename", + " on (applicable) symbol, show signature help", + " on (applicable) symbol, show documentation", + " on red underlined symbol error, show error message", + " jump to next LSP error", + " jump to prev LSP error", + } + + local height = vim.api.nvim_get_option("lines") + local width = vim.api.nvim_get_option("columns") + local ascii_rows = #ascii + local ascii_cols = #ascii[1] + local win = vim.api.nvim_get_current_win() + local buf = vim.api.nvim_create_buf(true, true) + + local function reset_start_screen() + vim.cmd("enew") + local buf = vim.api.nvim_get_current_buf() + local win = vim.api.nvim_get_current_win() + vim.api.nvim_buf_set_option(buf, "modifiable", true) + vim.api.nvim_buf_set_option(buf, "buflisted", true) + vim.api.nvim_buf_set_option(buf, "buflisted", true) + vim.api.nvim_win_set_option(win, "colorcolumn", "80,100") + vim.api.nvim_win_set_option(win, "relativenumber", true) + vim.api.nvim_win_set_option(win, "number", true) + vim.api.nvim_win_set_option(win, "list", true) + end + + -- Only display if there is enough space + if height >= ascii_rows and width >= ascii_cols then + vim.api.nvim_buf_set_lines(buf, 0, -1, false, ascii) + vim.api.nvim_buf_set_option(buf, "modified", false) + vim.api.nvim_buf_set_option(buf, "buflisted", false) + vim.api.nvim_buf_set_option(buf, "bufhidden", "wipe") + vim.api.nvim_buf_set_option(buf, "buftype", "nofile") + vim.api.nvim_buf_set_option(buf, "swapfile", false) + vim.api.nvim_win_set_option(win, "colorcolumn", "") + vim.api.nvim_win_set_option(win, "relativenumber", false) + vim.api.nvim_win_set_option(win, "number", false) + vim.api.nvim_win_set_option(win, "list", false) + vim.api.nvim_set_current_buf(buf) + + vim.api.nvim_create_autocmd("InsertEnter,WinEnter", { + pattern = "", + callback = reset_start_screen, + }) + end + end + -- LSP Setup -- =========================================================================== -- Load the additional capabilities supported by nvim-cmp