Merge branch 'master' of github.com:llcoolkm/nvim
This commit is contained in:
commit
b12eca00ec
4
init.lua
4
init.lua
|
@ -1,6 +1,4 @@
|
||||||
--[[
|
--[[
|
||||||
|
|
||||||
- Lua
|
|
||||||
- quick guide: https://learnxinyminutes.com/docs/lua/
|
- quick guide: https://learnxinyminutes.com/docs/lua/
|
||||||
- :help lua-guide
|
- :help lua-guide
|
||||||
- (or HTML version): https://neovim.io/doc/user/lua-guide.html
|
- (or HTML version): https://neovim.io/doc/user/lua-guide.html
|
||||||
|
@ -42,6 +40,7 @@ vim.schedule(function()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
vim.opt.breakindent = true -- Enable break indent
|
vim.opt.breakindent = true -- Enable break indent
|
||||||
|
vim.opt.showbreak = '↳ '
|
||||||
vim.opt.undofile = false -- Do not save undo history (no undo beyond last save)
|
vim.opt.undofile = false -- Do not save undo history (no undo beyond last save)
|
||||||
vim.opt.ignorecase = true -- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
|
vim.opt.ignorecase = true -- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
|
||||||
vim.opt.smartcase = true
|
vim.opt.smartcase = true
|
||||||
|
@ -57,7 +56,6 @@ vim.opt.splitbelow = true -- Configure how new splits should be opened
|
||||||
vim.opt.list = false
|
vim.opt.list = false
|
||||||
--vim.opt.listchars = { tab = '» ', trail = '·', eol = '$', nbsp = '␣' }
|
--vim.opt.listchars = { tab = '» ', trail = '·', eol = '$', nbsp = '␣' }
|
||||||
vim.opt.listchars = { tab = '▸·', trail = '▸', eol = '$', nbsp = '␣' }
|
vim.opt.listchars = { tab = '▸·', trail = '▸', eol = '$', nbsp = '␣' }
|
||||||
|
|
||||||
vim.opt.inccommand = 'split' -- Preview substitutions live, as you type!
|
vim.opt.inccommand = 'split' -- Preview substitutions live, as you type!
|
||||||
vim.opt.cursorline = true -- Show which line your cursor is on
|
vim.opt.cursorline = true -- Show which line your cursor is on
|
||||||
vim.opt.scrolloff = 3 -- Minimal number of screen lines to keep above and below the cursor.
|
vim.opt.scrolloff = 3 -- Minimal number of screen lines to keep above and below the cursor.
|
||||||
|
|
|
@ -1,24 +1,22 @@
|
||||||
return {
|
|
||||||
-- [[ Basic Keymaps ]]
|
|
||||||
-- See `:help vim.keymap.set()`
|
|
||||||
|
|
||||||
-- function to assist with keymapping
|
-- function to assist with keymapping
|
||||||
--[[
|
|
||||||
function map(mode, lhs, rhs, opts)
|
function map(mode, lhs, rhs, opts)
|
||||||
local options = { noremap = true, silent = true }
|
local options = { noremap = true, silent = true }
|
||||||
if opts then
|
if opts then
|
||||||
options = vim.tbl_extend("force", options, opts)
|
options = vim.tbl_extend('force', options, opts)
|
||||||
end
|
end
|
||||||
vim.keymap.set(mode, lhs, rhs, options)
|
vim.keymap.set(mode, lhs, rhs, options)
|
||||||
end
|
end
|
||||||
--]]
|
|
||||||
|
return {
|
||||||
|
-- [[ Basic Keymaps ]]
|
||||||
|
-- See `:help map()`
|
||||||
|
|
||||||
-- Clear highlights on search when pressing <Esc> in normal mode
|
-- Clear highlights on search when pressing <Esc> in normal mode
|
||||||
-- See `:help hlsearch`
|
-- See `:help hlsearch`
|
||||||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>'),
|
map('n', '<Esc>', '<cmd>nohlsearch<CR>'),
|
||||||
|
|
||||||
-- Diagnostic keymaps
|
-- Diagnostic keymaps
|
||||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }),
|
map('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }),
|
||||||
|
|
||||||
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
|
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
|
||||||
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
|
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
|
||||||
|
@ -26,32 +24,31 @@ return {
|
||||||
--
|
--
|
||||||
-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
|
-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
|
||||||
-- or just use <C-\><C-n> to exit terminal mode
|
-- or just use <C-\><C-n> to exit terminal mode
|
||||||
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' }),
|
map('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' }),
|
||||||
|
|
||||||
-- Window and buffer handling
|
-- Window and buffer handling
|
||||||
-- Use CTRL+<hjkl> to switch between windows
|
-- Use CTRL+<hjkl> to switch between windows
|
||||||
-- See `:help wincmd` for a list of all window commands
|
-- See `:help wincmd` for a list of all window commands
|
||||||
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' }),
|
map('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' }),
|
||||||
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' }),
|
map('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' }),
|
||||||
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' }),
|
map('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' }),
|
||||||
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' }),
|
map('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' }),
|
||||||
vim.keymap.set('n', '<Tab>', ':bn!<Enter>', { desc = 'Go to next buffer' }),
|
map('n', '<Tab>', ':bn!<Enter>', { desc = 'Go to next buffer' }),
|
||||||
vim.keymap.set('n', '<S-Tab>', ':bp!<Enter>', { desc = 'Go to previous buffer' }),
|
map('n', '<S-Tab>', ':bp!<Enter>', { desc = 'Go to previous buffer' }),
|
||||||
vim.keymap.set('n', '<leader>ws', ':split<Enter>', { desc = 'split window horizontally' }),
|
map('n', '<leader>bd', ':bd<Enter>', { desc = 'close the current buffer' }),
|
||||||
vim.keymap.set('n', '<leader>wv', ':vsplit<Enter>', { desc = 'split window vertically' }),
|
|
||||||
|
|
||||||
-- neo-tree
|
-- neo-tree
|
||||||
vim.keymap.set('n', '<leader>e', ':Neotree reveal<CR>', { desc = 'Open file browser' }),
|
vim.keymap.set('n', '<leader>e', ':Neotree reveal<CR>', { desc = 'Open file browser' }),
|
||||||
|
|
||||||
-- terraform
|
-- terraform
|
||||||
vim.keymap.set('n', '<leader>ti', ':!terraform init -no-color<CR>', { desc = 'terraform init' }),
|
map('n', '<leader>ti', ':!terraform init -no-color<CR>', { desc = 'terraform init' }),
|
||||||
vim.keymap.set('n', '<leader>tv', ':!terraform validate -no-color<CR>', { desc = 'terraform validate' }),
|
map('n', '<leader>tv', ':!terraform validate -no-color<CR>', { desc = 'terraform validate' }),
|
||||||
vim.keymap.set('n', '<leader>tp', ':!terraform plan -no-color<CR>', { desc = 'terraform plan' }),
|
map('n', '<leader>tp', ':!terraform plan -no-color<CR>', { desc = 'terraform plan' }),
|
||||||
vim.keymap.set('n', '<leader>taa', ':!terraform apply -no-color -auto-approve<CR>', { desc = 'terraform apply' }),
|
map('n', '<leader>ta', ':!terraform apply -no-color -auto-approve<CR>', { desc = 'terraform apply' }),
|
||||||
|
|
||||||
-- Toggles
|
-- Toggles
|
||||||
vim.keymap.set('n', '<leader>n', ':set number!<Enter>:set relativenumber!<Enter>'),
|
map('n', '<leader>n', ':set number!<Enter>:set relativenumber!<Enter>'),
|
||||||
vim.keymap.set('n', '<Leader>g', ':Gitsigns toggle_signs<Enter>', { desc = 'Toggle Gitsigns' }),
|
map('n', '<Leader>g', ':Gitsigns toggle_signs<Enter>', { desc = 'Toggle Gitsigns' }),
|
||||||
vim.keymap.set('n', '<Leader>l', ':set list!<Enter>', { desc = 'Toggle list mode' }),
|
map('n', '<Leader>l', ':set list!<Enter>', { desc = 'Toggle list mode' }),
|
||||||
vim.keymap.set('n', '<Leader>p', ':set paste!<Enter>', { desc = 'Toggle paste mode' }),
|
map('n', '<Leader>p', ':set paste!<Enter>', { desc = 'Toggle paste mode' }),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue