.config/nvim: update
parent
8823d1540f
commit
af00b2ecf8
|
@ -1,4 +1,6 @@
|
|||
local optl = vim.opt_local
|
||||
|
||||
-- options
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.expandtab = true
|
||||
optl.tabstop = 2
|
||||
optl.shiftwidth = 2
|
||||
optl.expandtab = true
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
local optl = vim.opt_local
|
||||
|
||||
-- options
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.expandtab = true
|
||||
optl.tabstop = 2
|
||||
optl.shiftwidth = 2
|
||||
optl.expandtab = true
|
||||
|
||||
-- treesitter
|
||||
vim.treesitter.start()
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
local optl = vim.opt_local
|
||||
|
||||
-- options
|
||||
vim.bo.tabstop = 2
|
||||
vim.bo.shiftwidth = 2
|
||||
vim.bo.expandtab = true
|
||||
optl.tabstop = 2
|
||||
optl.shiftwidth = 2
|
||||
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>", {})
|
||||
keymap_set("n", "]h", "/\\_^#.*\\ze\\n\\{2}<esc>")
|
||||
keymap_set("n", "[h", "?\\_^#.*\\ze\\n\\{2}<esc>")
|
||||
|
|
|
@ -7,7 +7,7 @@ syntax clear markdownYamlHead
|
|||
syntax region markdownYamlHead start="^-\{3}\n\S" end="\S\n\%(-\|\.\)\{3}$" keepend contains=@markdownYamlTop,@Spell
|
||||
|
||||
" citation
|
||||
syntax match markdownPCite "\^\@<!\[[^\[\]]\{-}-\{0,1}@[[:alnum:]_][[:digit:][:lower:][:upper:]_:.#$%&\-+?<>~/]*\_.\{-}\]" contains=@markdownInline,markdownCiteKey
|
||||
syntax match markdownPCite "\^\@<!\[\_[^\[\]]\{-}-\{0,1}@[[:alnum:]_][[:digit:][:lower:][:upper:]_:.#$%&\-+?<>~/]*\_.\{-}\]" contains=@markdownInline,markdownCiteKey
|
||||
syn match markdownICite "@[[:alnum:]_][[:digit:][:lower:][:upper:]_:.#$%&\-+?<>~/]*\s\[.\{-1,}\]" contains=markdownCiteKey,@Spell display
|
||||
syn match markdownCiteKey /\(-\=@[[:alnum:]_][[:digit:][:lower:][:upper:]_:.#$%&\-+?<>~/]*\)/ containedin=markdownPCite,markdownICite contains=@NoSpell display
|
||||
|
||||
|
@ -17,5 +17,3 @@ hi def link markdownCiteKey markdownLabel
|
|||
hi def link markdownLabel Label
|
||||
|
||||
let b:current_syntax = "markdown"
|
||||
|
||||
" vim:set sw=2:
|
||||
|
|
|
@ -276,7 +276,7 @@ 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 = { ctermfg = C.blue.cterm, fg = C.blue.gui, underline = true }
|
||||
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 }
|
||||
|
@ -339,6 +339,9 @@ 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)
|
||||
|
||||
set_hl("yamlBlockMappingKey", syntax_comment_h)
|
||||
set_hl("yamlPlainScalar", syntax_constant_h)
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
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 = {}
|
||||
opt.mouse = "nvi"
|
||||
opt.title = true
|
||||
|
||||
opt.shortmess:append({ I = true })
|
||||
|
@ -19,7 +20,7 @@ opt.colorcolumn = "+1"
|
|||
|
||||
opt.expandtab = true
|
||||
opt.tabstop = 4
|
||||
opt.shiftwidth = 2
|
||||
opt.shiftwidth = 4
|
||||
opt.softtabstop = -1
|
||||
opt.smarttab = true
|
||||
|
||||
|
@ -27,19 +28,10 @@ opt.showtabline = 2
|
|||
opt.winbar = "%f%( %h%m%r%y%)"
|
||||
opt.laststatus = 3
|
||||
|
||||
local statusline_group = api.nvim_create_augroup("Statusline", {})
|
||||
local cwd = fn.pathshorten(vim.fn.getcwd())
|
||||
api.nvim_create_autocmd({ "DirChanged" }, {
|
||||
group = statusline_group,
|
||||
callback = function()
|
||||
cwd = fn.pathshorten(vim.fn.getcwd())
|
||||
end
|
||||
})
|
||||
|
||||
function _G.statusline()
|
||||
local wordcount = fn.wordcount()
|
||||
return table.concat({
|
||||
cwd,
|
||||
fn.pathshorten(fn.getcwd()),
|
||||
" %=",
|
||||
" <%b> ",
|
||||
wordcount.visual_chars or wordcount.cursor_chars, "/", wordcount.chars, " ",
|
||||
|
@ -53,102 +45,55 @@ opt.infercase = true
|
|||
opt.smartcase = true
|
||||
opt.smartindent = true
|
||||
opt.clipboard = "unnamedplus"
|
||||
opt.whichwrap = {
|
||||
["b"] = true,
|
||||
["s"] = true,
|
||||
["h"] = true,
|
||||
["l"] = true,
|
||||
["<"] = true,
|
||||
[">"] = true,
|
||||
["~"] = true,
|
||||
["["] = true,
|
||||
["]"] = true
|
||||
}
|
||||
opt.wildoptions = { "fuzzy" }
|
||||
opt.wildignorecase = true
|
||||
|
||||
|
||||
opt.path = ".,,**"
|
||||
|
||||
opt.completeopt = {
|
||||
"menuone",
|
||||
"preview",
|
||||
}
|
||||
|
||||
local terminal_group = api.nvim_create_augroup("Terminal", {})
|
||||
api.nvim_create_autocmd({ "TermOpen" }, {
|
||||
group = terminal_group,
|
||||
callback = function()
|
||||
local opt_l = vim.opt_local
|
||||
opt_l.number = false
|
||||
opt_l.relativenumber = false
|
||||
end
|
||||
})
|
||||
opt.completeopt = { "menuone", "preview", }
|
||||
|
||||
-- keymaps ---------------------------------------------------------------------
|
||||
local keymap_set = vim.keymap.set
|
||||
|
||||
keymap_set("n", "<esc>", function()
|
||||
cmd.nohlsearch()
|
||||
end, { desc = "Stop the highlighting for the 'hlsearch' option" })
|
||||
keymap_set("n", "<esc>", "<cmd>nohlsearch<cr>")
|
||||
|
||||
keymap_set("c", "<m-h>", "<left>", { desc = "Left in c-mode" })
|
||||
keymap_set("c", "<m-l>", "<right>", { desc = "Right in c-mode" })
|
||||
keymap_set("c", "<m-h>", "<left>")
|
||||
keymap_set("c", "<m-l>", "<right>")
|
||||
|
||||
keymap_set("n", "<leader>f", ":find ", { desc = ":find" })
|
||||
keymap_set("n", "<leader>b", ":buffer ", { desc = ":buffer" })
|
||||
keymap_set("n", "<leader>h", ":help ", { desc = ":help" })
|
||||
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", function()
|
||||
vim.opt_local.spell = not(vim.opt_local.spell:get())
|
||||
end, { desc = "Toggle spell" })
|
||||
keymap_set("n", "<leader>s", "<cmd>:set spell!<cr>")
|
||||
|
||||
keymap_set("n", "<leader>m", "<cmd>make<cr>", { desc = ":make" })
|
||||
keymap_set("n", "<leader>m", "<cmd>make<cr>")
|
||||
|
||||
keymap_set("n", "<leader>d", "<cmd>enew<cr><cmd>bd #<cr>", { desc = "Delete buffer" })
|
||||
keymap_set("n", "<leader>D", "<cmd>bd<cr>", { desc = "Delete buffer and close window" })
|
||||
keymap_set("n", "<leader>d", "<cmd>enew<cr><cmd>bdelete#<cr>")
|
||||
keymap_set("n", "<leader>D", "<cmd>bdelete<cr>")
|
||||
|
||||
keymap_set("n", "]b", "<cmd>bnext<cr>", { desc = "Next buffer" })
|
||||
keymap_set("n", "[b", "<cmd>bprev<cr>", { desc = "Previous buffer" })
|
||||
keymap_set("n", "]t", "<cmd>tabnext<cr>", { desc = "Next tab" })
|
||||
keymap_set("n", "[t", "<cmd>tabprevious<cr>", { desc = "Previous tab" })
|
||||
keymap_set("n", "]q", "<cmd>cnext<cr>zz", { desc = "Next quickfix item" })
|
||||
keymap_set("n", "[q", "<cmd>cprev<cr>zz", { desc = "Previous quickfix item" })
|
||||
keymap_set("n", "]b", "<cmd>bnext<cr>")
|
||||
keymap_set("n", "[b", "<cmd>bprev<cr>")
|
||||
keymap_set("n", "]B", "<cmd>blast<cr>")
|
||||
keymap_set("n", "[B", "<cmd>bfirst<cr>")
|
||||
keymap_set("n", "]t", "<cmd>tabnext<cr>")
|
||||
keymap_set("n", "[t", "<cmd>tabprev<cr>")
|
||||
keymap_set("n", "]T", "<cmd>tablast<cr>")
|
||||
keymap_set("n", "[T", "<cmd>tabfirst<cr>")
|
||||
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>", { desc = "Open quickfix window" })
|
||||
keymap_set("n", "<leader>cc", "<cmd>cclose<cr>", { desc = "Close quickfix window" })
|
||||
keymap_set("n", "<leader>co", "<cmd>copen<cr>")
|
||||
keymap_set("n", "<leader>cc", "<cmd>cclose<cr>")
|
||||
|
||||
keymap_set("n", "<leader>g", function()
|
||||
local pattern
|
||||
ui.input({ prompt = ":vimgrep " }, function(input)
|
||||
if not input then return end
|
||||
if input:match("/.+/[gjf]*") then
|
||||
pattern = input
|
||||
else
|
||||
pattern = ("/%s/g"):format(input)
|
||||
end
|
||||
end)
|
||||
if not pattern then return end
|
||||
local file
|
||||
ui.input({
|
||||
prompt = (":vimgrep %s "):format(pattern),
|
||||
default = "**/*"
|
||||
}, function(input)
|
||||
if not input then return end
|
||||
file = input
|
||||
end)
|
||||
if not file then return end
|
||||
cmd.vimgrep(pattern, file)
|
||||
end, { desc = ":vimgrep" })
|
||||
keymap_set("i", "<c-f>", "<c-x><c-f>")
|
||||
|
||||
keymap_set("i", "<c-f>", "<c-x><c-f>", { desc = "File name completion" })
|
||||
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")
|
||||
|
||||
-- netrw -----------------------------------------------------------------------
|
||||
local g = vim.g
|
||||
|
||||
g.netrw_use_errorwindow = 0
|
||||
g.netrw_banner = 0
|
||||
g.netrw_bufsettings = "noma nomod nowrap ro nobl"
|
||||
g.netrw_fastbrowse = 0
|
||||
|
||||
keymap_set("n", "<leader>.", "<cmd>Explore .<cr>",
|
||||
{ desc = "Explore current working directory" })
|
||||
keymap_set("n", "<leader>.", "<cmd>e.<cr>")
|
||||
|
|
Loading…
Reference in New Issue