summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authortdback <tyler@tdback.net>2024-12-04 18:48:24 -0500
committertdback <tyler@tdback.net>2024-12-04 18:48:24 -0500
commit3b2163b821f4dbf1003804b9b19fd276dc4bc350 (patch)
tree809a679142eae8e7d3b4d2b3cf1426416883a7f9 /plugin
initial commit to new repo
Diffstat (limited to 'plugin')
-rw-r--r--plugin/autocmd.lua13
-rw-r--r--plugin/keymaps.lua19
-rw-r--r--plugin/options.lua37
3 files changed, 69 insertions, 0 deletions
diff --git a/plugin/autocmd.lua b/plugin/autocmd.lua
new file mode 100644
index 0000000..21b5f9f
--- /dev/null
+++ b/plugin/autocmd.lua
@@ -0,0 +1,13 @@
+local autocmd = vim.api.nvim_create_autocmd
+
+autocmd({ "TextYankPost" }, {
+ pattern = "*",
+ callback = function()
+ vim.highlight.on_yank({
+ higroup = "IncSearch",
+ timeout = 50,
+ })
+ end,
+})
+
+autocmd({ "BufWritePre" }, { pattern = "*", command = [[%s/\s\+$//e]] })
diff --git a/plugin/keymaps.lua b/plugin/keymaps.lua
new file mode 100644
index 0000000..62b6051
--- /dev/null
+++ b/plugin/keymaps.lua
@@ -0,0 +1,19 @@
+vim.keymap.set("n", "n", "nzzzv")
+vim.keymap.set("n", "N", "Nzzzv")
+vim.keymap.set("n", "J", "mzJ`z")
+vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
+vim.keymap.set("v", "K", ":m '>-2<CR>gv=gv")
+vim.keymap.set("n", "<C-d>", "<C-d>zz")
+vim.keymap.set("n", "<C-u>", "<C-u>zz")
+vim.keymap.set({ "n", "v" }, "<leader>d", [["_d]])
+vim.keymap.set("n", "<leader>f", vim.lsp.buf.format)
+vim.keymap.set("x", "<leader>p", [["_dP]])
+vim.keymap.set("n", "<leader>hh", ":help<Space>")
+vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
+vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
+vim.keymap.set({ "n", "v" }, "<leader>y", [["+y]])
+vim.keymap.set("n", "<leader>Y", [["+Y]])
+vim.keymap.set("n", "<up>", "<C-w><up>")
+vim.keymap.set("n", "<down>", "<C-w><down>")
+vim.keymap.set("n", "<left>", "<C-w><left>")
+vim.keymap.set("n", "<right>", "<C-w><right>")
diff --git a/plugin/options.lua b/plugin/options.lua
new file mode 100644
index 0000000..c349c3a
--- /dev/null
+++ b/plugin/options.lua
@@ -0,0 +1,37 @@
+vim.opt.showcmd = true
+vim.opt.scrolloff = 8
+vim.opt.updatetime = 50
+
+vim.opt.number = true
+vim.opt.relativenumber = true
+
+vim.opt.shiftwidth = 4
+vim.opt.tabstop = 4
+vim.opt.expandtab = true
+vim.opt.smartindent = true
+
+vim.opt.wrap = false
+vim.opt.linebreak = false
+
+vim.opt.smartcase = true
+vim.opt.ignorecase = true
+vim.opt.hlsearch = false
+vim.opt.incsearch = true
+
+vim.opt.foldmethod = "syntax"
+vim.opt.foldlevel = 99
+
+vim.opt.signcolumn = "yes"
+vim.opt.colorcolumn = "80"
+vim.opt.cursorline = true
+vim.opt.cursorlineopt = "number"
+
+vim.opt.termguicolors = true
+vim.opt.isfname:append("@-@")
+
+vim.opt.swapfile = false
+vim.opt.backup = false
+vim.opt.undofile = true
+vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
+
+vim.opt.mouse = "va"