From 18edf9861d1b38591b51b42465b224d77736db04 Mon Sep 17 00:00:00 2001 From: listout Date: Tue, 2 Aug 2022 01:10:05 +0530 Subject: nvim: moving init to lua Signed-off-by: listout --- lua/core/keymaps.lua | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 lua/core/keymaps.lua (limited to 'lua/core/keymaps.lua') diff --git a/lua/core/keymaps.lua b/lua/core/keymaps.lua new file mode 100644 index 0000000..ca80862 --- /dev/null +++ b/lua/core/keymaps.lua @@ -0,0 +1,52 @@ +----------------------------------------------------------- +-- Define keymaps of Neovim and installed plugins. +----------------------------------------------------------- + +local function map(mode, lhs, rhs, opts) + local options = { noremap = true, silent = true } + if opts then + options = vim.tbl_extend('force', options, opts) + end + vim.api.nvim_set_keymap(mode, lhs, rhs, options) +end + +-- Change leader to a comma +vim.g.mapleader = ',' + +----------------------------------------------------------- +-- Neovim shortcuts +----------------------------------------------------------- + +-- Disable arrow keys +map('', '', '') +map('', '', '') +map('', '', '') +map('', '', '') + +-- Reload configuration without restart nvim +map('n', 'r', ':so %') + +-- Change split orientation +map('n', 'tk', 'tK') -- change vertical to horizontal +map('n', 'th', 'tH') -- change horizontal to vertical + +map('n', 'M-j', ':resize -2') +map('n', 'M-k', ':resize +2') +map('n', 'M-l', ':vertical resize -2') +map('n', 'M-h', ':vertical resize +2') + +map('t', 'C-w', '') + +map('n', 'b', ':Buffers'); +map('n', 'n', ':Files'); + +vim.cmd([[ + let $FZF_DEFAULT_COMMAND = "find * -path + \ '*/\.*' -prune -o -path 'node_modules/**' + \ -prune -o -path 'target/**' -prune -o -path + \'dist/**' -prune -o -type f -print -o -type + \ l -print 2> /dev/null" +]]) + +map('n', 'l', ':Buffers') + -- cgit v1.2.3