wip
This commit is contained in:
1 parent
9604e54bc6
commit
cd2fa35a4f
31 files changed
+1745
-1617
No files matched your search
+147
-83
@@ -1,105 +1,169 @@
|
||||
local function augroup(name)
|
||||
return vim.api.nvim_create_augroup("nvim" .. name, { clear = true })
|
||||
return vim.api.nvim_create_augroup('nvim' .. name, { clear = true })
|
||||
end
|
||||
|
||||
-- Strip trailing spaces before write
|
||||
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
|
||||
group = augroup("strip_space"),
|
||||
pattern = { "*" },
|
||||
callback = function()
|
||||
vim.cmd([[ %s/\s\+$//e ]])
|
||||
end,
|
||||
-- ╭───────────────────────────────────────────────────────────────────╮
|
||||
-- │ Strip trailing spaces before write │
|
||||
-- ╰───────────────────────────────────────────────────────────────────╯
|
||||
|
||||
vim.api.nvim_create_autocmd({ 'BufWritePre' }, {
|
||||
group = augroup('strip_space'),
|
||||
pattern = { '*' },
|
||||
callback = function()
|
||||
vim.cmd([[ %s/\s\+$//e ]])
|
||||
end,
|
||||
})
|
||||
|
||||
-- Check if we need to reload the file when it changed
|
||||
vim.api.nvim_create_autocmd({ "FocusGained", "TermClose", "TermLeave" }, {
|
||||
group = augroup("checktime"),
|
||||
command = "checktime",
|
||||
-- ╭───────────────────────────────────────────────────────────────────╮
|
||||
-- │ Check if we need to reload the file when it changed │
|
||||
-- ╰───────────────────────────────────────────────────────────────────╯
|
||||
|
||||
vim.api.nvim_create_autocmd({ 'FocusGained', 'TermClose', 'TermLeave' }, {
|
||||
group = augroup('checktime'),
|
||||
command = 'checktime',
|
||||
})
|
||||
|
||||
-- Highlight on yank
|
||||
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||
group = augroup("highlight_yank"),
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
-- ╭───────────────────────────────────────────────────────────────────╮
|
||||
-- │ Highlight on yank │
|
||||
-- ╰───────────────────────────────────────────────────────────────────╯
|
||||
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
group = augroup('highlight_yank'),
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
})
|
||||
|
||||
-- resize splits if window got resized
|
||||
vim.api.nvim_create_autocmd({ "VimResized" }, {
|
||||
group = augroup("resize_splits"),
|
||||
callback = function()
|
||||
vim.cmd("tabdo wincmd =")
|
||||
end,
|
||||
-- ╭───────────────────────────────────────────────────────────────────╮
|
||||
-- │ resize splits if window got resized │
|
||||
-- ╰───────────────────────────────────────────────────────────────────╯
|
||||
|
||||
vim.api.nvim_create_autocmd({ 'VimResized' }, {
|
||||
group = augroup('resize_splits'),
|
||||
callback = function()
|
||||
vim.cmd('tabdo wincmd =')
|
||||
end,
|
||||
})
|
||||
|
||||
-- go to last loc when opening a buffer
|
||||
vim.api.nvim_create_autocmd("BufReadPost", {
|
||||
group = augroup("last_loc"),
|
||||
callback = function()
|
||||
local mark = vim.api.nvim_buf_get_mark(0, '"')
|
||||
local lcount = vim.api.nvim_buf_line_count(0)
|
||||
if mark[1] > 0 and mark[1] <= lcount then
|
||||
pcall(vim.api.nvim_win_set_cursor, 0, mark)
|
||||
end
|
||||
end,
|
||||
-- ╭───────────────────────────────────────────────────────────────────╮
|
||||
-- │ go to last loc when opening a buffer │
|
||||
-- ╰───────────────────────────────────────────────────────────────────╯
|
||||
|
||||
vim.api.nvim_create_autocmd('BufReadPost', {
|
||||
group = augroup('last_loc'),
|
||||
callback = function()
|
||||
local mark = vim.api.nvim_buf_get_mark(0, '"')
|
||||
local lcount = vim.api.nvim_buf_line_count(0)
|
||||
if mark[1] > 0 and mark[1] <= lcount then
|
||||
pcall(vim.api.nvim_win_set_cursor, 0, mark)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- close some filetypes with <q>
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
group = augroup("close_with_q"),
|
||||
pattern = {
|
||||
"DressingSelect",
|
||||
"Jaq",
|
||||
"PlenaryTestPopup",
|
||||
"fugitive",
|
||||
"help",
|
||||
"lir",
|
||||
"lspinfo",
|
||||
"man",
|
||||
"notify",
|
||||
"qf",
|
||||
"spectre_panel",
|
||||
"startuptime",
|
||||
"tsplayground",
|
||||
},
|
||||
callback = function(event)
|
||||
vim.bo[event.buf].buflisted = false
|
||||
vim.keymap.set("n", "q", "<cmd>close<cr>", { buffer = event.buf, silent = true })
|
||||
end,
|
||||
-- ╭───────────────────────────────────────────────────────────────────╮
|
||||
-- │ close some filetypes with <q> │
|
||||
-- ╰───────────────────────────────────────────────────────────────────╯
|
||||
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
group = augroup('close_with_q'),
|
||||
pattern = {
|
||||
'DressingSelect',
|
||||
'Jaq',
|
||||
'PlenaryTestPopup',
|
||||
'fugitive',
|
||||
'help',
|
||||
'lir',
|
||||
'lspinfo',
|
||||
'man',
|
||||
'notify',
|
||||
'qf',
|
||||
'spectre_panel',
|
||||
'startuptime',
|
||||
'tsplayground',
|
||||
},
|
||||
callback = function(event)
|
||||
vim.bo[event.buf].buflisted = false
|
||||
vim.keymap.set('n', 'q', '<cmd>close<cr>', { buffer = event.buf, silent = true })
|
||||
end,
|
||||
})
|
||||
|
||||
-- wrap and check for spell in text filetypes
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
group = augroup("wrap_spell"),
|
||||
pattern = { "gitcommit", "markdown" },
|
||||
callback = function()
|
||||
vim.opt_local.wrap = true
|
||||
vim.opt_local.spell = true
|
||||
end,
|
||||
-- ╭───────────────────────────────────────────────────────────────────╮
|
||||
-- │ wrap and check for spell in text filetypes │
|
||||
-- ╰───────────────────────────────────────────────────────────────────╯
|
||||
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
group = augroup('wrap_spell'),
|
||||
pattern = { 'gitcommit', 'markdown' },
|
||||
callback = function()
|
||||
vim.opt_local.wrap = true
|
||||
vim.opt_local.spell = true
|
||||
end,
|
||||
})
|
||||
|
||||
-- Auto create dir when saving a file, in case some intermediate directory does not exist
|
||||
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
|
||||
group = augroup("auto_create_dir"),
|
||||
callback = function(event)
|
||||
local file = vim.loop.fs_realpath(event.match) or event.match
|
||||
vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p")
|
||||
end,
|
||||
-- ╭───────────────────────────────────────────────────────────────────╮
|
||||
-- │ Auto create dir when saving a file, in case some intermediate │
|
||||
-- │ directory does not exist │
|
||||
-- ╰───────────────────────────────────────────────────────────────────╯
|
||||
|
||||
vim.api.nvim_create_autocmd({ 'BufWritePre' }, {
|
||||
group = augroup('auto_create_dir'),
|
||||
callback = function(event)
|
||||
local file = vim.loop.fs_realpath(event.match) or event.match
|
||||
vim.fn.mkdir(vim.fn.fnamemodify(file, ':p:h'), 'p')
|
||||
end,
|
||||
})
|
||||
|
||||
-- Set arb filetype
|
||||
vim.api.nvim_create_autocmd({ "BufEnter" }, {
|
||||
group = augroup("set_file_type"),
|
||||
pattern = { "*.arb" },
|
||||
command = require("lib.util").get_file_type_cmd("arb"),
|
||||
-- ╭───────────────────────────────────────────────────────────────────╮
|
||||
-- │ Set arb filetype │
|
||||
-- ╰───────────────────────────────────────────────────────────────────╯
|
||||
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter' }, {
|
||||
group = augroup('set_file_type'),
|
||||
pattern = { '*.arb' },
|
||||
command = require('lib.util').get_file_type_cmd('arb'),
|
||||
})
|
||||
|
||||
-- Disable format options
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
group = augroup("disable_formatoptions"),
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
vim.opt_local.formatoptions:remove({ "c", "r", "o" })
|
||||
end,
|
||||
-- ╭───────────────────────────────────────────────────────────────────╮
|
||||
-- │ Disable format options │
|
||||
-- ╰───────────────────────────────────────────────────────────────────╯
|
||||
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
group = augroup('disable_formatoptions'),
|
||||
pattern = '*',
|
||||
callback = function()
|
||||
vim.opt_local.formatoptions:remove({ 'c', 'r', 'o' })
|
||||
end,
|
||||
})
|
||||
|
||||
-- ╭─────────────────────────────────────────────────────────╮
|
||||
-- │ VIM-VISUAL-MULTI │
|
||||
-- ╰─────────────────────────────────────────────────────────╯
|
||||
local visual_multi_group = vim.api.nvim_create_augroup('VisualMulti', { clear = true })
|
||||
vim.api.nvim_create_autocmd('User', {
|
||||
pattern = 'visual_multi_start',
|
||||
callback = function()
|
||||
-- vim.cmd('NoiceDisable')
|
||||
vim.lsp.inlay_hint.enable(false)
|
||||
end,
|
||||
group = visual_multi_group,
|
||||
})
|
||||
vim.api.nvim_create_autocmd('User', {
|
||||
pattern = 'visual_multi_exit',
|
||||
callback = function()
|
||||
-- vim.cmd('NoiceEnable')
|
||||
vim.lsp.inlay_hint.enable(true)
|
||||
end,
|
||||
group = visual_multi_group,
|
||||
})
|
||||
|
||||
-- ╭─────────────────────────────────────────────────────────╮
|
||||
-- │ MESSAGE IF MACRO IS STOPPED │
|
||||
-- ╰─────────────────────────────────────────────────────────╯
|
||||
local macro_group = vim.api.nvim_create_augroup('MacroRecording', { clear = true })
|
||||
vim.api.nvim_create_autocmd('RecordingLeave', {
|
||||
group = macro_group,
|
||||
callback = function()
|
||||
-- Display a message when macro recording stops
|
||||
print('Macro recording stopped')
|
||||
end,
|
||||
})
|
||||
@@ -1,126 +0,0 @@
|
||||
local vim = vim
|
||||
|
||||
local X = {}
|
||||
|
||||
---@param on_attach fun(client, buffer)
|
||||
function X.on_attach(on_attach)
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
callback = function(args)
|
||||
local buffer = args.buf
|
||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||
on_attach(client, buffer)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
function X.starts_with(str, start)
|
||||
return str:sub(1, #start) == start
|
||||
end
|
||||
|
||||
function X.is_table(to_check)
|
||||
return type(to_check) == "table"
|
||||
end
|
||||
|
||||
function X.has_key(t, key)
|
||||
for t_key, _ in pairs(t) do
|
||||
if t_key == key then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function X.has_value(t, val)
|
||||
for _, value in ipairs(t) do
|
||||
if value == val then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function X.tprint(table)
|
||||
print(vim.inspect(table))
|
||||
end
|
||||
|
||||
function X.tprint_keys(table)
|
||||
for k in pairs(table) do
|
||||
print(k)
|
||||
end
|
||||
end
|
||||
|
||||
X.reload = function()
|
||||
local presentReload, reload = pcall(require, "plenary.reload")
|
||||
if presentReload then
|
||||
local counter = 0
|
||||
|
||||
for moduleName in pairs(package.loaded) do
|
||||
if X.starts_with(moduleName, "lt.") then
|
||||
reload.reload_module(moduleName)
|
||||
counter = counter + 1
|
||||
end
|
||||
end
|
||||
-- clear nvim-mapper keys
|
||||
vim.g.mapper_records = nil
|
||||
vim.notify("Reloaded " .. counter .. " modules!")
|
||||
end
|
||||
end
|
||||
|
||||
function X.is_macunix()
|
||||
return vim.fn.has("macunix")
|
||||
end
|
||||
|
||||
function X.link_highlight(from, to, override)
|
||||
local hl_exists, _ = pcall(vim.api.nvim_get_hl_by_name, from, false)
|
||||
if override or not hl_exists then
|
||||
-- vim.cmd(("highlight link %s %s"):format(from, to))
|
||||
vim.api.nvim_set_hl(0, from, { link = to })
|
||||
end
|
||||
end
|
||||
|
||||
X.highlight = function(group, opts)
|
||||
vim.api.nvim_set_hl(0, group, opts)
|
||||
end
|
||||
|
||||
X.highlight_bg = function(group, col)
|
||||
vim.api.nvim_set_hl(0, group, { bg = col })
|
||||
end
|
||||
|
||||
-- Define fg color
|
||||
-- @param group Group
|
||||
-- @param color Color
|
||||
X.highlight_fg = function(group, col)
|
||||
vim.api.nvim_set_hl(0, group, { fg = col })
|
||||
end
|
||||
|
||||
-- Define bg and fg color
|
||||
-- @param group Group
|
||||
-- @param fgcol Fg Color
|
||||
-- @param bgcol Bg Color
|
||||
X.highlight_fg_bg = function(group, fgcol, bgcol)
|
||||
vim.api.nvim_set_hl(0, group, { bg = bgcol, fg = fgcol })
|
||||
end
|
||||
|
||||
X.from_highlight = function(hl)
|
||||
local result = {}
|
||||
local list = vim.api.nvim_get_hl_by_name(hl, true)
|
||||
for k, v in pairs(list) do
|
||||
local name = k == "background" and "bg" or "fg"
|
||||
result[name] = string.format("#%06x", v)
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
X.get_color_from_terminal = function(num, default)
|
||||
local key = "terminal_color_" .. num
|
||||
return vim.g[key] and vim.g[key] or default
|
||||
end
|
||||
|
||||
X.cmd = function(name, command, desc)
|
||||
vim.api.nvim_create_user_command(name, command, desc)
|
||||
end
|
||||
|
||||
X.autocmd = function(evt, opts)
|
||||
vim.api.nvim_create_autocmd(evt, opts)
|
||||
end
|
||||
return X
|
||||
+55
-48
@@ -1,72 +1,79 @@
|
||||
local function map(mode, lhs, rhs, opts)
|
||||
opts = opts or {}
|
||||
opts.silent = opts.silent ~= false
|
||||
vim.keymap.set(mode, lhs, rhs, opts)
|
||||
opts = opts or {}
|
||||
opts.silent = opts.silent ~= false
|
||||
vim.keymap.set(mode, lhs, rhs, opts)
|
||||
end
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
-- Use jj as escape
|
||||
map("i", "jj", "<Esc>", opts)
|
||||
map("t", "JJ", "<C-\\><C-n>", opts)
|
||||
-- Space as leader
|
||||
map('n', '<Space>', '', opts)
|
||||
vim.g.mapleader = ' '
|
||||
vim.g.maplocalleader = ' '
|
||||
|
||||
-- Visual overwrite paste
|
||||
map({ "v", "x" }, "p", '"_dP', opts)
|
||||
-- Modes
|
||||
-- normal_mode = "n", insert_mode = "i", visual_mode = "v",
|
||||
-- visual_block_mode = "x", term_mode = "t", command_mode = "c",
|
||||
|
||||
-- Do not copy on x
|
||||
map({ "v", "x" }, "x", '"_x', opts)
|
||||
|
||||
-- Increment/decrement
|
||||
map({ "n", "v", "x" }, "-", "<C-x>", opts)
|
||||
map({ "n", "v", "x" }, "=", "<C-a>", opts)
|
||||
|
||||
-- Move to line beginning and end
|
||||
map({ "n", "v", "x" }, "gl", "$", { desc = "End of line" })
|
||||
map({ "n", "v", "x" }, "gh", "^", { desc = "Beginning of line" })
|
||||
-- Comment
|
||||
map({ 'n', 'v' }, '<leader>/', 'gcc', { remap = true })
|
||||
|
||||
-- Select all
|
||||
map("n", "<C-a>", "gg<S-v>G")
|
||||
map('n', '<C-a>', 'gg<S-v>G')
|
||||
|
||||
map("n", "<C-s>", "<CMD>up<CR>", { desc = "Save File" })
|
||||
-- Use jj as escape
|
||||
map('i', 'jj', '<Esc>', opts)
|
||||
map('t', 'JJ', '<C-\\><C-n>', opts)
|
||||
|
||||
-- Visual overwrite paste
|
||||
map({ 'v', 'x' }, 'p', '"_dP', opts)
|
||||
|
||||
-- Do not copy on x
|
||||
map({ 'v', 'x' }, 'x', '"_x', opts)
|
||||
|
||||
-- Increment/decrement
|
||||
map({ 'n', 'v', 'x' }, '-', '<C-x>', opts)
|
||||
map({ 'n', 'v', 'x' }, '=', '<C-a>', opts)
|
||||
|
||||
-- Move to line beginning and end
|
||||
map({ 'n', 'v', 'x' }, 'gl', '$', { desc = 'End of line' })
|
||||
map({ 'n', 'v', 'x' }, 'gh', '^', { desc = 'Beginning of line' })
|
||||
|
||||
-- Center Cursors
|
||||
map("n", "J", "mzJ`z", opts)
|
||||
map("n", "<C-d>", "<C-d>zz", opts)
|
||||
map("n", "<C-u>", "<C-u>zz", opts)
|
||||
map("n", "n", "nzzzv", opts)
|
||||
map("n", "N", "Nzzzv", opts)
|
||||
map('n', 'J', 'mzJ`z', opts)
|
||||
map('n', '<C-d>', '<C-d>zz', opts)
|
||||
map('n', '<C-u>', '<C-u>zz', opts)
|
||||
map('n', 'n', 'nzzzv', opts)
|
||||
map('n', 'N', 'Nzzzv', opts)
|
||||
|
||||
-- Better up/down
|
||||
map("n", "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||
map("n", "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||
map('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||
map('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||
|
||||
-- Move text up and down
|
||||
map({ "v", "x" }, "J", ":move '>+1<CR>gv-gv", opts)
|
||||
map({ "v", "x" }, "K", ":move '<-2<CR>gv-gv", opts)
|
||||
map({ 'v', 'x' }, 'J', ":move '>+1<CR>gv-gv", opts)
|
||||
map({ 'v', 'x' }, 'K', ":move '<-2<CR>gv-gv", opts)
|
||||
|
||||
-- Clear search, diff update and redraw
|
||||
map({ "i", "n" }, "<esc>", "<cmd>noh<cr><esc>", { desc = "Escape and clear hlsearch" })
|
||||
map({ 'i', 'n' }, '<esc>', '<cmd>noh<cr><esc>', { desc = 'Escape and clear hlsearch' })
|
||||
|
||||
-- Consistent n/N search navigation
|
||||
map("n", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" })
|
||||
map("x", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" })
|
||||
map("o", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" })
|
||||
map("n", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" })
|
||||
map("x", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" })
|
||||
map("o", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" })
|
||||
map('n', 'n', "'Nn'[v:searchforward]", { expr = true, desc = 'Next search result' })
|
||||
map('x', 'n', "'Nn'[v:searchforward]", { expr = true, desc = 'Next search result' })
|
||||
map('o', 'n', "'Nn'[v:searchforward]", { expr = true, desc = 'Next search result' })
|
||||
map('n', 'N', "'nN'[v:searchforward]", { expr = true, desc = 'Prev search result' })
|
||||
map('x', 'N', "'nN'[v:searchforward]", { expr = true, desc = 'Prev search result' })
|
||||
map('o', 'N', "'nN'[v:searchforward]", { expr = true, desc = 'Prev search result' })
|
||||
|
||||
-- Better indenting
|
||||
map("v", "<", "<gv")
|
||||
map("v", ">", ">gv")
|
||||
map('v', '<', '<gv')
|
||||
map('v', '>', '>gv')
|
||||
|
||||
-- Add undo breakpoints
|
||||
map("i", ",", ",<c-g>u")
|
||||
map("i", ".", ".<c-g>u")
|
||||
map("i", ";", ";<c-g>u")
|
||||
map('i', ',', ',<c-g>u')
|
||||
map('i', '.', '.<c-g>u')
|
||||
map('i', ';', ';<c-g>u')
|
||||
|
||||
map({ "i" }, "<C-l>", "<Right>", { desc = "Move cursor to right" })
|
||||
map({ "i" }, "<C-h>", "<Left>", { desc = "Move cursor to right" })
|
||||
|
||||
map("n", "d", '"_d', { desc = "Delete without replacing clipboad" })
|
||||
map("n", "x", '"_x', { desc = "Cut without replacing clipboad" })
|
||||
map("n", "c", '"_c', { desc = "Change without replacing clipboad" })
|
||||
map("v", "p", '"_dP', { desc = "Paste without replacing clipboard" })
|
||||
map('n', 'd', '"_d', { desc = 'Delete without replacing clipboad' })
|
||||
map('n', 'x', '"_x', { desc = 'Cut without replacing clipboad' })
|
||||
map('n', 'c', '"_c', { desc = 'Change without replacing clipboad' })
|
||||
map('v', 'p', '"_dP', { desc = 'Paste without replacing clipboard' })
|
||||
+58
-61
@@ -1,67 +1,64 @@
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
local options = {
|
||||
ai = true,
|
||||
autoindent = true,
|
||||
autowrite = true,
|
||||
backspace = "indent,eol,start",
|
||||
backup = false, -- creates a backup file
|
||||
breakindent = true,
|
||||
clipboard = "unnamedplus", -- allows neovim to access the system clipboard
|
||||
cmdheight = 1, -- more space in the neovim command line for displaying messages
|
||||
completeopt = "menu,menuone,noselect", -- mostly just for cmp
|
||||
conceallevel = 0, -- so that `` is visible in markdown files
|
||||
confirm = true, -- Confirm to save changes before exiting modified buffer
|
||||
cursorline = true, -- highlight the current line
|
||||
expandtab = true, -- convert tabs to spaces
|
||||
fileencoding = "utf-8", -- the encoding written to a file
|
||||
formatoptions = "jlnqt", -- set formatoptions, check help fo-table
|
||||
grepformat = "%f:%l:%c:%m",
|
||||
grepprg = "rg --vimgrep",
|
||||
hlsearch = true, -- highlight all matches on previous search pattern
|
||||
ignorecase = true, -- ignore case in search patterns
|
||||
inccommand = "split", -- preview incremental substitute
|
||||
laststatus = 3,
|
||||
list = false,
|
||||
-- listchars = { trail = "", tab = "", nbsp = "_", extends = ">", precedes = "<" }, -- highlight
|
||||
mouse = "a", -- allow the mouse to be used in neovim
|
||||
number = true, -- set numbered lines
|
||||
numberwidth = 4, -- set number column width to 3 {default 4}
|
||||
pumblend = 10, -- Popup blen
|
||||
pumheight = 10, -- pop up menu height
|
||||
relativenumber = true, -- set relative numbered lines
|
||||
scrolloff = 10, -- is one of my fav
|
||||
sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal",
|
||||
shiftround = true, -- Round indent
|
||||
shiftwidth = 4, -- the number of spaces inserted for each indentation
|
||||
showcmd = false,
|
||||
showmode = false, -- we don't need to see things like -- INSERT -- anymore
|
||||
showtabline = 0, -- always show tabs
|
||||
si = true,
|
||||
sidescrolloff = 8,
|
||||
signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time
|
||||
smartcase = true, -- smart case
|
||||
smartindent = true, -- make indenting smarter again
|
||||
smarttab = true,
|
||||
splitbelow = true, -- force all horizontal splits to go below current window
|
||||
splitright = true, -- force all vertical splits to go to the right of current window
|
||||
swapfile = false, -- creates a swapfile
|
||||
tabstop = 4, -- insert 2 spaces for a tab
|
||||
termguicolors = true, -- set term gui colors (most terminals support this)
|
||||
timeoutlen = 300, -- time to wait for a mapped sequence to complete (in milliseconds)
|
||||
undofile = true, -- enable persistent undo
|
||||
undolevels = 10000,
|
||||
updatetime = 50, -- faster completion (4000ms default)
|
||||
wildmenu = true, -- wildmenu
|
||||
wildmode = "longest:full,full", -- Command-line completion mode
|
||||
winminwidth = 5, -- Minimum window width
|
||||
wrap = false, -- display lines as one long line
|
||||
writebackup = false, -- do not edit backups
|
||||
ai = true,
|
||||
autoindent = true,
|
||||
autowrite = true,
|
||||
backspace = 'indent,eol,start',
|
||||
backup = false, -- creates a backup file
|
||||
breakindent = true,
|
||||
clipboard = 'unnamedplus', -- allows neovim to access the system clipboard
|
||||
cmdheight = 1, -- more space in the neovim command line for displaying messages
|
||||
completeopt = 'menu,menuone,noselect', -- mostly just for cmp
|
||||
conceallevel = 0, -- so that `` is visible in markdown files
|
||||
confirm = true, -- Confirm to save changes before exiting modified buffer
|
||||
cursorline = true, -- highlight the current line
|
||||
expandtab = true, -- convert tabs to spaces
|
||||
fileencoding = 'utf-8', -- the encoding written to a file
|
||||
formatoptions = 'jlnqt', -- set formatoptions, check help fo-table
|
||||
grepformat = '%f:%l:%c:%m',
|
||||
grepprg = 'rg --vimgrep',
|
||||
hlsearch = true, -- highlight all matches on previous search pattern
|
||||
ignorecase = true, -- ignore case in search patterns
|
||||
inccommand = 'split', -- preview incremental substitute
|
||||
laststatus = 3,
|
||||
list = false,
|
||||
-- listchars = { trail = "", tab = "", nbsp = "_", extends = ">", precedes = "<" }, -- highlight
|
||||
mouse = 'a', -- allow the mouse to be used in neovim
|
||||
number = true, -- set numbered lines
|
||||
numberwidth = 4, -- set number column width to 3 {default 4}
|
||||
pumblend = 10, -- Popup blen
|
||||
pumheight = 10, -- pop up menu height
|
||||
relativenumber = true, -- set relative numbered lines
|
||||
scrolloff = 10, -- is one of my fav
|
||||
sessionoptions = 'blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal',
|
||||
shiftround = true, -- Round indent
|
||||
shiftwidth = 4, -- the number of spaces inserted for each indentation
|
||||
showcmd = false,
|
||||
showmode = false, -- we don't need to see things like -- INSERT -- anymore
|
||||
showtabline = 0, -- always show tabs
|
||||
si = true,
|
||||
sidescrolloff = 8,
|
||||
signcolumn = 'yes', -- always show the sign column, otherwise it would shift the text each time
|
||||
smartcase = true, -- smart case
|
||||
smartindent = true, -- make indenting smarter again
|
||||
smarttab = true,
|
||||
splitbelow = true, -- force all horizontal splits to go below current window
|
||||
splitright = true, -- force all vertical splits to go to the right of current window
|
||||
swapfile = false, -- creates a swapfile
|
||||
tabstop = 4, -- insert 2 spaces for a tab
|
||||
termguicolors = true, -- set term gui colors (most terminals support this)
|
||||
timeoutlen = 300, -- time to wait for a mapped sequence to complete (in milliseconds)
|
||||
undofile = true, -- enable persistent undo
|
||||
undolevels = 10000,
|
||||
updatetime = 50, -- faster completion (4000ms default)
|
||||
wildmenu = true, -- wildmenu
|
||||
wildmode = 'longest:full,full', -- Command-line completion mode
|
||||
winminwidth = 5, -- Minimum window width
|
||||
wrap = false, -- display lines as one long line
|
||||
writebackup = false, -- do not edit backups
|
||||
}
|
||||
|
||||
for k, v in pairs(options) do
|
||||
vim.opt[k] = v
|
||||
vim.opt[k] = v
|
||||
end
|
||||
|
||||
-- netrw file explorer settings
|
||||
@@ -72,7 +69,7 @@ vim.g.netrw_liststyle = 1
|
||||
-- Fix markdown indentation settings
|
||||
vim.g.markdown_recommended_style = 0
|
||||
|
||||
vim.opt.path:append({ "**" })
|
||||
vim.opt.path:append({ '**' })
|
||||
vim.opt.shortmess:append({ W = true, I = true, c = true })
|
||||
|
||||
-- hides `~` at the end of the buffer
|
||||
|
||||
Reference in new issue
Block a user