nvim/lua/general.lua

92 lines
2.7 KiB
Lua
Raw Normal View History

2023-02-11 17:36:50 +00:00
local function open_nvim_tree()
2023-02-23 20:49:48 +00:00
-- open the tree
require("nvim-tree.api").tree.open()
2023-02-11 17:36:50 +00:00
end
-- Functional wrapper for mapping custom keybindings
local function map(mode, lhs, rhs, opts)
local options = { noremap = true }
if opts then
options = vim.tbl_extend("force", options, opts)
end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end
--mardown preview settings
vim.cmd [[
let g:mkdp_echo_preview_url = 1
]]
2023-02-11 17:36:50 +00:00
----------------------
-- general setup start
----------------------
-- open nvim tree on start
vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
-- disabling virtual text
VIRTUAL_TEXT_ENABLED = true
function switch_virtual_text()
VIRTUAL_TEXT_ENABLED = not VIRTUAL_TEXT_ENABLED
vim.diagnostic.config({
2024-10-13 18:14:30 +00:00
virtual_text = VIRTUAL_TEXT_ENABLED,
})
end
2024-10-13 18:14:30 +00:00
map("n", "<leader>vt", ":lua switch_virtual_text()<CR>")
map("c", "<C-r>", ":Telescope command_history<CR>")
map("n", "<leader>gs", ":Telescope git_status<CR>")
map("n", "<leader>gc", ":Telescope git_commits<CR>")
map("n", "<leader>gb", ":Telescope git_branches<CR>")
2024-04-11 11:29:27 +00:00
map("n", "<leader>ng", ":Neogit<CR>")
2024-07-25 12:01:29 +00:00
map("n", "<leader>bc", ":bufdo bd<CR>")
2024-04-24 14:27:29 +00:00
2024-04-03 17:27:42 +00:00
-- dap
map("n", "<leader>db", ":lua require'dap'.toggle_breakpoint()<CR>")
map("n", "<leader>dc", ":lua require'dap'.continue()<CR>")
map("n", "<leader>dg", ":lua require'dapui'.toggle()<CR>")
2023-02-11 17:36:50 +00:00
-- tab lines in normal and visual mode
map("n", "<Tab>", ">>")
map("n", "<S-Tab>", "<<")
map("i", "<S-Tab>", "<Esc><<i")
map("n", "<Tab>", ">>")
map("v", "<Tab>", ">gv")
map("v", "<S-Tab>", "<gv")
2023-02-12 17:26:24 +00:00
2023-10-24 18:58:52 +00:00
-- disable underline in lsp diagnostics
vim.lsp.handlers["textDocument/publishDiagnostics"] =
2024-10-13 18:14:30 +00:00
vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics,
{
underline = false
}
)
2023-02-12 17:26:24 +00:00
2024-10-13 18:14:30 +00:00
vim.opt.mouse = "c" -- set mouse in command line mode
2023-02-12 17:26:24 +00:00
vim.opt.colorcolumn = "80" -- highlight this column
vim.opt.relativenumber = true
vim.opt.number = true
vim.opt.clipboard = "unnamedplus" -- synchronize with system clipboard
vim.opt.swapfile = false
vim.opt.cursorline = true
2024-10-13 18:14:30 +00:00
vim.opt.tabstop = 4 -- number of columns occupied by a tab
vim.opt.softtabstop = 4 -- see multiple spaces as tabstops so <BS> does the right thing
2023-02-23 20:49:48 +00:00
vim.opt.expandtab = true -- converts tabs to white space
2024-10-13 18:14:30 +00:00
vim.opt.shiftwidth = 4 -- width for autoindents
vim.filetype.add({
extension = {
sls = "sls.yaml.jinja",
jinja = 'jinja',
jinja2 = 'jinja',
j2 = 'jinja',
},
})
2023-02-12 17:26:24 +00:00
vim.cmd [[
colorscheme gruvbox
2024-12-12 13:09:02 +00:00
autocmd BufRead,BufNewFile *{namespace,policy,middleware,configmap,role,deployment,cron,service,volume,secret,ingress,svc,pvc}*.yaml,*.tpl,*.gotmpl,helmfile*.yaml set ft=helm
2023-02-12 17:26:24 +00:00
]]