add keybindings file, few changes with settings file
This commit is contained in:
parent
cd237d59b7
commit
66829126ef
|
@ -2,4 +2,4 @@
|
|||
|
||||
I've always been fascinated with vim and had been functioning with other's customized vim configs. Felt like working with a crutch. Decided to take things in my own hands and try to learn the "modern" vim ecosystem and start with nvim. Tried NvChad but the native lsp just didn't sit right with me, and also felt like I'm diving down the same path of using somebody else's customized setups. And so this repo was born.
|
||||
|
||||
Born a timeline of how and what things have changed, go through the commit history.
|
||||
To see a timeline of how and what things have changed, go through the commit history.
|
||||
|
|
2
init.lua
2
init.lua
|
@ -1,3 +1,3 @@
|
|||
-- require necessary modules
|
||||
require('macbook.settings')
|
||||
|
||||
require('macbook.keybindings')
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
local function map(m, k, v)
|
||||
vim.keymap.set(m, k, v, { silent = true })
|
||||
end
|
||||
|
||||
-- Fix * (keep the cursor position, don't move to next match)
|
||||
-- map('n', '*', '*N')
|
||||
|
||||
-- Fix n and N. This keeps cursor always in the center when jumping between next and previous matches.
|
||||
map('n', 'n', 'nzz')
|
||||
map('n', 'N', 'Nzz')
|
||||
|
||||
-- Mimic shell movements
|
||||
map('i', '<C-E>', '<C-o>$')
|
||||
map('i', '<C-A>', '<C-o>^')
|
||||
|
||||
-- Quickly save the current buffer or all buffers
|
||||
map('n', '<leader>w', '<CMD>update<CR>')
|
||||
map('n', '<leader>W', '<CMD>wall<CR>')
|
||||
|
||||
-- Quit neovim
|
||||
map('n', '<C-Q>', '<CMD>q<CR>')
|
||||
|
||||
-- leader-o/O inserts blank line below/above. Comes in handly when inserting blank lines between code blocks.
|
||||
map('n', '<leader>o', 'o<ESC>')
|
||||
map('n', '<leader>O', 'O<ESC>')
|
||||
|
||||
-- Move to the next/previous buffer
|
||||
map('n', '<leader>[', '<CMD>bp<CR>')
|
||||
map('n', '<leader>]', '<CMD>bn<CR>')
|
||||
|
||||
-- Move to the last buffer (CTRL-Tab style)
|
||||
map('n', "''", '<CMD>b#<CR>')
|
||||
|
||||
-- Copying the vscode behaviour of making tab splits
|
||||
map('n', '<C-\\>', '<CMD>vsplit<CR>')
|
||||
map('n', '<A-\\>', '<CMD>split<CR>')
|
||||
|
||||
-- Move line up and down in NORMAL and VISUAL modes
|
||||
-- Reference: https://vim.fandom.com/wiki/Moving_lines_up_or_down
|
||||
map('n', '<C-j>', '<CMD>move .+1<CR>')
|
||||
map('n', '<C-k>', '<CMD>move .-2<CR>')
|
||||
map('x', '<C-j>', ":move '>+1<CR>gv=gv")
|
||||
map('x', '<C-k>', ":move '<-2<CR>gv=gv")
|
||||
|
||||
-- Use operator pending mode to visually select the whole buffer
|
||||
-- e.g. dA = delete buffer ALL, yA = copy whole buffer ALL
|
||||
map('o', 'A', ':<C-U>normal! mzggVG<CR>`z')
|
||||
map('x', 'A', ':<C-U>normal! ggVG<CR>')
|
|
@ -12,9 +12,9 @@ o.termguicolors = true
|
|||
o.scrolloff = 8
|
||||
|
||||
-- Better editor UI
|
||||
o.number = false -- show line number
|
||||
o.number = true -- show line number
|
||||
o.numberwidth = 2
|
||||
o.relativenumber = false
|
||||
o.relativenumber = true
|
||||
o.signcolumn = 'auto'
|
||||
o.cursorline = true -- highlight entire cursor line, increases readability
|
||||
|
||||
|
@ -33,3 +33,27 @@ o.listchars = 'trail:·,nbsp:◇,tab:→ ,extends:▸,precedes:◂' -- list of c
|
|||
|
||||
-- Makes neovim and host OS clipboard play nicely with each other
|
||||
o.clipboard = 'unnamedplus'
|
||||
|
||||
-- Case insensitive searching unless /C or capital in search
|
||||
o.ignorecase = true
|
||||
o.smartcase = true
|
||||
|
||||
-- Undo and backup options
|
||||
o.backup = false
|
||||
o.writebackup = false
|
||||
o.undofile = true
|
||||
o.swapfile = false
|
||||
|
||||
-- Remember 50 items in commandline history
|
||||
o.history = 50
|
||||
|
||||
-- Better buffer splitting
|
||||
o.splitright = true
|
||||
o.splitbelow = true
|
||||
|
||||
-- Preserve view while jumpting [TODO] Figure out what these jumpoptions mean
|
||||
o.jumpoptions = 'view'
|
||||
|
||||
-- Map <leader> to space
|
||||
g.mapleader = ' '
|
||||
g.maplocalleader = ' '
|
||||
|
|
Loading…
Reference in New Issue