1
0
Fork 0

update `nvim`

urosm 2024-07-05 17:00:27 +02:00
parent 1f12d578b5
commit 7ba07ed004
6 changed files with 250 additions and 236 deletions

View File

@ -0,0 +1,2 @@
-- treesitter
vim.treesitter.start()

View File

@ -1,6 +1,7 @@
local optl = vim.opt_local
-- options
optl.omnifunc = "v:lua.vim.lua_omnifunc"
optl.tabstop = 2
optl.shiftwidth = 2
optl.expandtab = true

View File

@ -1,4 +1,3 @@
local api = vim.api
local optl = vim.opt_local
-- options
@ -8,20 +7,5 @@ optl.expandtab = true
-- keymaps
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
})
keymap_set({ "n", "v" }, "]h", "/\\_^#.*\\ze\\n\\{2}<esc>")
keymap_set({ "n", "v" }, "[h", "?\\_^#.*\\ze\\n\\{2}<esc>")

View File

@ -0,0 +1,3 @@
local keymap_set = vim.keymap.set
keymap_set("n", "<esc>", "<cmd>Rexplore<cr>", { buffer = true})
keymap_set("n", "<leader>.", "<cmd>Rexplore<cr>", { buffer = true })

View File

@ -1,7 +1,19 @@
-- basic neovim colorscheme template
--
-- A simple neovim colorscheme template that defines highlight groups
-- from a list of 8 colors.
-- Name: basic
-- Description: a basic colorscheme
-- Author: urosm <urosm@kompot.si>
-- Maintainer: urosm <https://git.kompot.si/urosm/dot/src/branch/main/.config/nvim/colors/basic.lua>
-- Website: https://git.kompot.si/urosm/dot/src/branch/main/.config/nvim/colors/basic.lua
-- License: Same as Vim
-- Last Updated: 2024 Jun 19
-- A simple neovim colorscheme that defines highlight groups from a list of 8
-- colors.
-- init ------------------------------------------------------------------------
vim.cmd.highlight("clear")
vim.g.colors_name = "basic"
local hi = function(name, val) vim.api.nvim_set_hl(0, name, val) end
-- colors ----------------------------------------------------------------------
local C = {
@ -23,65 +35,38 @@ local C = {
bright_white = { cterm = 15, gui = "#ffffff" },
}
vim.g.terminal_color_0 = "#000000"
vim.g.terminal_color_1 = "#fa3500"
vim.g.terminal_color_2 = "#009843"
vim.g.terminal_color_3 = "#d06600"
vim.g.terminal_color_4 = "#856cff"
vim.g.terminal_color_5 = "#ff1170"
vim.g.terminal_color_6 = "#008cca"
vim.g.terminal_color_7 = "#e2e2e2"
vim.g.terminal_color_8 = "#848484"
vim.g.terminal_color_9 = "#ff888e"
vim.g.terminal_color_10 = "#00c55b"
vim.g.terminal_color_11 = "#ff8d48"
vim.g.terminal_color_12 = "#ac9fff"
vim.g.terminal_color_13 = "#ffb1c0"
vim.g.terminal_color_14 = "#92ccff"
vim.g.terminal_color_15 = "#ffffff"
-- init ------------------------------------------------------------------------
vim.cmd.highlight("clear")
if vim.fn.exists("syntax_on") then
vim.cmd.syntax("reset")
end
vim.opt.background = "dark"
vim.g.colors_name = "basic"
-- highlights ------------------------------------------------------------------
local fg = C.white
local bg = C.black
local accent = C.magenta
local dimmed = C.blue
local nvim_set_hl = vim.api.nvim_set_hl
local function set_hl(group, def) nvim_set_hl(0, group, def) end
-- normal ----------------------------------------------------------------------
local normal_h = {}
set_hl("Normal", normal_h)
set_hl("NormalNC", normal_h)
hi("Normal", normal_h)
hi("NormalNC", normal_h)
-- tui -------------------------------------------------------------------------
local tui_normal_h = {}
local tui_accent_h = { ctermfg = accent.cterm, fg = accent.gui }
local tui_dimmed_h = { ctermfg = dimmed.cterm, fg = dimmed.gui }
set_hl("StatusLine", tui_dimmed_h)
set_hl("StatusLineNC", tui_dimmed_h)
set_hl("TabLine", tui_dimmed_h)
set_hl("TabLineFill", tui_dimmed_h)
set_hl("TabLineSel", tui_accent_h)
set_hl("WinBar", tui_accent_h)
set_hl("WinBarNC", tui_dimmed_h)
set_hl("WinSeparator", tui_dimmed_h)
set_hl("LineNr", tui_accent_h)
set_hl("LineNrAbove", tui_dimmed_h)
set_hl("LineNrBelow", tui_dimmed_h)
set_hl("SignColumn", tui_dimmed_h)
set_hl("FoldColumn", tui_dimmed_h)
set_hl("WildMenu", tui_accent_h)
hi("StatusLine", tui_dimmed_h)
hi("StatusLineNC", tui_dimmed_h)
hi("TabLine", tui_dimmed_h)
hi("TabLineFill", tui_dimmed_h)
hi("TabLineSel", tui_accent_h)
hi("WinBar", tui_accent_h)
hi("WinBarNC", tui_dimmed_h)
hi("WinSeparator", tui_dimmed_h)
hi("LineNr", tui_accent_h)
hi("LineNrAbove", tui_dimmed_h)
hi("LineNrBelow", tui_dimmed_h)
hi("SignColumn", tui_dimmed_h)
hi("FoldColumn", tui_dimmed_h)
hi("WildMenu", tui_accent_h)
-- float -----------------------------------------------------------------------
local float_normal_h = { ctermfg = bg.cterm,
@ -97,9 +82,9 @@ local float_accent_h = { ctermfg = accent.cterm,
ctermbg = fg.cterm,
bg = fg.gui }
set_hl("NormalFloat", float_normal_h)
set_hl("FloatBorder", float_dimmed_h)
set_hl("FloatTitle", float_accent_h)
hi("NormalFloat", float_normal_h)
hi("FloatBorder", float_dimmed_h)
hi("FloatTitle", float_accent_h)
-- menu ------------------------------------------------------------------------
local menu_normal_h = { ctermfg = accent.cterm,
@ -112,14 +97,14 @@ local menu_accent_h = { ctermfg = accent.cterm,
bg = fg.gui,
reverse = true }
set_hl("Pmenu", menu_normal_h)
set_hl("PmenuSel", menu_accent_h)
set_hl("PmenuKind", menu_normal_h)
set_hl("PmenuKindSel", menu_accent_h)
set_hl("PmenuExtra", menu_normal_h)
set_hl("PmenuExtraSel", menu_accent_h)
set_hl("PmenuSbar", menu_normal_h)
set_hl("PmenuThumb", menu_accent_h)
hi("Pmenu", menu_normal_h)
hi("PmenuSel", menu_accent_h)
hi("PmenuKind", menu_normal_h)
hi("PmenuKindSel", menu_accent_h)
hi("PmenuExtra", menu_normal_h)
hi("PmenuExtraSel", menu_accent_h)
hi("PmenuSbar", menu_normal_h)
hi("PmenuThumb", menu_accent_h)
-- messages --------------------------------------------------------------------
local message_normal_h = {}
@ -127,14 +112,14 @@ local message_accent_h = { ctermfg = accent.cterm, fg = accent.gui }
local message_error_h = { ctermfg = C.red.cterm, fg = C.red.gui }
local message_warn_h = { ctermfg = C.orange.cterm, fg = C.orange.gui }
set_hl("MsgArea", message_normal_h)
set_hl("MsgSeparator", message_normal_h)
set_hl("ModeMsg", message_accent_h)
set_hl("MoreMsg", message_accent_h)
set_hl("WarningMsg", message_warn_h)
set_hl("ErrorMsg", message_error_h)
set_hl("Question", message_accent_h)
set_hl("Title", message_accent_h)
hi("MsgArea", message_normal_h)
hi("MsgSeparator", message_normal_h)
hi("ModeMsg", message_accent_h)
hi("MoreMsg", message_accent_h)
hi("WarningMsg", message_warn_h)
hi("ErrorMsg", message_error_h)
hi("Question", message_accent_h)
hi("Title", message_accent_h)
-- buffer ----------------------------------------------------------------------
local buffer_dimmed_h = { ctermfg = dimmed.cterm,
@ -145,28 +130,28 @@ local buffer_dimmed_reverse_h = { ctermfg = dimmed.cterm,
local buffer_accent_h = { ctermfg = accent.cterm,
fg = accent.gui }
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_dimmed_reverse_h)
hi("Conceal", buffer_dimmed_h)
hi("NonText", buffer_dimmed_h)
hi("EndOfBuffer", buffer_dimmed_h)
hi("Whitespace", buffer_dimmed_h)
hi("Folded", buffer_dimmed_h)
hi("SpecialKey", buffer_accent_h)
hi("ColorColumn", buffer_dimmed_reverse_h)
-- cursor ----------------------------------------------------------------------
local cursor_normal_h = { reverse = true }
set_hl("CursorLine", cursor_normal_h)
set_hl("CursorLineNr", cursor_normal_h)
set_hl("CursorLineSign", cursor_normal_h)
set_hl("CursorLineFold", cursor_normal_h)
set_hl("CursorColumn", cursor_normal_h)
set_hl("QuickFixLine", cursor_normal_h)
set_hl("Cursor", cursor_normal_h)
set_hl("lCursor", cursor_normal_h)
set_hl("CursorIM", cursor_normal_h)
set_hl("TermCursor", cursor_normal_h)
set_hl("TermCursorNC", cursor_normal_h)
hi("CursorLine", cursor_normal_h)
hi("CursorLineNr", cursor_normal_h)
hi("CursorLineSign", cursor_normal_h)
hi("CursorLineFold", cursor_normal_h)
hi("CursorColumn", cursor_normal_h)
hi("QuickFixLine", cursor_normal_h)
hi("Cursor", cursor_normal_h)
hi("lCursor", cursor_normal_h)
hi("CursorIM", cursor_normal_h)
hi("TermCursor", cursor_normal_h)
hi("TermCursorNC", cursor_normal_h)
-- match -----------------------------------------------------------------------
local match_normal_h = { ctermfg = C.black.cterm,
@ -182,11 +167,11 @@ local match_parens_h = { ctermfg = C.magenta.cterm,
ctermbg = C.white.cterm,
bg = C.white.gui }
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_parens_h)
hi("Search", match_normal_h)
hi("Substitute", match_normal_h)
hi("IncSearch", match_accent_h)
hi("CurSearch", match_accent_h)
hi("MatchParen", match_parens_h)
-- selection -------------------------------------------------------------------
local selection_normal_h = { ctermfg = C.black.cterm,
@ -194,8 +179,8 @@ local selection_normal_h = { ctermfg = C.black.cterm,
ctermbg = C.blue.cterm,
bg = C.blue.gui }
set_hl("Visual", selection_normal_h)
set_hl("Visualnos", selection_normal_h)
hi("Visual", selection_normal_h)
hi("Visualnos", selection_normal_h)
-- diff ------------------------------------------------------------------------
local diff_add_h = { ctermfg = C.green.cterm,
@ -208,10 +193,10 @@ 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)
set_hl("DiffDelete", diff_delete_h)
set_hl("DiffText", diff_text_h)
hi("DiffAdd", diff_add_h)
hi("DiffChange", diff_change_h)
hi("DiffDelete", diff_delete_h)
hi("DiffText", diff_text_h)
-- spell -----------------------------------------------------------------------
local spell_error_h = { ctermfg = C.red.cterm,
@ -221,10 +206,10 @@ 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)
set_hl("SpellLocal", spell_warn_h)
set_hl("SpellRare", spell_warn_h)
hi("SpellBad", spell_error_h)
hi("SpellCap", spell_warn_h)
hi("SpellLocal", spell_warn_h)
hi("SpellRare", spell_warn_h)
-- diagnostic ------------------------------------------------------------------
local diagnostic_error_h = { ctermfg = C.red.cterm,
@ -253,36 +238,36 @@ 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)
set_hl("DiagnosticInfo", diagnostic_info_h)
set_hl("DiagnosticHint", diagnostic_hint_h)
set_hl("DiagnosticOk", diagnostic_ok_h)
set_hl("DiagnosticVirtualError", diagnostic_error_h)
set_hl("DiagnosticVirtualWarn", diagnostic_warn_h)
set_hl("DiagnosticVirtualInfo", diagnostic_info_h)
set_hl("DiagnosticVirtualHint", diagnostic_hint_h)
set_hl("DiagnosticVirtualOk", diagnostic_ok_h)
set_hl("DiagnosticUnderlineError", diagnostic_error_u_h)
set_hl("DiagnosticUnderlineWarn", diagnostic_warn_u_h)
set_hl("DiagnosticUnderlineInfo", diagnostic_info_u_h)
set_hl("DiagnosticUnderlineHint", diagnostic_hint_u_h)
set_hl("DiagnosticUnderlineOk", diagnostic_ok_u_h)
set_hl("DiagnosticFloatingError", diagnostic_error_h)
set_hl("DiagnosticFloatingWarn", diagnostic_warn_h)
set_hl("DiagnosticFloatingInfo", diagnostic_info_h)
set_hl("DiagnosticFloatingHint", diagnostic_hint_h)
set_hl("DiagnosticFloatingOk", diagnostic_ok_h)
set_hl("DiagnosticSingError", diagnostic_error_h)
set_hl("DiagnosticSingWarn", diagnostic_warn_h)
set_hl("DiagnosticSingInfo", diagnostic_info_h)
set_hl("DiagnosticSingHint", diagnostic_hint_h)
set_hl("DiagnosticSingOk", diagnostic_ok_h)
set_hl("DiagnosticDeprecated", diagnostic_hint_u_h)
set_hl("DiagnosticUnnecessary", diagnostic_hint_u_h)
hi("DiagnosticError", diagnostic_error_h)
hi("DiagnosticWarn", diagnostic_warn_h)
hi("DiagnosticInfo", diagnostic_info_h)
hi("DiagnosticHint", diagnostic_hint_h)
hi("DiagnosticOk", diagnostic_ok_h)
hi("DiagnosticVirtualError", diagnostic_error_h)
hi("DiagnosticVirtualWarn", diagnostic_warn_h)
hi("DiagnosticVirtualInfo", diagnostic_info_h)
hi("DiagnosticVirtualHint", diagnostic_hint_h)
hi("DiagnosticVirtualOk", diagnostic_ok_h)
hi("DiagnosticUnderlineError", diagnostic_error_u_h)
hi("DiagnosticUnderlineWarn", diagnostic_warn_u_h)
hi("DiagnosticUnderlineInfo", diagnostic_info_u_h)
hi("DiagnosticUnderlineHint", diagnostic_hint_u_h)
hi("DiagnosticUnderlineOk", diagnostic_ok_u_h)
hi("DiagnosticFloatingError", diagnostic_error_h)
hi("DiagnosticFloatingWarn", diagnostic_warn_h)
hi("DiagnosticFloatingInfo", diagnostic_info_h)
hi("DiagnosticFloatingHint", diagnostic_hint_h)
hi("DiagnosticFloatingOk", diagnostic_ok_h)
hi("DiagnosticSingError", diagnostic_error_h)
hi("DiagnosticSingWarn", diagnostic_warn_h)
hi("DiagnosticSingInfo", diagnostic_info_h)
hi("DiagnosticSingHint", diagnostic_hint_h)
hi("DiagnosticSingOk", diagnostic_ok_h)
hi("DiagnosticDeprecated", diagnostic_hint_u_h)
hi("DiagnosticUnnecessary", diagnostic_hint_u_h)
-- misc ------------------------------------------------------------------------
set_hl("Directory", { ctermfg = C.blue.cterm, fg = C.blue.gui })
hi("Directory", { ctermfg = C.blue.cterm, fg = C.blue.gui })
-- syntax ----------------------------------------------------------------------
local syntax_normal_h = {}
@ -316,46 +301,46 @@ 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)
set_hl("String", syntax_constant_h)
set_hl("Character", syntax_constant_h)
set_hl("Number", syntax_constant_h)
set_hl("Boolean", syntax_constant_h)
set_hl("Float", syntax_constant_h)
set_hl("Identifier", syntax_identifier_h)
set_hl("Function", syntax_identifier_h)
set_hl("Statement", syntax_statement_h)
set_hl("Conditional", syntax_statement_h)
set_hl("Repeat", syntax_statement_h)
set_hl("Label", syntax_statement_h)
set_hl("Operator", syntax_statement_h)
set_hl("Keyword", syntax_statement_h)
set_hl("Exception", syntax_statement_h)
set_hl("PreProc", syntax_preproc_h)
set_hl("Include", syntax_preproc_h)
set_hl("Define", syntax_preproc_h)
set_hl("Macro", syntax_preproc_h)
set_hl("PreCondit", syntax_preproc_h)
set_hl("Type", syntax_type_h)
set_hl("StorageClass", syntax_type_h)
set_hl("Structure", syntax_type_h)
set_hl("Typedef", syntax_type_h)
set_hl("Special", syntax_special_h)
set_hl("SpecialChar", syntax_special_h)
set_hl("Tag", syntax_special_h)
set_hl("Delimiter", syntax_special_h)
set_hl("SpecialComment", syntax_special_h)
set_hl("Debug", syntax_special_h)
set_hl("Underlined", syntax_underline_h)
set_hl("Ignore", syntax_ignore_h)
set_hl("Error", syntax_error_h)
set_hl("Todo", syntax_warn_h)
hi("Comment", syntax_comment_h)
hi("Constant", syntax_constant_h)
hi("String", syntax_constant_h)
hi("Character", syntax_constant_h)
hi("Number", syntax_constant_h)
hi("Boolean", syntax_constant_h)
hi("Float", syntax_constant_h)
hi("Identifier", syntax_identifier_h)
hi("Function", syntax_identifier_h)
hi("Statement", syntax_statement_h)
hi("Conditional", syntax_statement_h)
hi("Repeat", syntax_statement_h)
hi("Label", syntax_statement_h)
hi("Operator", syntax_statement_h)
hi("Keyword", syntax_statement_h)
hi("Exception", syntax_statement_h)
hi("PreProc", syntax_preproc_h)
hi("Include", syntax_preproc_h)
hi("Define", syntax_preproc_h)
hi("Macro", syntax_preproc_h)
hi("PreCondit", syntax_preproc_h)
hi("Type", syntax_type_h)
hi("StorageClass", syntax_type_h)
hi("Structure", syntax_type_h)
hi("Typedef", syntax_type_h)
hi("Special", syntax_special_h)
hi("SpecialChar", syntax_special_h)
hi("Tag", syntax_special_h)
hi("Delimiter", syntax_special_h)
hi("SpecialComment", syntax_special_h)
hi("Debug", syntax_special_h)
hi("Underlined", syntax_underline_h)
hi("Ignore", syntax_ignore_h)
hi("Error", syntax_error_h)
hi("Todo", syntax_warn_h)
set_hl("Italic", syntax_italic_h)
set_hl("Bold", syntax_bold_h)
set_hl("BoldItalic", syntax_bolditalic_h)
set_hl("Strike", syntax_strike_h)
hi("Italic", syntax_italic_h)
hi("Bold", syntax_bold_h)
hi("BoldItalic", syntax_bolditalic_h)
hi("Strike", syntax_strike_h)
-- markdown --------------------------------------------------------------------
local markdown_label_h = { ctermfg = C.magenta.cterm,
@ -366,17 +351,17 @@ 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)
set_hl("markdownItalicDelimiter", markdown_delimiter_h)
set_hl("markdownBoldDelimiter", markdown_delimiter_h)
set_hl("markdownBoldItalicDelimiter", markdown_delimiter_h)
set_hl("markdownStrikeDelimiter", markdown_delimiter_h)
set_hl("markdownCodeDelimiter", markdown_delimiter_h)
set_hl("markdownLinkTextDelimiter", markdown_delimiter_h)
set_hl("markdownLinkDelimiter", markdown_delimiter_h)
set_hl("markdownUrl", markdown_delimiter_h)
hi("markdownLabel", markdown_label_h)
hi("markdownHeadingDelimiter", markdown_delimiter_h)
hi("markdownItalicDelimiter", markdown_delimiter_h)
hi("markdownBoldDelimiter", markdown_delimiter_h)
hi("markdownBoldItalicDelimiter", markdown_delimiter_h)
hi("markdownStrikeDelimiter", markdown_delimiter_h)
hi("markdownCodeDelimiter", markdown_delimiter_h)
hi("markdownLinkTextDelimiter", markdown_delimiter_h)
hi("markdownLinkDelimiter", markdown_delimiter_h)
hi("markdownUrl", markdown_delimiter_h)
-- yaml ------------------------------------------------------------------------
set_hl("yamlBlockMappingKey", syntax_comment_h)
set_hl("yamlPlainScalar", syntax_constant_h)
hi("yamlBlockMappingKey", syntax_comment_h)
hi("yamlPlainScalar", syntax_constant_h)

View File

@ -1,55 +1,81 @@
local opt, api, cmd = vim.opt, vim.api, vim.cmd
local fn, ui = vim.fn, vim.ui
local opt, cmd, api = vim.opt, vim.cmd, vim.api
local fn = vim.fn
local v, g = vim.v, vim.g
-- 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()
function Statusline()
local wordcount = fn.wordcount()
return table.concat({
fn.pathshorten(fn.getcwd()),
" %=",
" <%b> ",
wordcount.visual_chars or wordcount.cursor_chars, "/", wordcount.chars, " ",
wordcount.visual_words or wordcount.cursor_words, "/", wordcount.words
" <%b>",
" ", wordcount.visual_chars or wordcount.cursor_chars, "/", wordcount.chars,
" ", wordcount.visual_words or wordcount.cursor_words, "/", wordcount.words,
" %l/%L",
" %c"
})
end
opt.statusline = "%!v:lua.statusline()"
-- options ---------------------------------------------------------------------
-- moving around, searching and patterns
opt.path = {".", "", "**"}
opt.ignorecase = true
opt.smartcase = true
-- displaying text
opt.scrolloff = 10
opt.breakindent = true
opt.showbreak = "+++ "
opt.number = true
opt.relativenumber = true
opt.colorcolumn = "+1"
-- multiple windows
opt.laststatus = 3
opt.statusline = "%!v:lua.Statusline()"
-- multiple tab pages
opt.showtabline = 2
-- terminal
opt.title = true
-- messages and info
opt.shortmess:append({ I = true })
-- selecting text
opt.clipboard = "unnamedplus"
-- editing text
opt.undofile = true
opt.textwidth = 80
opt.completeopt = { "menuone", "preview", "noselect" }
-- tabs and indenting
opt.tabstop = 4
opt.shiftwidth = 4
opt.smarttab = true
opt.softtabstop = -1
opt.expandtab = true
opt.smartindent = true
-- reading and writing files
opt.writebackup = false
opt.backup = false
-- command line editing
opt.wildignorecase = true
-- various
opt.signcolumn = "number"
opt.winbar = "%f%( %h%m%r%y%)"
opt.wildoptions = { "fuzzy" }
-- keymaps ---------------------------------------------------------------------
@ -84,4 +110,17 @@ 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>")
keymap_set("n", "<leader>.", "<cmd>edit.<cr>")
-- buffer autocomplete ---------------------------------------------------------
api.nvim_create_autocmd("InsertCharPre", {
group = api.nvim_create_augroup("Buffer autocompletion", {}),
desc = "Buffer autocomplete on InsertCharPre",
callback = function ()
if fn.pumvisible() == 0 and v.char:find("%w") then
api.nvim_input("<c-n>")
end
end
})