import options, keymaps and autocmds from kickstart-based config

This commit is contained in:
Baipyrus 2024-11-02 02:17:34 +01:00
parent f885992d12
commit 90a0c655cc
3 changed files with 106 additions and 0 deletions

View File

@ -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,
})

View File

@ -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", "<C-W><C-D>")
vim.keymap.del("n", "<C-W>d")
vim.keymap.set("n", "<leader>e", vim.diagnostic.open_float, { desc = "Show diagnostic [E]rror messages" })
vim.keymap.del("n", "<leader>qq")
vim.keymap.set("n", "<leader>q", vim.diagnostic.setqflist, { desc = "Open diagnostic [Q]uickfix list" })
-- Open terminal in current window
vim.keymap.del("n", "<C-/>")
vim.keymap.del("n", "<leader>ft")
vim.keymap.del("n", "<leader>fT")
vim.keymap.set({ "n", "v" }, "<leader>to", "<cmd>term<cr>", { desc = "[T]erminal [O]pen" })
-- Disable arrow keys in normal mode
vim.keymap.set({ "n", "v" }, "<left>", '<cmd>echo "Use h to move!!"<CR>')
vim.keymap.set({ "n", "v" }, "<right>", '<cmd>echo "Use l to move!!"<CR>')
vim.keymap.set({ "n", "v" }, "<up>", '<cmd>echo "Use k to move!!"<CR>')
vim.keymap.set({ "n", "v" }, "<down>", '<cmd>echo "Use j to move!!"<CR>')
vim.keymap.del("n", "<leader>cd")
-- Populate CMD to prepare for change directory
vim.keymap.set("n", "<leader>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",
"<leader>cdb",
"<cmd>cd " .. vim.g.base_dir .. "<cr>",
{ desc = "[C]hange [D]irectory to [B]ase directory" }
)
-- Navigate to 'user home' directory
vim.keymap.set("n", "<leader>cdh", "<cmd>cd " .. vim.env.HOME .. "<cr>", { desc = "[C]hange [D]irectory to [H]ome" })
-- Automatically navigate to config directory
vim.keymap.set(
"n",
"<leader>cdn",
"<cmd>cd " .. vim.fn.stdpath("config") .. "<cr>",
{ desc = "[C]hange [D]irectory to [N]eovim" }
)
-- Resizing windows
vim.keymap.set({ "n", "v" }, "<M-,>", "<C-W><")
vim.keymap.set({ "n", "v" }, "<M-.>", "<C-W>>")
vim.keymap.set({ "n", "v" }, "<M-=>", "<C-W>+")
vim.keymap.set({ "n", "v" }, "<M-->", "<C-W>-")
if vim.g.neovide then
-- System clipboard keybinds in normal and visual mode
vim.keymap.set({ "n", "v" }, "<C-S-c>", '"+y', { desc = "Yank to System clipboard" })
vim.keymap.set({ "n", "v" }, "<C-S-v>", '"+p', { desc = "Paste from System clipboard" })
-- Clipboard for command and insert mode
vim.keymap.set({ "c", "i" }, "<C-S-v>", "<C-R>+", { desc = "Paste from System clipboard" })
-- Clipboard for terminal mode
vim.keymap.set({ "t" }, "<C-S-v>", '<C-\\><C-n>"+pi', { desc = "Paste from System clipboard" })
end

View File

@ -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"