diff options
| author | Michal Hanus <hanus.michal@divelit.cz> | 2024-03-02 18:49:55 +0100 |
|---|---|---|
| committer | Michal Hanus <hanus.michal@divelit.cz> | 2024-03-02 18:49:55 +0100 |
| commit | aab38f32e0a02e43565a554d0a76ff65636499b8 (patch) | |
| tree | f3f00df05c63228c69a338e80fd0e7d02986e8cf /lua | |
| parent | 99353a355321d68ef4fb3c26291084b23e8f4978 (diff) | |
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/config/bqf.lua | 6 | ||||
| -rw-r--r-- | lua/config/bufferline.lua | 46 | ||||
| -rw-r--r-- | lua/config/dashboard-nvim.lua | 75 | ||||
| -rw-r--r-- | lua/config/fidget-nvim.lua | 1 | ||||
| -rw-r--r-- | lua/config/fugitive.lua | 11 | ||||
| -rw-r--r-- | lua/config/git-linker.lua | 37 | ||||
| -rw-r--r-- | lua/config/gitsigns.lua | 57 | ||||
| -rw-r--r-- | lua/config/hlslens.lua | 49 | ||||
| -rw-r--r-- | lua/config/iron.lua | 7 | ||||
| -rw-r--r-- | lua/config/lsp.lua | 273 | ||||
| -rw-r--r-- | lua/config/nvim-cmp.lua | 91 | ||||
| -rw-r--r-- | lua/config/nvim-notify.lua | 10 | ||||
| -rw-r--r-- | lua/config/nvim_hop.lua | 27 | ||||
| -rw-r--r-- | lua/config/treesitter.lua | 8 | ||||
| -rw-r--r-- | lua/config/which-key.lua | 60 | ||||
| -rw-r--r-- | lua/config/yanky.lua | 13 | ||||
| -rw-r--r-- | lua/config/zen-mode.lua | 15 | ||||
| -rw-r--r-- | lua/globals.lua | 75 | ||||
| -rw-r--r-- | lua/utils.lua | 59 |
19 files changed, 0 insertions, 920 deletions
diff --git a/lua/config/bqf.lua b/lua/config/bqf.lua deleted file mode 100644 index c62a513..0000000 --- a/lua/config/bqf.lua +++ /dev/null @@ -1,6 +0,0 @@ -require("bqf").setup { - auto_resize_height = false, - preview = { - auto_preview = false, - }, -} diff --git a/lua/config/bufferline.lua b/lua/config/bufferline.lua deleted file mode 100644 index 6fa27ce..0000000 --- a/lua/config/bufferline.lua +++ /dev/null @@ -1,46 +0,0 @@ -require("bufferline").setup { - options = { - numbers = "buffer_id", - close_command = "bdelete! %d", - right_mouse_command = nil, - left_mouse_command = "buffer %d", - middle_mouse_command = nil, - indicator = { - icon = "▎", -- this should be omitted if indicator style is not 'icon' - style = "icon", - }, - buffer_close_icon = "", - modified_icon = "●", - close_icon = "", - left_trunc_marker = "", - right_trunc_marker = "", - max_name_length = 18, - max_prefix_length = 15, - tab_size = 10, - diagnostics = false, - custom_filter = function(bufnr) - -- if the result is false, this buffer will be shown, otherwise, this - -- buffer will be hidden. - - -- filter out filetypes you don't want to see - local exclude_ft = { "qf", "fugitive", "git" } - local cur_ft = vim.bo[bufnr].filetype - local should_filter = vim.tbl_contains(exclude_ft, cur_ft) - - if should_filter then - return false - end - - return true - end, - show_buffer_icons = false, - show_buffer_close_icons = true, - show_close_icon = true, - show_tab_indicators = true, - persist_buffer_sort = true, -- whether or not custom sorted buffers should persist - separator_style = "bar", - enforce_regular_tabs = false, - always_show_bufferline = true, - sort_by = "id", - }, -} diff --git a/lua/config/dashboard-nvim.lua b/lua/config/dashboard-nvim.lua deleted file mode 100644 index 9017d96..0000000 --- a/lua/config/dashboard-nvim.lua +++ /dev/null @@ -1,75 +0,0 @@ -local api = vim.api -local keymap = vim.keymap -local dashboard = require("dashboard") - -local conf = {} -conf.header = { - " ", - " ", - " ", - " ███╗ ██╗ ███████╗ ██████╗ ██╗ ██╗ ██╗ ███╗ ███╗", - " ████╗ ██║ ██╔════╝██╔═══██╗ ██║ ██║ ██║ ████╗ ████║", - " ██╔██╗ ██║ █████╗ ██║ ██║ ██║ ██║ ██║ ██╔████╔██║", - " ██║╚██╗██║ ██╔══╝ ██║ ██║ ╚██╗ ██╔╝ ██║ ██║╚██╔╝██║", - " ██║ ╚████║ ███████╗╚██████╔╝ ╚████╔╝ ██║ ██║ ╚═╝ ██║", - " ╚═╝ ╚═══╝ ╚══════╝ ╚═════╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝", - " ", - " ", - " ", - " ", -} - -conf.center = { - { - icon = " ", - desc = "Find File ", - action = "Leaderf file --popup", - key = "<Leader> f f", - }, - { - icon = " ", - desc = "Recently opened files ", - action = "Leaderf mru --popup", - key = "<Leader> f r", - }, - { - icon = " ", - desc = "Project grep ", - action = "Leaderf rg --popup", - key = "<Leader> f g", - }, - { - icon = " ", - desc = "Open Nvim config ", - action = "tabnew $MYVIMRC | tcd %:p:h", - key = "<Leader> e v", - }, - { - icon = " ", - desc = "New file ", - action = "enew", - key = "e", - }, - { - icon = " ", - desc = "Quit Nvim ", - -- desc = "Quit Nvim ", - action = "qa", - key = "q", - }, -} - -dashboard.setup({ - theme = 'doom', - shortcut_type = 'number', - config = conf -}) - -api.nvim_create_autocmd("FileType", { - pattern = "dashboard", - group = api.nvim_create_augroup("dashboard_enter", { clear = true }), - callback = function () - keymap.set("n", "q", ":qa<CR>", { buffer = true, silent = true }) - keymap.set("n", "e", ":enew<CR>", { buffer = true, silent = true }) - end -}) diff --git a/lua/config/fidget-nvim.lua b/lua/config/fidget-nvim.lua deleted file mode 100644 index 945f564..0000000 --- a/lua/config/fidget-nvim.lua +++ /dev/null @@ -1 +0,0 @@ -require("fidget").setup {} diff --git a/lua/config/fugitive.lua b/lua/config/fugitive.lua deleted file mode 100644 index b9c45e2..0000000 --- a/lua/config/fugitive.lua +++ /dev/null @@ -1,11 +0,0 @@ -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" }) - --- convert git to Git in command line mode -vim.fn['utils#Cabbrev']('git', 'Git') diff --git a/lua/config/git-linker.lua b/lua/config/git-linker.lua deleted file mode 100644 index 39f5ba2..0000000 --- a/lua/config/git-linker.lua +++ /dev/null @@ -1,37 +0,0 @@ -local keymap = vim.keymap -local gitlinker = require("gitlinker") - -gitlinker.setup { - callbacks = { - ["dev.azure.com"] = function(url_data) - vim.print(url_data) - local url = require"gitlinker.hosts".get_base_https_url(url_data) - - if url_data.lstart then - if url_data.lend == nil then - url_data.lend = url_data.lstart - end - url = url .. "?path=/" .. url_data.file .. "&version=GC" .. url_data.rev .. "&line=" .. url_data.lstart .. "&lineEnd=" .. url_data.lend .. "&lineStartColumn=1" .. "&lineEndColumn=120" - end - return url - end - }, - mappings = nil, -} - -keymap.set({ "n", "v" }, "<leader>gl", function() - local mode = string.lower(vim.fn.mode()) - gitlinker.get_buf_range_url(mode) -end, { - silent = true, - desc = "get git permlink", -}) - -keymap.set("n", "<leader>gb", function() - gitlinker.get_repo_url({ - action_callback = gitlinker.actions.open_in_browser - }) -end, { - silent = true, - desc = "browse repo in browser", -}) diff --git a/lua/config/gitsigns.lua b/lua/config/gitsigns.lua deleted file mode 100644 index 0a7294c..0000000 --- a/lua/config/gitsigns.lua +++ /dev/null @@ -1,57 +0,0 @@ -local gs = require("gitsigns") - -gs.setup { - signs = { - add = { hl = "GitSignsAdd", text = "+", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" }, - change = { hl = "GitSignsChange", text = "~", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, - delete = { hl = "GitSignsDelete", text = "_", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, - topdelete = { hl = "GitSignsDelete", text = "‾", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, - changedelete = { hl = "GitSignsChange", text = "│", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, - }, - word_diff = true, - on_attach = function(bufnr) - local function map(mode, l, r, opts) - opts = opts or {} - opts.buffer = bufnr - vim.keymap.set(mode, l, r, opts) - end - - -- Navigation - map("n", "]c", function() - if vim.wo.diff then - return "]c" - end - vim.schedule(function() - gs.next_hunk() - end) - return "<Ignore>" - end, { expr = true, desc = "next hunk" }) - - map("n", "[c", function() - if vim.wo.diff then - return "[c" - end - vim.schedule(function() - gs.prev_hunk() - end) - return "<Ignore>" - 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) - end, -} - -vim.api.nvim_create_autocmd('ColorScheme', { - pattern = "*", - callback = function() - vim.cmd [[ - hi GitSignsChangeInline gui=reverse - hi GitSignsAddInline gui=reverse - hi GitSignsDeleteInline gui=reverse - ]] - end -}) diff --git a/lua/config/hlslens.lua b/lua/config/hlslens.lua deleted file mode 100644 index 430bd23..0000000 --- a/lua/config/hlslens.lua +++ /dev/null @@ -1,49 +0,0 @@ -local api = vim.api -local keymap = vim.keymap - -local hlslens = require("hlslens") - -hlslens.setup { - calm_down = true, - nearest_only = true, -} - -local activate_hlslens = function(direction) - local cmd = string.format("normal! %s%szzzv", vim.v.count1, direction) - local status, msg = pcall(vim.cmd, cmd) - - -- Deal with the case that there is no such pattern in current buffer. - if not status then - local start_idx, _ = string.find(msg, 'E486', 1, true) - local msg_part = string.sub(msg, start_idx) - api.nvim_err_writeln(msg_part) - return - end - - 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", "*", "", { - callback = function() - vim.fn.execute("normal! *N") - hlslens.start() - end, -}) -keymap.set("n", "#", "", { - callback = function() - vim.fn.execute("normal! #N") - hlslens.start() - end, -}) diff --git a/lua/config/iron.lua b/lua/config/iron.lua deleted file mode 100644 index 67f5d81..0000000 --- a/lua/config/iron.lua +++ /dev/null @@ -1,7 +0,0 @@ -local iron = require("iron") -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 deleted file mode 100644 index 7c6fb79..0000000 --- a/lua/config/lsp.lua +++ /dev/null @@ -1,273 +0,0 @@ -local fn = vim.fn -local api = vim.api -local keymap = vim.keymap -local lsp = vim.lsp -local diagnostic = vim.diagnostic - -local utils = require("utils") - --- set quickfix list from diagnostics in a certain buffer, not the whole workspace -local set_qflist = function(buf_num, severity) - local diagnostics = nil - diagnostics = diagnostic.get(buf_num, { severity = severity }) - - local qf_items = diagnostic.toqflist(diagnostics) - vim.fn.setqflist({}, ' ', { title = 'Diagnostics', items = qf_items }) - - -- open quickfix by default - vim.cmd[[copen]] -end - -local custom_attach = function(client, bufnr) - -- Mappings. - local map = function(mode, l, r, opts) - opts = opts or {} - opts.silent = true - opts.buffer = bufnr - keymap.set(mode, l, r, opts) - end - - 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", diagnostic.goto_prev, { desc = "previous diagnostic" }) - map("n", "]d", diagnostic.goto_next, { desc = "next diagnostic" }) - -- this puts diagnostics from opened files to quickfix - map("n", "<space>qw", diagnostic.setqflist, { desc = "put window diagnostics to qf" }) - -- this puts diagnostics from current buffer to quickfix - map("n", "<space>qb", function() set_qflist(bufnr) end, { desc = "put buffer diagnostics 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.server_capabilities.documentFormattingProvider then - map("n", "<space>f", vim.lsp.buf.format, { desc = "format code" }) - end - - api.nvim_create_autocmd("CursorHold", { - 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 = " ", - } - - if not vim.b.diagnostics_pos then - vim.b.diagnostics_pos = { nil, nil } - 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 #diagnostic.get() > 0 - then - diagnostic.open_float(nil, float_opts) - end - - vim.b.diagnostics_pos = cursor_pos - end, - }) - - -- The blow command will highlight the current variable and its usages in the buffer. - if client.server_capabilities.documentHighlightProvider then - vim.cmd([[ - hi! link LspReferenceRead Visual - hi! link LspReferenceText Visual - hi! link LspReferenceWrite Visual - ]]) - - local gid = api.nvim_create_augroup("lsp_document_highlight", { clear = true }) - api.nvim_create_autocmd("CursorHold" , { - group = gid, - buffer = bufnr, - callback = function () - lsp.buf.document_highlight() - end - }) - - api.nvim_create_autocmd("CursorMoved" , { - group = gid, - buffer = bufnr, - callback = function () - lsp.buf.clear_references() - end - }) - end - - 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" }) - end -end - -local capabilities = require('cmp_nvim_lsp').default_capabilities() - -local lspconfig = require("lspconfig") - -if utils.executable("pylsp") then - local venv_path = os.getenv('VIRTUAL_ENV') - local py_path = nil - -- decide which python executable to use for mypy - if venv_path ~= nil then - py_path = venv_path .. "/bin/python3" - else - py_path = vim.g.python3_host_prog - end - - lspconfig.pylsp.setup { - on_attach = custom_attach, - settings = { - pylsp = { - plugins = { - -- formatter options - black = { enabled = true }, - autopep8 = { enabled = false }, - yapf = { enabled = false }, - -- linter options - pylint = { enabled = true, executable = "pylint" }, - ruff = { enabled = false }, - pyflakes = { enabled = false }, - pycodestyle = { enabled = false }, - -- type checker - pylsp_mypy = { - enabled = true, - overrides = { "--python-executable", py_path, true }, - report_progress = true, - live_mode = false - }, - -- auto-completion options - jedi_completion = { fuzzy = true }, - -- import sorting - isort = { enabled = true }, - }, - }, - }, - flags = { - debounce_text_changes = 200, - }, - capabilities = capabilities, - } -else - vim.notify("pylsp not found!", vim.log.levels.WARN, { title = "Nvim-config" }) -end - --- if utils.executable('pyright') then --- lspconfig.pyright.setup{ --- on_attach = custom_attach, --- capabilities = capabilities --- } --- else --- vim.notify("pyright not found!", vim.log.levels.WARN, {title = 'Nvim-config'}) --- end - -if utils.executable("ltex-ls") then - lspconfig.ltex.setup { - on_attach = custom_attach, - cmd = { "ltex-ls" }, - filetypes = { "text", "plaintex", "tex", "markdown" }, - settings = { - ltex = { - language = "en" - }, - }, - flags = { debounce_text_changes = 300 }, -} -end - -if utils.executable("clangd") then - lspconfig.clangd.setup { - on_attach = custom_attach, - capabilities = capabilities, - filetypes = { "c", "cpp", "cc" }, - flags = { - debounce_text_changes = 500, - }, - } -end - --- set up vim-language-server -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" }) -end - --- set up bash-language-server -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/LuaLS/lua-language-server/wiki/Settings . - lspconfig.lua_ls.setup { - on_attach = custom_attach, - settings = { - Lua = { - runtime = { - -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) - version = "LuaJIT", - }, - diagnostics = { - -- Get the language server to recognize the `vim` global - globals = { "vim" }, - }, - workspace = { - -- Make the server aware of Neovim runtime files, - -- see also https://github.com/LuaLS/lua-language-server/wiki/Libraries#link-to-workspace . - -- Lua-dev.nvim also has similar settings for lua ls, https://github.com/folke/neodev.nvim/blob/main/lua/neodev/luals.lua . - library = { - fn.stdpath("data") .. "/lazy/emmylua-nvim", - fn.stdpath("config"), - }, - maxPreload = 2000, - preloadFileSize = 50000, - }, - }, - }, - capabilities = capabilities, - } -end - --- Change diagnostic signs. -fn.sign_define("DiagnosticSignError", { text = '🆇', texthl = "DiagnosticSignError" }) -fn.sign_define("DiagnosticSignWarn", { text = '⚠️', texthl = "DiagnosticSignWarn" }) -fn.sign_define("DiagnosticSignInfo", { text = 'ℹ️', texthl = "DiagnosticSignInfo" }) -fn.sign_define("DiagnosticSignHint", { text = '', texthl = "DiagnosticSignHint" }) - --- global config for diagnostic -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, --- virtual_text = false, --- signs = true, --- update_in_insert = false, --- }) - --- Change border of documentation hover window, See https://github.com/neovim/neovim/pull/13998. -lsp.handlers["textDocument/hover"] = lsp.with(vim.lsp.handlers.hover, { - border = "rounded", -}) diff --git a/lua/config/nvim-cmp.lua b/lua/config/nvim-cmp.lua deleted file mode 100644 index a402f1c..0000000 --- a/lua/config/nvim-cmp.lua +++ /dev/null @@ -1,91 +0,0 @@ --- Setup nvim-cmp. -local cmp = require("cmp") -local lspkind = require("lspkind") - -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), - }, - 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 = "emoji", insert = true }, -- emoji completion - }, - completion = { - keyword_length = 1, - completeopt = "menu,noselect", - }, - view = { - entries = "custom", - }, - formatting = { - format = lspkind.cmp_format { - mode = "symbol_text", - menu = { - nvim_lsp = "[LSP]", - ultisnips = "[US]", - nvim_lua = "[Lua]", - path = "[Path]", - buffer = "[Buffer]", - emoji = "[Emoji]", - omni = "[Omni]", - }, - }, - }, -} - -cmp.setup.filetype("tex", { - sources = { - { name = "omni" }, - { name = "ultisnips" }, -- For ultisnips user. - { name = "buffer", keyword_length = 2 }, -- for buffer word completion - { name = "path" }, -- for path completion - }, -}) - --- see https://github.com/hrsh7th/nvim-cmp/wiki/Menu-Appearance#how-to-add-visual-studio-code-dark-theme-colors-to-the-menu -vim.cmd([[ - highlight! link CmpItemMenu Comment - " gray - highlight! CmpItemAbbrDeprecated guibg=NONE gui=strikethrough guifg=#808080 - " blue - highlight! CmpItemAbbrMatch guibg=NONE guifg=#569CD6 - highlight! CmpItemAbbrMatchFuzzy guibg=NONE guifg=#569CD6 - " light blue - highlight! CmpItemKindVariable guibg=NONE guifg=#9CDCFE - highlight! CmpItemKindInterface guibg=NONE guifg=#9CDCFE - highlight! CmpItemKindText guibg=NONE guifg=#9CDCFE - " pink - highlight! CmpItemKindFunction guibg=NONE guifg=#C586C0 - highlight! CmpItemKindMethod guibg=NONE guifg=#C586C0 - " front - 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 deleted file mode 100644 index 4fcd02e..0000000 --- a/lua/config/nvim-notify.lua +++ /dev/null @@ -1,10 +0,0 @@ -local nvim_notify = require("notify") -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_hop.lua b/lua/config/nvim_hop.lua deleted file mode 100644 index 4530edf..0000000 --- a/lua/config/nvim_hop.lua +++ /dev/null @@ -1,27 +0,0 @@ -local keymap = vim.keymap -local hop = require("hop") -hop.setup { - case_insensitive = true, - char2_fallback_key = "<CR>", - quit_key = "<Esc>", -} - -keymap.set({ "n", "v", "o" }, "f", "", { - silent = true, - noremap = true, - callback = function() - hop.hint_char2() - end, - desc = "nvim-hop char2", -}) - -vim.api.nvim_create_autocmd("ColorScheme", { - pattern = "*", - callback = function () - vim.cmd([[ - hi HopNextKey cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff - hi HopNextKey1 cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff - hi HopNextKey2 cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff - ]]) - end -}) diff --git a/lua/config/treesitter.lua b/lua/config/treesitter.lua deleted file mode 100644 index 4111859..0000000 --- a/lua/config/treesitter.lua +++ /dev/null @@ -1,8 +0,0 @@ -require("nvim-treesitter.configs").setup { - ensure_installed = { "python", "cpp", "lua", "vim", "json", "toml" }, - ignore_install = {}, -- List of parsers to ignore installing - highlight = { - enable = true, -- false will disable the whole extension - disable = { 'help' }, -- list of language that will be disabled - }, -} diff --git a/lua/config/which-key.lua b/lua/config/which-key.lua deleted file mode 100644 index 10c0c41..0000000 --- a/lua/config/which-key.lua +++ /dev/null @@ -1,60 +0,0 @@ -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 - spelling = { - enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions - suggestions = 9, -- how many suggestions should be shown in the list? - }, - -- the presets plugin, adds help for a bunch of default keybindings in Neovim - -- No actual key bindings are created - presets = { - operators = true, -- adds help for operators like d, y, ... and registers them for motion / text object completion - motions = true, -- adds help for motions - text_objects = true, -- help for text objects triggered after entering an operator - windows = true, -- default bindings on <c-w> - nav = true, -- misc bindings to work with windows - z = true, -- bindings for folds, spelling and others prefixed with z - g = true, -- bindings for prefixed with g - }, - }, - -- add operators that will trigger motion and text object completion - -- to enable all native operators, set the preset / operators plugin above - operators = { gc = "Comments" }, - key_labels = { - -- override the label used to display some keys. It doesn't effect WK in any other way. - -- For example: - -- ["<space>"] = "SPC", - -- ["<cr>"] = "RET", - -- ["<tab>"] = "TAB", - }, - icons = { - breadcrumb = "»", -- symbol used in the command line area that shows your active key combo - separator = "➜", -- symbol used between a key and it's label - group = "+", -- symbol prepended to a group - }, - window = { - border = "none", -- none, single, double, shadow - position = "bottom", -- bottom, top - margin = { 0, 0, 0, 0 }, -- extra window margin [top, right, bottom, left] - padding = { 1, 0, 1, 0 }, -- extra window padding [top, right, bottom, left] - }, - layout = { - height = { min = 1, max = 25 }, -- min and max height of the columns - width = { min = 20, max = 50 }, -- min and max width of the columns - spacing = 1, -- spacing between columns - 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 - 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 - - triggers_blacklist = { - -- list of mode / prefixes that should never be hooked by WhichKey - -- this is mostly relevant for key maps that start with a native binding - -- most people should not need to change this - n = { "o", "O" }, - }, -} diff --git a/lua/config/yanky.lua b/lua/config/yanky.lua deleted file mode 100644 index 0f8eceb..0000000 --- a/lua/config/yanky.lua +++ /dev/null @@ -1,13 +0,0 @@ -require("yanky").setup({ - ring = { - history_length = 50, - storage = "memory", - }, - preserve_cursor_position = { - enabled = false, - }, -}) - --- cycle through the yank history, only work after paste -vim.keymap.set("n", "[y", "<Plug>(YankyCycleForward)") -vim.keymap.set("n", "]y", "<Plug>(YankyCycleBackward)") diff --git a/lua/config/zen-mode.lua b/lua/config/zen-mode.lua deleted file mode 100644 index b6d52ce..0000000 --- a/lua/config/zen-mode.lua +++ /dev/null @@ -1,15 +0,0 @@ -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, - options = { - -- signcolumn = "no", -- disable signcolumn - -- number = false, -- disable number column - -- relativenumber = false, -- disable relative numbers - cursorline = false, -- disable cursorline - cursorcolumn = false, -- disable cursor column - foldcolumn = "0", -- disable fold column - list = false, -- disable whitespace characters - }, - }, -} diff --git a/lua/globals.lua b/lua/globals.lua deleted file mode 100644 index b0af26e..0000000 --- a/lua/globals.lua +++ /dev/null @@ -1,75 +0,0 @@ -local fn = vim.fn -local api = vim.api - -local utils = require('utils') - --- Inspect something -function _G.inspect(item) - vim.print(item) -end - ------------------------------------------------------------------------- --- custom variables -- ------------------------------------------------------------------------- -vim.g.is_win = (utils.has("win32") or utils.has("win64")) and true or false -vim.g.is_linux = (utils.has("unix") and (not utils.has("macunix"))) and true or false -vim.g.is_mac = utils.has("macunix") and true or false - -vim.g.logging_level = "info" - ------------------------------------------------------------------------- --- builtin variables -- ------------------------------------------------------------------------- -vim.g.loaded_perl_provider = 0 -- Disable perl provider -vim.g.loaded_ruby_provider = 0 -- Disable ruby provider -vim.g.loaded_node_provider = 0 -- Disable node provider -vim.g.did_install_default_menus = 1 -- do not load menu - -if utils.executable('python3') then - if vim.g.is_win then - vim.g.python3_host_prog = fn.substitute(fn.exepath("python3"), ".exe$", '', 'g') - else - vim.g.python3_host_prog = fn.exepath("python3") - end -else - api.nvim_err_writeln("Python3 executable not found! You must install Python3 and set its PATH correctly!") - return -end - --- Custom mapping <leader> (see `:h mapleader` for more info) -vim.g.mapleader = ',' - --- Enable highlighting for lua HERE doc inside vim script -vim.g.vimsyn_embed = 'l' - --- Use English as main language -vim.cmd [[language en_US.UTF-8]] - --- Disable loading certain plugins - --- Whether to load netrw by default, see https://github.com/bling/dotvim/issues/4 -vim.g.loaded_netrw = 1 -vim.g.loaded_netrwPlugin = 1 -vim.g.netrw_liststyle = 3 -if vim.g.is_win then - vim.g.netrw_http_cmd = "curl --ssl-no-revoke -Lo" -end - --- Do not load tohtml.vim -vim.g.loaded_2html_plugin = 1 - --- Do not load zipPlugin.vim, gzip.vim and tarPlugin.vim (all these plugins are --- related to checking files inside compressed files) -vim.g.loaded_zipPlugin = 1 -vim.g.loaded_gzip = 1 -vim.g.loaded_tarPlugin = 1 - --- Do not load the tutor plugin -vim.g.loaded_tutor_mode_plugin = 1 - --- Do not use builtin matchit.vim and matchparen.vim since we use vim-matchup -vim.g.loaded_matchit = 1 -vim.g.loaded_matchparen = 1 - --- Disable sql omni completion, it is broken. -vim.g.loaded_sql_completion = 1 diff --git a/lua/utils.lua b/lua/utils.lua deleted file mode 100644 index fef4178..0000000 --- a/lua/utils.lua +++ /dev/null @@ -1,59 +0,0 @@ -local fn = vim.fn - -local M = {} - -function M.executable(name) - if fn.executable(name) > 0 then - return true - end - - return false -end - ---- check whether a feature exists in Nvim ---- @feat: string ---- the feature name, like `nvim-0.7` or `unix`. ---- return: bool -M.has = function(feat) - if fn.has(feat) == 1 then - return true - end - - return false -end - ---- Create a dir if it does not exist -function M.may_create_dir(dir) - local res = fn.isdirectory(dir) - - if res == 0 then - fn.mkdir(dir, "p") - end -end - ---- Generate random integers in the range [Low, High], inclusive, ---- adapted from https://stackoverflow.com/a/12739441/6064933 ---- @low: the lower value for this range ---- @high: the upper value for this range -function M.rand_int(low, high) - -- Use lua to generate random int, see also: https://stackoverflow.com/a/20157671/6064933 - math.randomseed(os.time()) - - return math.random(low, high) -end - ---- Select a random element from a sequence/list. ---- @seq: the sequence to choose an element -function M.rand_element(seq) - local idx = M.rand_int(1, #seq) - - return seq[idx] -end - -function M.add_pack(name) - local status, error = pcall(vim.cmd, "packadd " .. name) - - return status -end - -return M |
