diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua index d9ea6db..e9e778f 100755 --- a/lua/config/autocmds.lua +++ b/lua/config/autocmds.lua @@ -1,3 +1,16 @@ -- Autocmds are automatically loaded on the VeryLazy event -- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua -- Add any additional autocmds here + +vim.api.nvim_create_autocmd("UIEnter", { + group = vim.api.nvim_create_augroup("SetGUISettings", { clear = true }), + callback = function() + -- Options specifically targeted at Neovide + if vim.g.neovide then + vim.o.guifont = "CaskaydiaCove Nerd Font Mono:h14" + vim.g.neovide_hide_mouse_when_typing = true + vim.g.neovide_cursor_animation_length = 0 + vim.g.neovide_cursor_trail_length = 0 + end + end, +}) diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua index 5e9025d..c1ab106 100755 --- a/lua/config/keymaps.lua +++ b/lua/config/keymaps.lua @@ -1,3 +1,58 @@ -- Keymaps are automatically loaded on the VeryLazy event -- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua -- Add any additional keymaps here + +-- Diagnostic keymaps +vim.keymap.del("n", "") +vim.keymap.del("n", "d") +vim.keymap.set("n", "e", vim.diagnostic.open_float, { desc = "Show diagnostic [E]rror messages" }) +vim.keymap.del("n", "qq") +vim.keymap.set("n", "q", vim.diagnostic.setqflist, { desc = "Open diagnostic [Q]uickfix list" }) + +-- Open terminal in current window +vim.keymap.del("n", "") +vim.keymap.del("n", "ft") +vim.keymap.del("n", "fT") +vim.keymap.set({ "n", "v" }, "to", "term", { desc = "[T]erminal [O]pen" }) + +-- Disable arrow keys in normal mode +vim.keymap.set({ "n", "v" }, "", 'echo "Use h to move!!"') +vim.keymap.set({ "n", "v" }, "", 'echo "Use l to move!!"') +vim.keymap.set({ "n", "v" }, "", 'echo "Use k to move!!"') +vim.keymap.set({ "n", "v" }, "", 'echo "Use j to move!!"') + +vim.keymap.del("n", "cd") +-- Populate CMD to prepare for change directory +vim.keymap.set("n", "cd ", ":cd ", { desc = "Prepare CMD for [C]hange [D]irectory" }) +-- Navigate to 'base' directory, the initial dir that nvim was run in +vim.keymap.set( + "n", + "cdb", + "cd " .. vim.g.base_dir .. "", + { desc = "[C]hange [D]irectory to [B]ase directory" } +) +-- Navigate to 'user home' directory +vim.keymap.set("n", "cdh", "cd " .. vim.env.HOME .. "", { desc = "[C]hange [D]irectory to [H]ome" }) +-- Automatically navigate to config directory +vim.keymap.set( + "n", + "cdn", + "cd " .. vim.fn.stdpath("config") .. "", + { desc = "[C]hange [D]irectory to [N]eovim" } +) + +-- Resizing windows +vim.keymap.set({ "n", "v" }, "", "<") +vim.keymap.set({ "n", "v" }, "", ">") +vim.keymap.set({ "n", "v" }, "", "+") +vim.keymap.set({ "n", "v" }, "", "-") + +if vim.g.neovide then + -- System clipboard keybinds in normal and visual mode + vim.keymap.set({ "n", "v" }, "", '"+y', { desc = "Yank to System clipboard" }) + vim.keymap.set({ "n", "v" }, "", '"+p', { desc = "Paste from System clipboard" }) + -- Clipboard for command and insert mode + vim.keymap.set({ "c", "i" }, "", "+", { desc = "Paste from System clipboard" }) + -- Clipboard for terminal mode + vim.keymap.set({ "t" }, "", '"+pi', { desc = "Paste from System clipboard" }) +end diff --git a/lua/config/options.lua b/lua/config/options.lua index 415944a..f359bb9 100755 --- a/lua/config/options.lua +++ b/lua/config/options.lua @@ -1,3 +1,41 @@ -- Options are automatically loaded before lazy.nvim startup -- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua -- Add any additional options here + +vim.g.mapleader = " " +vim.g.maplocalleader = " " + +-- Save start directory as base +vim.g.base_dir = vim.fn.getcwd() + +-- Set display language +vim.cmd("silent! language en_US") + +-- Detect and use PowerShell on Windows +if vim.fn.has("win32") == 1 or vim.fn.has("wsl") == 1 then + LazyVim.terminal.setup("pwsh") +end + +-- Indenting +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true +vim.opt.breakindent = true + +-- Set characters to view whitespaces +vim.opt.listchars = { + tab = "» ", + trail = "·", + nbsp = "␣", +} + +-- Preview substitutions live, as you type! +vim.opt.inccommand = "split" + +-- Minimal spacing to keep around the cursor. +vim.opt.scrolloff = 8 +vim.opt.sidescrolloff = 12 + +-- Set cursor pointer to block +vim.opt.guicursor = "n-v-i-c:block-Cursor"