basics
This commit is contained in:
40
plugin/keymap.lua
Normal file
40
plugin/keymap.lua
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
-- define common options
|
||||||
|
local opts = {
|
||||||
|
noremap = true, -- non-recursive
|
||||||
|
silent = true, -- do not show message
|
||||||
|
}
|
||||||
|
local map = vim.keymap.set
|
||||||
|
|
||||||
|
vim.g.mapleader = ' '
|
||||||
|
-----------------
|
||||||
|
-- Normal mode --
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
-- Hint: see `:h vim.map.set()`
|
||||||
|
-- Better window navigation
|
||||||
|
map('n', '<leader>wh', '<C-w>h', opts)
|
||||||
|
map('n', '<leader>wj', '<C-w>j', opts)
|
||||||
|
map('n', '<leader>wk', '<C-w>k', opts)
|
||||||
|
map('n', '<leader>wl', '<C-w>l', opts)
|
||||||
|
|
||||||
|
local step_size = 4
|
||||||
|
map('n', '<leader>wJ', ':resize -'.. step_size ..'<CR>', opts)
|
||||||
|
map('n', '<leader>wK', ':resize +'.. step_size ..'<CR>', opts)
|
||||||
|
map('n', '<leader>wH', ':vertical resize -'.. step_size ..'<CR>', opts)
|
||||||
|
map('n', '<leader>wL', ':vertical resize +'.. step_size ..'<CR>', opts)
|
||||||
|
|
||||||
|
map('n', '<leader>wn', ':windo new<CR>', opts)
|
||||||
|
map('n', '<leader>wc', ':close<CR>', opts)
|
||||||
|
|
||||||
|
-- tab management
|
||||||
|
map('n', '<tab>', ':tabnext<CR>', opts)
|
||||||
|
map('n', '<leader>x', ':tabclose<CR>', opts)
|
||||||
|
map('n', '<leader>s', ':$tab split<CR>', opts)
|
||||||
|
|
||||||
|
|
||||||
|
-----------------
|
||||||
|
-- Visual mode --
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
--vim.keymap.set('v', '<', '<gv', opts)
|
||||||
|
--vim.keymap.set('v', '>', '>gv', opts)
|
||||||
26
plugin/options.lua
Normal file
26
plugin/options.lua
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
-- Hint: use `:h <option>` to figure out the meaning if needed
|
||||||
|
vim.opt.clipboard = 'unnamedplus' -- use system clipboard
|
||||||
|
vim.opt.completeopt = {'menu', 'menuone', 'noselect'}
|
||||||
|
vim.opt.mouse = 'a' -- allow the mouse to be used in Nvim
|
||||||
|
|
||||||
|
-- Tab
|
||||||
|
local tabstops = 4
|
||||||
|
vim.opt.tabstop = tabstops -- number of visual spaces per TAB
|
||||||
|
vim.opt.softtabstop = tabstops -- number of spacesin tab when editing
|
||||||
|
vim.opt.shiftwidth = tabstops -- insert 4 spaces on a tab
|
||||||
|
vim.opt.expandtab = true -- tabs are spaces, mainly because of python
|
||||||
|
|
||||||
|
-- UI config
|
||||||
|
vim.opt.number = true -- add numbers to each line on the left side
|
||||||
|
vim.opt.relativenumber = true -- show relative numbers
|
||||||
|
vim.opt.cursorline = true -- highlight cursor line underneath the cursor horizontally
|
||||||
|
vim.opt.splitbelow = true -- open new vertical split bottom
|
||||||
|
vim.opt.splitright = true -- open new horizontal splits right
|
||||||
|
vim.opt.termguicolors = true -- enabl 24-bit RGB color in the TUI
|
||||||
|
vim.opt.showmode = true -- we are experienced,we know we need the "-- INSERT --" mode hint
|
||||||
|
|
||||||
|
-- Searching
|
||||||
|
vim.opt.incsearch = true -- search as characters are entered
|
||||||
|
vim.opt.hlsearch = true -- highlight matches
|
||||||
|
vim.opt.ignorecase = true -- ignore case in searches by default
|
||||||
|
vim.opt.smartcase = true -- but make it case sensitive if an uppercase is entered
|
||||||
Reference in New Issue
Block a user