add showbreak symbol to show line breaks

add map function for setting keymaps
pull/1300/head
km 5 months ago
parent 0cf6219bdf
commit b771adeb0b

@ -1,6 +1,4 @@
--[[
- Lua
- quick guide: https://learnxinyminutes.com/docs/lua/
- :help lua-guide
- (or HTML version): https://neovim.io/doc/user/lua-guide.html
@ -42,6 +40,7 @@ vim.schedule(function()
end)
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.ignorecase = true -- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
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.listchars = { tab = '» ', trail = '·', eol = '$', nbsp = '␣' }
vim.opt.listchars = { tab = '▸·', trail = '', eol = '$', nbsp = '' }
vim.opt.inccommand = 'split' -- Preview substitutions live, as you type!
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.

@ -1,24 +1,22 @@
-- function to assist with keymapping
function map(mode, lhs, rhs, opts)
local options = { noremap = true, silent = true }
if opts then
options = vim.tbl_extend('force', options, opts)
end
vim.keymap.set(mode, lhs, rhs, options)
end
return {
-- [[ Basic Keymaps ]]
-- See `:help vim.keymap.set()`
-- function to assist with keymapping
--[[
function map(mode, lhs, rhs, opts)
local options = { noremap = true, silent = true }
if opts then
options = vim.tbl_extend("force", options, opts)
end
vim.keymap.set(mode, lhs, rhs, options)
end
--]]
-- See `:help map()`
-- Clear highlights on search when pressing <Esc> in normal mode
-- See `:help hlsearch`
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>'),
map('n', '<Esc>', '<cmd>nohlsearch<CR>'),
-- 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
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
@ -26,29 +24,28 @@ return {
--
-- 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
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
-- Use CTRL+<hjkl> to switch between windows
-- 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' }),
vim.keymap.set('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' }),
vim.keymap.set('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' }),
vim.keymap.set('n', '<S-Tab>', ':bp!<Enter>', { desc = 'Go to previous buffer' }),
vim.keymap.set('n', '<leader>ws', ':split<Enter>', { desc = 'split window horizontally' }),
vim.keymap.set('n', '<leader>wv', ':vsplit<Enter>', { desc = 'split window vertically' }),
map('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' }),
map('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' }),
map('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' }),
map('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' }),
map('n', '<Tab>', ':bn!<Enter>', { desc = 'Go to next buffer' }),
map('n', '<S-Tab>', ':bp!<Enter>', { desc = 'Go to previous buffer' }),
map('n', '<leader>bd', ':bd<Enter>', { desc = 'close the current buffer' }),
-- terraform
vim.keymap.set('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' }),
vim.keymap.set('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>ti', ':!terraform init -no-color<CR>', { desc = 'terraform init' }),
map('n', '<leader>tv', ':!terraform validate -no-color<CR>', { desc = 'terraform validate' }),
map('n', '<leader>tp', ':!terraform plan -no-color<CR>', { desc = 'terraform plan' }),
map('n', '<leader>ta', ':!terraform apply -no-color -auto-approve<CR>', { desc = 'terraform apply' }),
-- Toggles
vim.keymap.set('n', '<leader>n', ':set number!<Enter>:set relativenumber!<Enter>'),
vim.keymap.set('n', '<Leader>g', ':Gitsigns toggle_signs<Enter>', { desc = 'Toggle Gitsigns' }),
vim.keymap.set('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>n', ':set number!<Enter>:set relativenumber!<Enter>'),
map('n', '<Leader>g', ':Gitsigns toggle_signs<Enter>', { desc = 'Toggle Gitsigns' }),
map('n', '<Leader>l', ':set list!<Enter>', { desc = 'Toggle list mode' }),
map('n', '<Leader>p', ':set paste!<Enter>', { desc = 'Toggle paste mode' }),
}

Loading…
Cancel
Save