diff options
Diffstat (limited to 'lua/config')
| -rw-r--r-- | lua/config/bqf.lua | 6 | ||||
| -rw-r--r-- | lua/config/bufferline.lua | 8 | ||||
| -rw-r--r-- | lua/config/dashboard-nvim.lua | 4 | ||||
| -rw-r--r-- | lua/config/fidget-nvim.lua | 2 | ||||
| -rw-r--r-- | lua/config/fugitive.lua | 12 | ||||
| -rw-r--r-- | lua/config/git-linker.lua | 10 | ||||
| -rw-r--r-- | lua/config/gitsigns.lua | 10 | ||||
| -rw-r--r-- | lua/config/hlslens.lua | 22 | ||||
| -rw-r--r-- | lua/config/indent-blankline.lua | 10 | ||||
| -rw-r--r-- | lua/config/iron.lua | 4 | ||||
| -rw-r--r-- | lua/config/lsp.lua | 93 | ||||
| -rw-r--r-- | lua/config/neoscroll.lua | 4 | ||||
| -rw-r--r-- | lua/config/nvim-cmp.lua | 78 | ||||
| -rw-r--r-- | lua/config/nvim-notify.lua | 4 | ||||
| -rw-r--r-- | lua/config/nvim-tree.lua | 11 | ||||
| -rw-r--r-- | lua/config/nvim_hop.lua | 12 | ||||
| -rw-r--r-- | lua/config/statusline.lua | 51 | ||||
| -rw-r--r-- | lua/config/treesitter.lua | 6 | ||||
| -rw-r--r-- | lua/config/which-key.lua | 6 | ||||
| -rw-r--r-- | lua/config/zen-mode.lua | 4 |
20 files changed, 184 insertions, 173 deletions
diff --git a/lua/config/bqf.lua b/lua/config/bqf.lua index bf4bf58..c62a513 100644 --- a/lua/config/bqf.lua +++ b/lua/config/bqf.lua @@ -1,6 +1,6 @@ -require("bqf").setup({ +require("bqf").setup { auto_resize_height = false, preview = { auto_preview = false, - } -}) + }, +} diff --git a/lua/config/bufferline.lua b/lua/config/bufferline.lua index b68cfa8..9089a83 100644 --- a/lua/config/bufferline.lua +++ b/lua/config/bufferline.lua @@ -1,4 +1,4 @@ -require("bufferline").setup({ +require("bufferline").setup { options = { numbers = "buffer_id", close_command = "bdelete! %d", @@ -6,8 +6,8 @@ require("bufferline").setup({ left_mouse_command = "buffer %d", middle_mouse_command = nil, indicator = { - icon = '▎', -- this should be omitted if indicator style is not 'icon' - style = 'icon', + icon = "▎", -- this should be omitted if indicator style is not 'icon' + style = "icon", }, buffer_close_icon = "", modified_icon = "●", @@ -43,4 +43,4 @@ require("bufferline").setup({ always_show_bufferline = true, sort_by = "id", }, -}) +} diff --git a/lua/config/dashboard-nvim.lua b/lua/config/dashboard-nvim.lua index 5dff685..9329953 100644 --- a/lua/config/dashboard-nvim.lua +++ b/lua/config/dashboard-nvim.lua @@ -52,8 +52,8 @@ dashboard.custom_center = { desc = "Quit Nvim ", -- desc = "Quit Nvim ", action = "qa", - shortcut = "q " - } + shortcut = "q ", + }, } vim.cmd([[ diff --git a/lua/config/fidget-nvim.lua b/lua/config/fidget-nvim.lua index 5225f06..945f564 100644 --- a/lua/config/fidget-nvim.lua +++ b/lua/config/fidget-nvim.lua @@ -1 +1 @@ -require"fidget".setup{} +require("fidget").setup {} diff --git a/lua/config/fugitive.lua b/lua/config/fugitive.lua index 40a9208..13ffaff 100644 --- a/lua/config/fugitive.lua +++ b/lua/config/fugitive.lua @@ -1,8 +1,8 @@ local keymap = vim.keymap -keymap.set('n', '<leader>gs', '<cmd>Git<cr>', { desc = 'Git status' }) -keymap.set('n', '<leader>gw', '<cmd>Gwrite<cr>', { desc = 'Git add' }) -keymap.set('n', '<leader>gc', '<cmd>Git commit<cr>', { desc = 'Git commit' }) -keymap.set('n', '<leader>gd', '<cmd>Gdiffsplit<cr>', { desc = 'Git diff' }) -keymap.set('n', '<leader>gpl', '<cmd>Git pull<cr>', { desc = 'Git pull' }) -keymap.set('n', '<leader>gpu', '<cmd>15 split|term git push<cr>', { desc = 'Git push' }) +keymap.set("n", "<leader>gs", "<cmd>Git<cr>", { desc = "Git status" }) +keymap.set("n", "<leader>gw", "<cmd>Gwrite<cr>", { desc = "Git add" }) +keymap.set("n", "<leader>gc", "<cmd>Git commit<cr>", { desc = "Git commit" }) +keymap.set("n", "<leader>gd", "<cmd>Gdiffsplit<cr>", { desc = "Git diff" }) +keymap.set("n", "<leader>gpl", "<cmd>Git pull<cr>", { desc = "Git pull" }) +keymap.set("n", "<leader>gpu", "<cmd>15 split|term git push<cr>", { desc = "Git push" }) diff --git a/lua/config/git-linker.lua b/lua/config/git-linker.lua index f19210b..e2f7607 100644 --- a/lua/config/git-linker.lua +++ b/lua/config/git-linker.lua @@ -1,15 +1,15 @@ local keymap = vim.keymap -local gitlinker = require('gitlinker') +local gitlinker = require("gitlinker") -gitlinker.setup({ +gitlinker.setup { mappings = nil, -}) +} -keymap.set({ 'n', 'v' }, '<leader>gl', '', { +keymap.set({ "n", "v" }, "<leader>gl", "", { silent = true, desc = "get git permlink", callback = function() local mode = string.lower(vim.fn.mode()) gitlinker.get_buf_range_url(mode) - end + end, }) diff --git a/lua/config/gitsigns.lua b/lua/config/gitsigns.lua index 0543412..81f6b57 100644 --- a/lua/config/gitsigns.lua +++ b/lua/config/gitsigns.lua @@ -1,4 +1,4 @@ -local gs = require "gitsigns" +local gs = require("gitsigns") gs.setup { signs = { @@ -25,7 +25,7 @@ gs.setup { gs.next_hunk() end) return "<Ignore>" - end, { expr = true, desc = 'next hunk' }) + end, { expr = true, desc = "next hunk" }) map("n", "[c", function() if vim.wo.diff then @@ -35,10 +35,12 @@ gs.setup { gs.prev_hunk() end) return "<Ignore>" - end, { expr = true, desc = 'previous hunk' }) + end, { expr = true, desc = "previous hunk" }) -- Actions map("n", "<leader>hp", gs.preview_hunk) - map("n", "<leader>hb", function() gs.blame_line { full = true } end) + map("n", "<leader>hb", function() + gs.blame_line { full = true } + end) end, } diff --git a/lua/config/hlslens.lua b/lua/config/hlslens.lua index f5c76ad..13541c4 100644 --- a/lua/config/hlslens.lua +++ b/lua/config/hlslens.lua @@ -1,12 +1,12 @@ local api = vim.api local keymap = vim.keymap -local hlslens = require('hlslens') +local hlslens = require("hlslens") -hlslens.setup({ +hlslens.setup { calm_down = true, nearest_only = true, -}) +} local activate_hlslens = function(direction) local cmd = string.format("normal! %s%szzzv", vim.v.count1, direction) @@ -22,13 +22,17 @@ local activate_hlslens = function(direction) hlslens.start() end -keymap.set('n', 'n', '', { - callback = function() activate_hlslens('n') end +keymap.set("n", "n", "", { + callback = function() + activate_hlslens("n") + end, }) -keymap.set('n', 'N', '', { - callback = function() activate_hlslens('N') end +keymap.set("n", "N", "", { + callback = function() + activate_hlslens("N") + end, }) -keymap.set('n', '*', "<Plug>(asterisk-z*)<Cmd>lua require('hlslens').start()<CR>") -keymap.set('n', '#', "<Plug>(asterisk-z#)<Cmd>lua require('hlslens').start()<CR>") +keymap.set("n", "*", "<Plug>(asterisk-z*)<Cmd>lua require('hlslens').start()<CR>") +keymap.set("n", "#", "<Plug>(asterisk-z#)<Cmd>lua require('hlslens').start()<CR>") diff --git a/lua/config/indent-blankline.lua b/lua/config/indent-blankline.lua index 597b508..3c4a33d 100644 --- a/lua/config/indent-blankline.lua +++ b/lua/config/indent-blankline.lua @@ -1,7 +1,7 @@ local api = vim.api local exclude_ft = { "help", "git", "markdown", "snippets", "text", "gitconfig", "alpha" } -require("indent_blankline").setup({ +require("indent_blankline").setup { -- U+2502 may also be a good choice, it will be on the middle of cursor. -- U+250A is also a good choice char = "▏", @@ -9,13 +9,13 @@ require("indent_blankline").setup({ disable_with_nolist = true, buftype_exclude = { "terminal" }, filetype_exclude = exclude_ft, -}) +} local gid = api.nvim_create_augroup("indent_blankline", { clear = true }) api.nvim_create_autocmd("InsertEnter", { pattern = "*", group = gid, - command = "IndentBlanklineDisable" + command = "IndentBlanklineDisable", }) api.nvim_create_autocmd("InsertLeave", { @@ -23,7 +23,7 @@ api.nvim_create_autocmd("InsertLeave", { group = gid, callback = function() if not vim.tbl_contains(exclude_ft, vim.bo.filetype) then - vim.cmd [[IndentBlanklineEnable]] + vim.cmd([[IndentBlanklineEnable]]) end - end + end, }) diff --git a/lua/config/iron.lua b/lua/config/iron.lua index 74d7046..67f5d81 100644 --- a/lua/config/iron.lua +++ b/lua/config/iron.lua @@ -1,7 +1,7 @@ local iron = require("iron") -iron.core.set_config({ +iron.core.set_config { preferred = { python = "ipython", }, repl_open_cmd = "vertical 120 split", -}) +} diff --git a/lua/config/lsp.lua b/lua/config/lsp.lua index 76436a4..0fad17a 100644 --- a/lua/config/lsp.lua +++ b/lua/config/lsp.lua @@ -14,37 +14,41 @@ local custom_attach = function(client, bufnr) keymap.set(mode, l, r, opts) end - map("n", "gd", vim.lsp.buf.definition, {desc = 'go to definition'}) + map("n", "gd", vim.lsp.buf.definition, { desc = "go to definition" }) map("n", "<C-]>", vim.lsp.buf.definition) map("n", "K", vim.lsp.buf.hover) map("n", "<C-k>", vim.lsp.buf.signature_help) - map("n", "<space>rn", vim.lsp.buf.rename, { desc = 'varialbe rename' }) - map("n", "gr", vim.lsp.buf.references, { desc = 'show references' }) - map("n", "[d", vim.diagnostic.goto_prev, { desc = 'previous diagnostic' }) - map("n", "]d", vim.diagnostic.goto_next, { desc = 'next diagnostic' }) - map("n", "<space>q", function() vim.diagnostic.setqflist({open = true}) end, { desc = 'put diagnostic to qf' }) - map("n", "<space>ca", vim.lsp.buf.code_action, { desc = 'LSP code action' }) - map("n", "<space>wa", vim.lsp.buf.add_workspace_folder, { desc = 'add workspace folder' } ) - map("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, { desc = 'remove workspace folder' }) - map("n", "<space>wl", function() inspect(vim.lsp.buf.list_workspace_folders()) end, { desc = 'list workspace folder' }) + map("n", "<space>rn", vim.lsp.buf.rename, { desc = "varialbe rename" }) + map("n", "gr", vim.lsp.buf.references, { desc = "show references" }) + map("n", "[d", vim.diagnostic.goto_prev, { desc = "previous diagnostic" }) + map("n", "]d", vim.diagnostic.goto_next, { desc = "next diagnostic" }) + map("n", "<space>q", function() + vim.diagnostic.setqflist { open = true } + end, { desc = "put diagnostic to qf" }) + map("n", "<space>ca", vim.lsp.buf.code_action, { desc = "LSP code action" }) + map("n", "<space>wa", vim.lsp.buf.add_workspace_folder, { desc = "add workspace folder" }) + map("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, { desc = "remove workspace folder" }) + map("n", "<space>wl", function() + inspect(vim.lsp.buf.list_workspace_folders()) + end, { desc = "list workspace folder" }) -- Set some key bindings conditional on server capabilities if client.resolved_capabilities.document_formatting then - map("n", "<space>f", vim.lsp.buf.formatting_sync, { desc = 'format code' }) + map("n", "<space>f", vim.lsp.buf.formatting_sync, { desc = "format code" }) end if client.resolved_capabilities.document_range_formatting then - map("x", "<space>f", vim.lsp.buf.range_formatting, { desc = 'range format' }) + map("x", "<space>f", vim.lsp.buf.range_formatting, { desc = "range format" }) end api.nvim_create_autocmd("CursorHold", { - buffer=bufnr, + buffer = bufnr, callback = function() local float_opts = { focusable = false, close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" }, - border = 'rounded', - source = 'always', -- show source in diagnostic popup window - prefix = ' ' + border = "rounded", + source = "always", -- show source in diagnostic popup window + prefix = " ", } if not vim.b.diagnostics_pos then @@ -52,14 +56,15 @@ local custom_attach = function(client, bufnr) end local cursor_pos = api.nvim_win_get_cursor(0) - if (cursor_pos[1] ~= vim.b.diagnostics_pos[1] or cursor_pos[2] ~= vim.b.diagnostics_pos[2]) and - #vim.diagnostic.get() > 0 + if + (cursor_pos[1] ~= vim.b.diagnostics_pos[1] or cursor_pos[2] ~= vim.b.diagnostics_pos[2]) + and #vim.diagnostic.get() > 0 then - vim.diagnostic.open_float(nil, float_opts) + vim.diagnostic.open_float(nil, float_opts) end vim.b.diagnostics_pos = cursor_pos - end + end, }) -- The blow command will highlight the current variable and its usages in the buffer. @@ -76,20 +81,20 @@ local custom_attach = function(client, bufnr) ]]) end - if vim.g.logging_level == 'debug' then + if vim.g.logging_level == "debug" then local msg = string.format("Language server %s started!", client.name) - vim.notify(msg, vim.log.levels.DEBUG, {title = 'Nvim-config'}) + vim.notify(msg, vim.log.levels.DEBUG, { title = "Nvim-config" }) end end local capabilities = lsp.protocol.make_client_capabilities() -capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities) +capabilities = require("cmp_nvim_lsp").update_capabilities(capabilities) capabilities.textDocument.completion.completionItem.snippetSupport = true local lspconfig = require("lspconfig") -if utils.executable('pylsp') then - lspconfig.pylsp.setup({ +if utils.executable("pylsp") then + lspconfig.pylsp.setup { on_attach = custom_attach, settings = { pylsp = { @@ -107,9 +112,9 @@ if utils.executable('pylsp') then debounce_text_changes = 200, }, capabilities = capabilities, - }) + } else - vim.notify("pylsp not found!", vim.log.levels.WARN, {title = 'Nvim-config'}) + vim.notify("pylsp not found!", vim.log.levels.WARN, { title = "Nvim-config" }) end -- if utils.executable('pyright') then @@ -121,43 +126,43 @@ end -- vim.notify("pyright not found!", vim.log.levels.WARN, {title = 'Nvim-config'}) -- end -if utils.executable('clangd') then - lspconfig.clangd.setup({ +if utils.executable("clangd") then + lspconfig.clangd.setup { on_attach = custom_attach, capabilities = capabilities, filetypes = { "c", "cpp", "cc" }, flags = { debounce_text_changes = 500, }, - }) + } else - vim.notify("clangd not found!", vim.log.levels.WARN, {title = 'Nvim-config'}) + vim.notify("clangd not found!", vim.log.levels.WARN, { title = "Nvim-config" }) end -- set up vim-language-server -if utils.executable('vim-language-server') then - lspconfig.vimls.setup({ +if utils.executable("vim-language-server") then + lspconfig.vimls.setup { on_attach = custom_attach, flags = { debounce_text_changes = 500, }, capabilities = capabilities, - }) + } else - vim.notify("vim-language-server not found!", vim.log.levels.WARN, {title = 'Nvim-config'}) + vim.notify("vim-language-server not found!", vim.log.levels.WARN, { title = "Nvim-config" }) end -- set up bash-language-server -if utils.executable('bash-language-server') then - lspconfig.bashls.setup({ +if utils.executable("bash-language-server") then + lspconfig.bashls.setup { on_attach = custom_attach, capabilities = capabilities, - }) + } end if utils.executable("lua-language-server") then -- settings for lua-language-server can be found on https://github.com/sumneko/lua-language-server/wiki/Settings . - lspconfig.sumneko_lua.setup({ + lspconfig.sumneko_lua.setup { on_attach = custom_attach, settings = { Lua = { @@ -174,8 +179,8 @@ if utils.executable("lua-language-server") then -- see also https://github.com/sumneko/lua-language-server/wiki/Libraries#link-to-workspace . -- Lua-dev.nvim also has similar settings for sumneko lua, https://github.com/folke/lua-dev.nvim/blob/main/lua/lua-dev/sumneko.lua . library = { - fn.stdpath('data') .. "/site/pack/packer/opt/emmylua-nvim", - fn.stdpath('config'), + fn.stdpath("data") .. "/site/pack/packer/opt/emmylua-nvim", + fn.stdpath("config"), }, maxPreload = 2000, preloadFileSize = 50000, @@ -183,7 +188,7 @@ if utils.executable("lua-language-server") then }, }, capabilities = capabilities, - }) + } end -- Change diagnostic signs. @@ -193,12 +198,12 @@ fn.sign_define("DiagnosticSignInformation", { text = "", texthl = "Diagnostic fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint" }) -- global config for diagnostic -vim.diagnostic.config({ +vim.diagnostic.config { underline = false, virtual_text = false, signs = true, severity_sort = true, -}) +} -- lsp.handlers["textDocument/publishDiagnostics"] = lsp.with(lsp.diagnostic.on_publish_diagnostics, { -- underline = false, diff --git a/lua/config/neoscroll.lua b/lua/config/neoscroll.lua index 45b7c08..6d9701b 100644 --- a/lua/config/neoscroll.lua +++ b/lua/config/neoscroll.lua @@ -1,6 +1,6 @@ -require("neoscroll").setup({ +require("neoscroll").setup { easing_function = "quadratic", -}) +} local t = {} -- Syntax: t[keys] = {function, {function arguments}} diff --git a/lua/config/nvim-cmp.lua b/lua/config/nvim-cmp.lua index e7fed19..188c985 100644 --- a/lua/config/nvim-cmp.lua +++ b/lua/config/nvim-cmp.lua @@ -1,54 +1,54 @@ -- Setup nvim-cmp. -local cmp = require'cmp' -local lspkind = require'lspkind' +local cmp = require("cmp") +local lspkind = require("lspkind") -cmp.setup({ +cmp.setup { snippet = { expand = function(args) -- For `ultisnips` user. vim.fn["UltiSnips#Anon"](args.body) end, }, - mapping = cmp.mapping.preset.insert({ - ['<Tab>'] = function(fallback) - if cmp.visible() then - cmp.select_next_item() - else - fallback() - end - end, - ['<S-Tab>'] = function(fallback) - if cmp.visible() then - cmp.select_prev_item() - else - fallback() - end - end, - ['<CR>'] = cmp.mapping.confirm({ select = true }), - ['<C-e>'] = cmp.mapping.abort(), - ['<Esc>'] = cmp.mapping.close(), - ['<C-d>'] = cmp.mapping.scroll_docs(-4), - ['<C-f>'] = cmp.mapping.scroll_docs(4), - }), + mapping = cmp.mapping.preset.insert { + ["<Tab>"] = function(fallback) + if cmp.visible() then + cmp.select_next_item() + else + fallback() + end + end, + ["<S-Tab>"] = function(fallback) + if cmp.visible() then + cmp.select_prev_item() + else + fallback() + end + end, + ["<CR>"] = cmp.mapping.confirm { select = true }, + ["<C-e>"] = cmp.mapping.abort(), + ["<Esc>"] = cmp.mapping.close(), + ["<C-d>"] = cmp.mapping.scroll_docs(-4), + ["<C-f>"] = cmp.mapping.scroll_docs(4), + }, sources = { - { name = 'nvim_lsp' }, -- For nvim-lsp - { name = 'ultisnips' }, -- For ultisnips user. - { name = 'path' }, -- for path completion - { name = 'buffer', keyword_length = 2 }, -- for buffer word completion - { name = 'omni' }, - { name = 'emoji', insert = true, } -- emoji completion + { name = "nvim_lsp" }, -- For nvim-lsp + { name = "ultisnips" }, -- For ultisnips user. + { name = "path" }, -- for path completion + { name = "buffer", keyword_length = 2 }, -- for buffer word completion + { name = "omni" }, + { name = "emoji", insert = true }, -- emoji completion }, completion = { keyword_length = 1, - completeopt = "menu,noselect" + completeopt = "menu,noselect", }, view = { - entries = 'custom', + entries = "custom", }, formatting = { - format = lspkind.cmp_format({ + format = lspkind.cmp_format { mode = "symbol_text", - menu = ({ + menu = { nvim_lsp = "[LSP]", ultisnips = "[US]", nvim_lua = "[Lua]", @@ -56,13 +56,13 @@ cmp.setup({ buffer = "[Buffer]", emoji = "[Emoji]", omni = "[Omni]", - }), - }), + }, + }, }, -}) +} -- see https://github.com/hrsh7th/nvim-cmp/wiki/Menu-Appearance#how-to-add-visual-studio-code-dark-theme-colors-to-the-menu -vim.cmd[[ +vim.cmd([[ highlight! link CmpItemMenu Comment " gray highlight! CmpItemAbbrDeprecated guibg=NONE gui=strikethrough guifg=#808080 @@ -80,4 +80,4 @@ vim.cmd[[ highlight! CmpItemKindKeyword guibg=NONE guifg=#D4D4D4 highlight! CmpItemKindProperty guibg=NONE guifg=#D4D4D4 highlight! CmpItemKindUnit guibg=NONE guifg=#D4D4D4 -]] +]]) diff --git a/lua/config/nvim-notify.lua b/lua/config/nvim-notify.lua index d64228f..4fcd02e 100644 --- a/lua/config/nvim-notify.lua +++ b/lua/config/nvim-notify.lua @@ -1,10 +1,10 @@ local nvim_notify = require("notify") -nvim_notify.setup({ +nvim_notify.setup { -- Animation style stages = "fade_in_slide_out", -- Default timeout for notifications timeout = 1500, background_colour = "#2E3440", -}) +} vim.notify = nvim_notify diff --git a/lua/config/nvim-tree.lua b/lua/config/nvim-tree.lua index c34c1d5..737911f 100644 --- a/lua/config/nvim-tree.lua +++ b/lua/config/nvim-tree.lua @@ -1,7 +1,7 @@ local keymap = vim.keymap local nvim_tree = require("nvim-tree") -nvim_tree.setup({ +nvim_tree.setup { auto_reload_on_write = true, disable_netrw = false, hijack_cursor = false, @@ -112,9 +112,8 @@ nvim_tree.setup({ profile = false, }, }, -}) +} -keymap.set('n', '<space>s', function() - return require('nvim-tree').toggle(false, true) -end, - { silent = true, desc = "toggle nvim-tree" }) +keymap.set("n", "<space>s", function() + return require("nvim-tree").toggle(false, true) +end, { silent = true, desc = "toggle nvim-tree" }) diff --git a/lua/config/nvim_hop.lua b/lua/config/nvim_hop.lua index b774046..b1df219 100644 --- a/lua/config/nvim_hop.lua +++ b/lua/config/nvim_hop.lua @@ -1,14 +1,14 @@ -vim.cmd [[hi HopNextKey cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff]] -vim.cmd [[hi HopNextKey1 cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff]] -vim.cmd [[hi HopNextKey2 cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff]] +vim.cmd([[hi HopNextKey cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff]]) +vim.cmd([[hi HopNextKey1 cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff]]) +vim.cmd([[hi HopNextKey2 cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff]]) local keymap = vim.keymap -local hop = require "hop" -hop.setup({ +local hop = require("hop") +hop.setup { case_insensitive = true, char2_fallback_key = "<CR>", quit_key = "<Esc>", -}) +} keymap.set({ "n", "v", "o" }, "f", "", { silent = true, diff --git a/lua/config/statusline.lua b/lua/config/statusline.lua index bb018ce..846d561 100644 --- a/lua/config/statusline.lua +++ b/lua/config/statusline.lua @@ -11,9 +11,9 @@ end local function ime_state() if vim.g.is_mac then -- ref: https://github.com/vim-airline/vim-airline/blob/master/autoload/airline/extensions/xkblayout.vim#L11 - local layout = fn.libcall(vim.g.XkbSwitchLib, 'Xkb_Switch_getXkbLayout', '') - if layout == '0' then - return '[CN]' + local layout = fn.libcall(vim.g.XkbSwitchLib, "Xkb_Switch_getXkbLayout", "") + if layout == "0" then + return "[CN]" end end @@ -27,7 +27,7 @@ local function trailing_space() local line_num = nil - for i=1, fn.line('$') do + for i = 1, fn.line("$") do local linetext = fn.getline(i) -- To prevent invalid escape error, we wrap the regex string with `[[]]`. local idx = fn.match(linetext, [[\v\s+$]]) @@ -53,24 +53,26 @@ local function mixed_indent() local space_pat = [[\v^ +]] local tab_pat = [[\v^\t+]] - local space_indent = fn.search(space_pat, 'nwc') - local tab_indent = fn.search(tab_pat, 'nwc') + local space_indent = fn.search(space_pat, "nwc") + local tab_indent = fn.search(tab_pat, "nwc") local mixed = (space_indent > 0 and tab_indent > 0) local mixed_same_line if not mixed then - mixed_same_line = fn.search([[\v^(\t+ | +\t)]], 'nwc') + mixed_same_line = fn.search([[\v^(\t+ | +\t)]], "nwc") mixed = mixed_same_line > 0 end - if not mixed then return '' end + if not mixed then + return "" + end if mixed_same_line ~= nil and mixed_same_line > 0 then - return 'MI:'..mixed_same_line + return "MI:" .. mixed_same_line end - local space_indent_cnt = fn.searchcount({pattern=space_pat, max_count=1e3}).total - local tab_indent_cnt = fn.searchcount({pattern=tab_pat, max_count=1e3}).total + local space_indent_cnt = fn.searchcount({ pattern = space_pat, max_count = 1e3 }).total + local tab_indent_cnt = fn.searchcount({ pattern = tab_pat, max_count = 1e3 }).total if space_indent_cnt > tab_indent_cnt then - return 'MI:'..tab_indent + return "MI:" .. tab_indent else - return 'MI:'..space_indent + return "MI:" .. space_indent end end @@ -89,7 +91,7 @@ local diff = function() return info end -require("lualine").setup({ +require("lualine").setup { options = { icons_enabled = true, theme = "auto", @@ -105,19 +107,19 @@ require("lualine").setup({ lualine_b = { "branch", { - 'diff', - source = diff - } + "diff", + source = diff, + }, }, lualine_c = { "filename", { ime_state, - color = {fg = 'black', bg = '#f46868'} + color = { fg = "black", bg = "#f46868" }, }, { spell, - color = {fg = 'black', bg = '#a7c080'} + color = { fg = "black", bg = "#a7c080" }, }, }, lualine_x = { @@ -137,15 +139,15 @@ require("lualine").setup({ "location", { "diagnostics", - sources = { "nvim_diagnostic" } + sources = { "nvim_diagnostic" }, }, { trailing_space, - color = "WarningMsg" + color = "WarningMsg", }, { mixed_indent, - color = "WarningMsg" + color = "WarningMsg", }, }, }, @@ -158,6 +160,5 @@ require("lualine").setup({ lualine_z = {}, }, tabline = {}, - extensions = {'quickfix', 'fugitive', 'nvim-tree'}, -}) - + extensions = { "quickfix", "fugitive", "nvim-tree" }, +} diff --git a/lua/config/treesitter.lua b/lua/config/treesitter.lua index 11721ec..9f7a8a9 100644 --- a/lua/config/treesitter.lua +++ b/lua/config/treesitter.lua @@ -1,8 +1,8 @@ -require("nvim-treesitter.configs").setup({ - ensure_installed = {"python", "cpp", "lua", "vim"}, +require("nvim-treesitter.configs").setup { + ensure_installed = { "python", "cpp", "lua", "vim" }, ignore_install = {}, -- List of parsers to ignore installing highlight = { enable = true, -- false will disable the whole extension disable = {}, -- list of language that will be disabled }, -}) +} diff --git a/lua/config/which-key.lua b/lua/config/which-key.lua index 11e4c63..10c0c41 100644 --- a/lua/config/which-key.lua +++ b/lua/config/which-key.lua @@ -1,4 +1,4 @@ -require("which-key").setup({ +require("which-key").setup { plugins = { marks = true, -- shows a list of your marks on ' and ` registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode @@ -46,7 +46,7 @@ require("which-key").setup({ align = "center", -- align columns left, center or right }, ignore_missing = false, -- enable this to hide mappings for which you didn't specify a label - hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ "}, -- hide mapping boilerplate + hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate show_help = true, -- show help message on the command line when the popup is visible triggers = "auto", -- automatically setup triggers -- triggers = {"<leader>"} -- or specify a list manually @@ -57,4 +57,4 @@ require("which-key").setup({ -- most people should not need to change this n = { "o", "O" }, }, -}) +} diff --git a/lua/config/zen-mode.lua b/lua/config/zen-mode.lua index 8185ceb..b6d52ce 100644 --- a/lua/config/zen-mode.lua +++ b/lua/config/zen-mode.lua @@ -1,4 +1,4 @@ -require("zen-mode").setup({ +require("zen-mode").setup { window = { backdrop = 0.8, -- shade the backdrop of the Zen window. Set to 1 to keep the same as Normal width = 120, @@ -12,4 +12,4 @@ require("zen-mode").setup({ list = false, -- disable whitespace characters }, }, -}) +} |
