2022-05-09 11:25:29 +08:00
|
|
|
-- CORE SETTINGS
|
2022-08-07 21:00:11 +08:00
|
|
|
local o = vim.o
|
2021-09-14 19:58:30 +08:00
|
|
|
local global = vim.g
|
2023-11-30 16:04:04 +08:00
|
|
|
local map = vim.keymap.set
|
2021-09-07 23:26:21 +08:00
|
|
|
|
|
|
|
-- look and feel
|
2023-12-05 21:47:57 +08:00
|
|
|
global.netrw_banner = 0
|
2023-11-30 16:04:04 +08:00
|
|
|
global.netrw_bufsettings = "noma nomod relativenumber nowrap ro nobl"
|
2023-12-05 21:47:57 +08:00
|
|
|
global.netrw_liststyle = 3
|
|
|
|
global.netrw_winsize = 25
|
2022-08-07 21:00:11 +08:00
|
|
|
o.number = true
|
2023-11-30 15:44:15 +08:00
|
|
|
o.relativenumber = true
|
|
|
|
o.ruler = true
|
2022-08-07 21:00:11 +08:00
|
|
|
o.scrolloff = 10
|
2023-11-30 15:44:15 +08:00
|
|
|
o.showmode = false
|
2023-12-17 20:28:01 +08:00
|
|
|
o.termguicolors = true -- Remove this line after neovim v10
|
2023-12-05 21:47:57 +08:00
|
|
|
o.title = true
|
2023-12-10 15:22:37 +08:00
|
|
|
vim.opt.diffopt = { "internal", "filler", "closeoff", "iwhite" }
|
2021-09-07 23:26:21 +08:00
|
|
|
|
|
|
|
-- controlling
|
2023-11-30 16:04:04 +08:00
|
|
|
global.mapleader = ' '
|
2023-11-30 15:44:15 +08:00
|
|
|
o.autoindent = true
|
2022-08-07 21:00:11 +08:00
|
|
|
o.ignorecase = true
|
|
|
|
o.smartcase = true
|
|
|
|
o.smartindent = true
|
2023-12-10 15:22:37 +08:00
|
|
|
vim.opt.completeopt = { 'menu', 'menuone', 'noselect', 'noinsert' }
|
2021-10-25 10:53:37 +08:00
|
|
|
|
2023-11-30 16:04:04 +08:00
|
|
|
-- vscode
|
|
|
|
if vim.g.vscode then
|
|
|
|
-- undo/REDO via vscode
|
|
|
|
map("n", "u", "<Cmd>call VSCodeNotify('undo')<CR>")
|
|
|
|
map("n", "<C-r>", "<Cmd>call VSCodeNotify('redo')<CR>")
|
|
|
|
map("n", "gf", "<Cmd>call VSCodeCall('editor.action.openLink')<CR>", { noremap = true })
|
|
|
|
end
|
|
|
|
|
|
|
|
-- generic mappings
|
|
|
|
map('v', '<', '<gv', { noremap = true })
|
|
|
|
map('v', '>', '>gv', { noremap = true })
|
|
|
|
map('n', 'Y', 'y$', { noremap = true })
|
|
|
|
map('n', 'n', 'nzzzv', { noremap = true })
|
|
|
|
map('n', 'N', 'Nzzzv', { noremap = true })
|
|
|
|
|
|
|
|
-- Shortcutting split navigation
|
|
|
|
map('', '<A-h>', '<C-w>h')
|
|
|
|
map('', '<A-j>', '<C-w>j')
|
|
|
|
map('', '<A-k>', '<C-w>k')
|
|
|
|
map('', '<A-l>', '<C-w>l')
|
|
|
|
map('', '<A-H>', '<C-w>H')
|
|
|
|
map('', '<A-J>', '<C-w>J')
|
|
|
|
map('', '<A-K>', '<C-w>K')
|
|
|
|
map('', '<A-L>', '<C-w>L')
|
|
|
|
map('', '<M-S-.>', '<C-w>>')
|
|
|
|
map('', '<M-S-,>', '<C-w><')
|
|
|
|
map('', '<M-S-=>', '<C-w>+')
|
|
|
|
map('', '<M-->', '<C-w>-')
|
|
|
|
map('', '<A-T>', '<C-w>T')
|
2023-07-16 10:43:50 +08:00
|
|
|
|
2023-11-30 16:04:04 +08:00
|
|
|
-- undo to the last , . or !
|
|
|
|
map('i', ',', ',<c-g>u', { noremap = true })
|
|
|
|
map('i', '.', '.<c-g>u', { noremap = true })
|
|
|
|
map('i', '!', '!<c-g>u', { noremap = true })
|
|
|
|
map('i', '?', '?<c-g>u', { noremap = true })
|