1
0
Fork 0

.config/nvim: update

main
urosm 2024-06-12 00:48:33 +02:00
parent f4aba20d0b
commit ff5952909b
3 changed files with 124 additions and 85 deletions

View File

@ -1,3 +1,4 @@
local api = vim.api
local optl = vim.opt_local
-- options
@ -9,3 +10,18 @@ optl.expandtab = true
local keymap_set = vim.keymap.set
keymap_set("n", "]h", "/\\_^#.*\\ze\\n\\{2}<esc>")
keymap_set("n", "[h", "?\\_^#.*\\ze\\n\\{2}<esc>")
-- buffer completion
optl.completeopt:append("noselect")
api.nvim_create_autocmd("TextChangedI", {
group = api.nvim_create_augroup("Markdown buffer autocomplete", {}),
buffer = 0,
desc = "Buffer autocomplete on TextChangedI",
callback = function ()
local col = api.nvim_win_get_cursor(0)[2]
local char = api.nvim_get_current_line():sub(col,col)
if char:match("%w") then
api.nvim_input("<c-x><c-n>")
end
end
})

View File

@ -48,16 +48,6 @@ end
vim.opt.background = "dark"
vim.g.colors_name = "basic"
if
vim.env.TERM == "linux" or
vim.env.TERM == "screen" or
vim.env.TERM == "screen.linux"
then
vim.opt.termguicolors = false
else
vim.opt.termguicolors = true
end
-- highlights ------------------------------------------------------------------
local fg = C.white
local bg = C.black
@ -121,7 +111,6 @@ local menu_accent_h = { ctermfg = accent.cterm,
ctermbg = fg.cterm,
bg = fg.gui,
reverse = true }
local test = { ctermfg, fg = 1, 2 }
set_hl("Pmenu", menu_normal_h)
set_hl("PmenuSel", menu_accent_h)
@ -148,17 +137,21 @@ set_hl("Question", message_accent_h)
set_hl("Title", message_accent_h)
-- buffer ----------------------------------------------------------------------
local buffer_normal_h = { ctermfg = dimmed.cterm, fg = dimmed.gui }
local buffer_normal_bg_h = { ctermbg = dimmed.cterm, bg = dimmed.gui }
local buffer_accent_h = { ctermfg = accent.cterm, fg = accent.gui }
local buffer_dimmed_h = { ctermfg = dimmed.cterm,
fg = dimmed.gui }
local buffer_dimmed_reverse_h = { ctermfg = dimmed.cterm,
fg = dimmed.gui,
reverse = true }
local buffer_accent_h = { ctermfg = accent.cterm,
fg = accent.gui }
set_hl("Conceal", buffer_normal_h)
set_hl("NonText", buffer_normal_h)
set_hl("EndOfBuffer", buffer_normal_h)
set_hl("Whitespace", buffer_normal_h)
set_hl("Folded", buffer_normal_h)
set_hl("Conceal", buffer_dimmed_h)
set_hl("NonText", buffer_dimmed_h)
set_hl("EndOfBuffer", buffer_dimmed_h)
set_hl("Whitespace", buffer_dimmed_h)
set_hl("Folded", buffer_dimmed_h)
set_hl("SpecialKey", buffer_accent_h)
set_hl("ColorColumn", buffer_normal_bg_h)
set_hl("ColorColumn", buffer_dimmed_reverse_h)
-- cursor ----------------------------------------------------------------------
local cursor_normal_h = { reverse = true }
@ -184,7 +177,7 @@ local match_accent_h = { ctermfg = C.black.cterm,
fg = C.black.gui,
ctermbg = C.magenta.cterm,
bg = C.magenta.gui }
local match_dimmed_h = { ctermfg = C.magenta.cterm,
local match_parens_h = { ctermfg = C.magenta.cterm,
fg = C.magenta.gui,
ctermbg = C.white.cterm,
bg = C.white.gui }
@ -193,7 +186,7 @@ set_hl("Search", match_normal_h)
set_hl("Substitute", match_normal_h)
set_hl("IncSearch", match_accent_h)
set_hl("CurSearch", match_accent_h)
set_hl("MatchParen", match_dimmed_h)
set_hl("MatchParen", match_parens_h)
-- selection -------------------------------------------------------------------
local selection_normal_h = { ctermfg = C.black.cterm,
@ -205,10 +198,15 @@ set_hl("Visual", selection_normal_h)
set_hl("Visualnos", selection_normal_h)
-- diff ------------------------------------------------------------------------
local diff_add_h = { ctermfg = C.green.cterm, fg = C.green.gui }
local diff_change_h = { ctermfg = C.orange.cterm, fg = C.orange.gui }
local diff_delete_h = { ctermfg = C.red.cterm, fg = C.red.gui }
local diff_text_h = { ctermfg = C.orange.cterm, fg = C.orange.gui, underline = true }
local diff_add_h = { ctermfg = C.green.cterm,
fg = C.green.gui }
local diff_change_h = { ctermfg = C.orange.cterm,
fg = C.orange.gui }
local diff_delete_h = { ctermfg = C.red.cterm,
fg = C.red.gui }
local diff_text_h = { ctermfg = C.orange.cterm,
fg = C.orange.gui,
underline = true }
set_hl("DiffAdd", diff_add_h)
set_hl("DiffChange", diff_change_h)
@ -216,8 +214,12 @@ set_hl("DiffDelete", diff_delete_h)
set_hl("DiffText", diff_text_h)
-- spell -----------------------------------------------------------------------
local spell_error_h = { ctermfg = C.red.cterm, fg = C.red.gui, underline = true }
local spell_warn_h = { ctermfg = C.orange.cterm, fg = C.orange.gui, underline = true }
local spell_error_h = { ctermfg = C.red.cterm,
fg = C.red.gui,
underline = true }
local spell_warn_h = { ctermfg = C.orange.cterm,
fg = C.orange.gui,
underline = true }
set_hl("SpellBad", spell_error_h)
set_hl("SpellCap", spell_warn_h)
@ -225,16 +227,31 @@ set_hl("SpellLocal", spell_warn_h)
set_hl("SpellRare", spell_warn_h)
-- diagnostic ------------------------------------------------------------------
local diagnostic_error_h = { ctermfg = C.red.cterm, fg = C.red.gui }
local diagnostic_warn_h = { ctermfg = C.orange.cterm, fg = C.orange.gui }
local diagnostic_info_h = { ctermfg = C.blue.cterm, fg = C.blue.gui }
local diagnostic_hint_h = { ctermfg = C.white.cterm, fg = C.white.gui }
local diagnostic_ok_h = { ctermfg = C.green.cterm, fg = C.green.gui }
local diagnostic_error_u_h = { ctermfg = C.red.cterm, fg = C.red.gui, underline = true }
local diagnostic_warn_u_h = { ctermfg = C.orange.cterm, fg = C.orange.gui, underline = true }
local diagnostic_info_u_h = { ctermfg = C.blue.cterm, fg = C.blue.gui, underline = true }
local diagnostic_hint_u_h = { ctermfg = C.white.cterm, fg = C.white.gui, underline = true }
local diagnostic_ok_u_h = { ctermfg = C.green.cterm, fg = C.green.gui, underline = true }
local diagnostic_error_h = { ctermfg = C.red.cterm,
fg = C.red.gui }
local diagnostic_warn_h = { ctermfg = C.orange.cterm,
fg = C.orange.gui }
local diagnostic_info_h = { ctermfg = C.blue.cterm,
fg = C.blue.gui }
local diagnostic_hint_h = { ctermfg = C.white.cterm,
fg = C.white.gui }
local diagnostic_ok_h = { ctermfg = C.green.cterm,
fg = C.green.gui }
local diagnostic_error_u_h = { ctermfg = C.red.cterm,
fg = C.red.gui,
underline = true }
local diagnostic_warn_u_h = { ctermfg = C.orange.cterm,
fg = C.orange.gui,
underline = true }
local diagnostic_info_u_h = { ctermfg = C.blue.cterm,
fg = C.blue.gui,
underline = true }
local diagnostic_hint_u_h = { ctermfg = C.white.cterm,
fg = C.white.gui,
underline = true }
local diagnostic_ok_u_h = { ctermfg = C.green.cterm,
fg = C.green.gui,
underline = true }
set_hl("DiagnosticError", diagnostic_error_h)
set_hl("DiagnosticWarn", diagnostic_warn_h)
@ -268,23 +285,36 @@ set_hl("DiagnosticUnnecessary", diagnostic_hint_u_h)
set_hl("Directory", { ctermfg = C.blue.cterm, fg = C.blue.gui })
-- syntax ----------------------------------------------------------------------
local syntax_normal_h = {}
local syntax_comment_h = { ctermfg = C.blue.cterm, fg = C.blue.gui }
local syntax_constant_h = { ctermfg = C.red.cterm, fg = C.red.gui }
local syntax_normal_h = {}
local syntax_comment_h = { ctermfg = C.blue.cterm,
fg = C.blue.gui }
local syntax_constant_h = { ctermfg = C.red.cterm,
fg = C.red.gui }
local syntax_identifier_h = {}
local syntax_statement_h = { ctermfg = C.orange.cterm, fg = C.orange.gui }
local syntax_preproc_h = { ctermfg = C.magenta.cterm, fg = C.magenta.gui }
local syntax_type_h = { ctermfg = C.green.cterm, fg = C.green.gui }
local syntax_special_h = { ctermfg = C.orange.cterm, fg = C.orange.gui }
local syntax_underline_h = { underline = true }
local syntax_ignore_h = { ctermfg = C.black.cterm, fg = C.black.gui }
local syntax_error_h = { ctermfg = C.black.cterm, fg = C.black.gui, ctermbg = C.red.cterm, bg = C.red.gui }
local syntax_warn_h = { ctermfg = C.black.cterm, fg = C.black.gui, ctermbg = C.orange.cterm, bg = C.orange.gui }
local syntax_italic_h = { italic = true }
local syntax_bold_h = { bold = true }
local syntax_bolditalic_h = { bold = true, italic = true }
local syntax_strike_h = { strikethrough = true }
local syntax_statement_h = { ctermfg = C.orange.cterm,
fg = C.orange.gui }
local syntax_preproc_h = { ctermfg = C.magenta.cterm,
fg = C.magenta.gui }
local syntax_type_h = { ctermfg = C.green.cterm,
fg = C.green.gui }
local syntax_special_h = { ctermfg = C.orange.cterm,
fg = C.orange.gui }
local syntax_underline_h = { underline = true }
local syntax_ignore_h = { ctermfg = C.black.cterm,
fg = C.black.gui }
local syntax_error_h = { ctermfg = C.black.cterm,
fg = C.black.gui,
ctermbg = C.red.cterm,
bg = C.red.gui }
local syntax_warn_h = { ctermfg = C.black.cterm,
fg = C.black.gui,
ctermbg = C.orange.cterm,
bg = C.orange.gui }
local syntax_italic_h = { italic = true }
local syntax_bold_h = { bold = true }
local syntax_bolditalic_h = { bold = true,
italic = true }
local syntax_strike_h = { strikethrough = true }
set_hl("Comment", syntax_comment_h)
set_hl("Constant", syntax_constant_h)
@ -328,9 +358,13 @@ set_hl("BoldItalic", syntax_bolditalic_h)
set_hl("Strike", syntax_strike_h)
-- markdown --------------------------------------------------------------------
local markdown_label_h = { ctermfg = C.magenta.cterm, fg = C.magenta.gui }
local markdown_delimiter_h = { ctermfg = C.blue.cterm, fg = C.blue.gui }
local markdown_underline_h = { ctermfg = C.blue.cterm, fg = C.blue.gui, underline = true }
local markdown_label_h = { ctermfg = C.magenta.cterm,
fg = C.magenta.gui }
local markdown_delimiter_h = { ctermfg = C.blue.cterm,
fg = C.blue.gui }
local markdown_underline_h = { ctermfg = C.blue.cterm,
fg = C.blue.gui,
underline = true }
set_hl("markdownLabel", markdown_label_h)
set_hl("markdownHeadingDelimiter", markdown_delimiter_h)
@ -343,5 +377,6 @@ set_hl("markdownLinkTextDelimiter", markdown_delimiter_h)
set_hl("markdownLinkDelimiter", markdown_delimiter_h)
set_hl("markdownUrl", markdown_delimiter_h)
-- yaml ------------------------------------------------------------------------
set_hl("yamlBlockMappingKey", syntax_comment_h)
set_hl("yamlPlainScalar", syntax_constant_h)

View File

@ -2,31 +2,42 @@ local opt, api, cmd = vim.opt, vim.api, vim.cmd
local fn, ui = vim.fn, vim.ui
-- colorscheme -----------------------------------------------------------------
cmd.colorscheme("basic")
-- options ---------------------------------------------------------------------
opt.undofile = true
opt.backup = false
opt.writebackup = false
opt.mouse = "nvi"
opt.title = true
opt.shortmess:append({ I = true })
opt.number = true
opt.relativenumber = true
opt.signcolumn = "number"
opt.textwidth = 80
opt.colorcolumn = "+1"
opt.expandtab = true
opt.tabstop = 4
opt.shiftwidth = 4
opt.softtabstop = -1
opt.smarttab = true
opt.showtabline = 2
opt.winbar = "%f%( %h%m%r%y%)"
opt.laststatus = 3
opt.ignorecase = true
opt.infercase = true
opt.smartcase = true
opt.smartindent = true
opt.clipboard = "unnamedplus"
opt.wildoptions = { "fuzzy" }
opt.wildignorecase = true
opt.path = ".,,**"
opt.completeopt = { "menuone", "preview" }
opt.scrolloff = 10
-- statusline ------------------------------------------------------------------
function _G.statusline()
local wordcount = fn.wordcount()
@ -40,39 +51,21 @@ function _G.statusline()
end
opt.statusline = "%!v:lua.statusline()"
opt.ignorecase = true
opt.infercase = true
opt.smartcase = true
opt.smartindent = true
opt.clipboard = "unnamedplus"
opt.wildoptions = { "fuzzy" }
opt.wildignorecase = true
opt.path = ".,,**"
opt.completeopt = { "menuone", "preview", }
-- keymaps ---------------------------------------------------------------------
local keymap_set = vim.keymap.set
keymap_set("n", "<esc>", "<cmd>nohlsearch<cr>")
keymap_set("c", "<m-h>", "<left>")
keymap_set("c", "<m-l>", "<right>")
keymap_set("n", "<leader>f", ":find ")
keymap_set("n", "<leader>b", ":buffer ")
keymap_set("n", "<leader>h", ":help ")
keymap_set("n", "<leader>g", ":vimgrep /")
keymap_set("n", "<leader>s", "<cmd>:set spell!<cr>")
keymap_set("n", "<leader>m", "<cmd>make<cr>")
keymap_set("n", "<leader>d", "<cmd>enew<cr><cmd>bdelete#<cr>")
keymap_set("n", "<leader>D", "<cmd>bdelete<cr>")
keymap_set("n", "<leader>d", "<cmd>bdelete<cr>")
keymap_set("n", "]b", "<cmd>bnext<cr>")
keymap_set("n", "[b", "<cmd>bprev<cr>")
keymap_set("n", "]B", "<cmd>blast<cr>")
@ -85,15 +78,10 @@ keymap_set("n", "]q", "<cmd>cnext<cr>zz")
keymap_set("n", "[q", "<cmd>cprev<cr>zz")
keymap_set("n", "]Q", "<cmd>clast<cr>zz")
keymap_set("n", "[Q", "<cmd>cfirst<cr>zz")
keymap_set("n", "<leader>co", "<cmd>copen<cr>")
keymap_set("n", "<leader>cc", "<cmd>cclose<cr>")
keymap_set("i", "<c-f>", "<c-x><c-f>")
keymap_set("n", "<c-h>", "<c-w>h")
keymap_set("n", "<c-j>", "<c-w>j")
keymap_set("n", "<c-k>", "<c-w>k")
keymap_set("n", "<c-l>", "<c-w>l")
keymap_set("n", "<leader>.", "<cmd>e.<cr>")