From 994cb1f91958a02415825a4dda74d18241096805 Mon Sep 17 00:00:00 2001 From: Saumit Dinesan Date: Sun, 4 Sep 2022 02:23:15 +0530 Subject: adding keymaps neovim config --- .config/nvim/lua/justsaumit/keymaps.lua | 52 +++++++++++++++++++++++++++++++++ .config/nvim/lua/justsaumit/options.lua | 39 +++++++++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 .config/nvim/lua/justsaumit/keymaps.lua create mode 100644 .config/nvim/lua/justsaumit/options.lua (limited to '.config/nvim/lua/justsaumit') diff --git a/.config/nvim/lua/justsaumit/keymaps.lua b/.config/nvim/lua/justsaumit/keymaps.lua new file mode 100644 index 0000000..5445963 --- /dev/null +++ b/.config/nvim/lua/justsaumit/keymaps.lua @@ -0,0 +1,52 @@ +local opts = { noremap = true, silent = true } + +-- Shorten function name +local keymap = vim.keymap.set + +--Remap space as leader key +keymap("", "", "", opts) +vim.g.mapleader = " " +vim.g.maplocalleader = " " + +-- Modes +-- normal_mode = "n", +-- insert_mode = "i", +-- visual_mode = "v", +-- visual_block_mode = "x", +-- command_mode = "c", + +-- Normal -- +-- Better window navigation for split +keymap("n", "", "h", opts) +keymap("n", "", "j", opts) +keymap("n", "", "k", opts) +keymap("n", "", "l", opts) + +-- Resize with arrows +keymap("n", "", ":resize -2", opts) +keymap("n", "", ":resize +2", opts) +keymap("n", "", ":vertical resize -2", opts) +keymap("n", "", ":vertical resize +2", opts) + +-- Move text up and down +keymap("n", "", ":m .+1==gi", opts) +keymap("n", "", ":m .-2==gi", opts) + +-- Insert -- + +-- Visual -- +-- Stay in indent mode +keymap("v", "<", "", ">gv", opts) + +-- Move text up and down +keymap("v", "", ":m .+1==", opts) +keymap("v", "", ":m .-2==", opts) +keymap("v", "p", '"_dP', opts) + +-- Visual Block -- +-- Move text up and down +keymap("x", "J", ":move '>+1gv-gv", opts) +keymap("x", "K", ":move '<-2gv-gv", opts) +keymap("x", "", ":move '>+1gv-gv", opts) +keymap("x", "", ":move '<-2gv-gv", opts) diff --git a/.config/nvim/lua/justsaumit/options.lua b/.config/nvim/lua/justsaumit/options.lua new file mode 100644 index 0000000..30dbe9c --- /dev/null +++ b/.config/nvim/lua/justsaumit/options.lua @@ -0,0 +1,39 @@ +local options = { + number=true, -- Shows absolute linenumber + relativenumber=true, -- Shows linenumber relative to cursor + --combination of both^ for hybrid linenumber + showbreak="+++", -- wrap broken line prefix + textwidth=100, + numberwidth=4, + scrolloff=8, -- keeps cursor in middle of screen/scrolls 8lines in advance + mouse="a", -- enable mouse support + splitbelow=true, + splitright=true, + clipboard="unnamedplus", -- allows neovim to access system clipboard + --spaces/tabs/indents + softtabstop=4, -- No. of spaces per tab + shiftwidth=4, -- No. of auto-indent space + expandtab=true, -- spaces inplace of tabs + autoindent=true, -- New line copies indentation from past line + smartindent=true, -- Indents in accordance to the syntax/style of the code extension + --searches + ignorecase=true, -- Ignore case-sensitivity during search + smartcase=true, -- If searching capital search only capital + hlsearch=false, -- no perma highlight post search + incsearch=true, -- searches for strings incrementally + showmatch=true, -- Highlight matching braces + --git integration/lsp + --signcolumn=true, + --undo/backup + backup=false, + swapfile=false, + undodir=os.getenv("HOME") .. "/.config/nvim/undodir", + undofile=true +} +--forloop for table 'options' +for key, value in pairs(options) do + vim.opt[key] = value +end + +--to 'cw/'dw' a word containing '-' in between +--vim.cmd [[set iskeyword+=-]] -- cgit v1.2.3