diff --git a/init.lua b/init.lua deleted file mode 100755 index 491b2aa..0000000 --- a/init.lua +++ /dev/null @@ -1,14 +0,0 @@ -require("autopairs") --- require("buffers") -- not wotking atm -require("colorscheme") -require("grammar") -require("keymaps") -require("lsp") -require("lua-line") -require("nvimtree") -require("options") -require("plugins") -require("telescope") -require("term") -require("treesitter") -require("whichkey") diff --git a/lua/autopairs.lua b/lua/autopairs.lua deleted file mode 100755 index a76f41f..0000000 --- a/lua/autopairs.lua +++ /dev/null @@ -1,148 +0,0 @@ ----- If you want insert `(` after select function or method item ---local cmp_autopairs = require('nvim-autopairs.completion.cmp') ---local cmp = require('cmp') ---cmp.event:on( --- 'confirm_done', --- cmp_autopairs.on_confirm_done() ---) ---local Rule = require('nvim-autopairs.rule') ---local npairs = require('nvim-autopairs') --- ---npairs.add_rule(Rule("$$","$$","tex")) --- ---local handlers = require('nvim-autopairs.completion.handlers') --- ---cmp.event:on( --- 'confirm_done', --- cmp_autopairs.on_confirm_done({ --- filetypes = { --- -- "*" is a alias to all filetypes --- ["*"] = { --- ["("] = { --- kind = { --- cmp.lsp.CompletionItemKind.Function, --- cmp.lsp.CompletionItemKind.Method, --- }, --- handler = handlers["*"] --- } --- }, --- lua = { --- ["("] = { --- kind = { --- cmp.lsp.CompletionItemKind.Function, --- cmp.lsp.CompletionItemKind.Method --- }, --- ---@param char string --- ---@param item table item completion --- ---@param bufnr number buffer number --- ---@param rules table --- ---@param commit_character table --- handler = function(char, item, bufnr, rules, commit_character) --- -- Your handler function. Inpect with print(vim.inspect{char, item, bufnr, rules, commit_character}) --- end --- } --- }, --- -- Disable for tex --- tex = false --- } --- }) ---) --- ----- you can use some built-in conditions --- ---local cond = require('nvim-autopairs.conds') ---print(vim.inspect(cond)) --- ---npairs.add_rules({ --- Rule("$", "$",{"tex", "latex"}) --- -- don't add a pair if the next character is % --- :with_pair(cond.not_after_regex("%%")) --- -- don't add a pair if the previous character is xxx --- :with_pair(cond.not_before_regex("xxx", 3)) --- -- don't move right when repeat character --- :with_move(cond.none()) --- -- don't delete if the next character is xx --- :with_del(cond.not_after_regex("xx")) --- -- disable adding a newline when you press --- :with_cr(cond.none()) --- }, --- -- disable for .vim files, but it work for another filetypes --- Rule("a","a","-vim") ---) --- ---npairs.add_rules({ --- Rule("$$","$$","tex") --- :with_pair(function(opts) --- print(vim.inspect(opts)) --- if opts.line=="aa $$" then --- -- don't add pair on that line --- return false --- end --- end) --- } ---) --- ----- you can use regex ----- press u1234 => u1234number ---npairs.add_rules({ --- Rule("u%d%d%d%d$", "number", "lua") --- :use_regex(true) ---}) --- --- --- ----- press x1234 => x12341234 ---npairs.add_rules({ --- Rule("x%d%d%d%d$", "number", "lua") --- :use_regex(true) --- :replace_endpair(function(opts) --- -- print(vim.inspect(opts)) --- return opts.prev_char:sub(#opts.prev_char - 3,#opts.prev_char) --- end) ---}) --- --- ----- you can do anything with regex +special key ----- example press tab to uppercase text: ----- press b1234s => B1234S1234S --- ---npairs.add_rules({ --- Rule("b%d%d%d%d%w$", "", "vim") --- :use_regex(true,"") --- :replace_endpair(function(opts) --- return --- opts.prev_char:sub(#opts.prev_char - 4,#opts.prev_char) --- .."viwU" --- end) ---}) --- ----- you can exclude filetypes ---npairs.add_rule( --- Rule("$$","$$") --- :with_pair(cond.not_filetypes({"lua"})) ---) ------ check ./lua/nvim-autopairs/rules/basic.lua --- ---local npairs = require("nvim-autopairs") ---local Rule = require('nvim-autopairs.rule') --- ---npairs.setup({ --- check_ts = true, --- ts_config = { --- lua = {'string'},-- it will not add a pair on that treesitter node --- javascript = {'template_string'}, --- java = false,-- don't check treesitter on java --- } ---}) --- ---local ts_conds = require('nvim-autopairs.ts-conds') --- --- ----- press % => %% only while inside a comment or string ---npairs.add_rules({ --- Rule("%", "%", "lua") --- :with_pair(ts_conds.is_ts_node({'string','comment'})), --- Rule("$", "$", "lua") --- :with_pair(ts_conds.is_not_ts_node({'function'})) ---}) --- diff --git a/lua/buffers.lua b/lua/buffers.lua deleted file mode 100755 index 9d1a640..0000000 --- a/lua/buffers.lua +++ /dev/null @@ -1,168 +0,0 @@ -local status_ok, bufferline = pcall(require, "bufferline") -if not status_ok then - return -end - -bufferline.setup { - options = { - numbers = "none", -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string, - close_command = "bdelete! %d", -- can be a string | function, see "Mouse actions" - right_mouse_command = "bdelete! %d", -- can be a string | function, see "Mouse actions" - left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions" - middle_mouse_command = nil, -- can be a string | function, see "Mouse actions" - -- NOTE: this plugin is designed with this icon in mind, - -- and so changing this is NOT recommended, this is intended - -- as an escape hatch for people who cannot bear it for whatever reason - indicator_icon = nil, - indicator = { style = "icon", icon = "▎"}, - buffer_close_icon = "", - -- buffer_close_icon = '', - modified_icon = "●", - close_icon = "", - -- close_icon = '', - left_trunc_marker = "", - right_trunc_marker = "", - --- name_formatter can be used to change the buffer's label in the bufferline. - --- Please note some names can/will break the - --- bufferline so use this at your discretion knowing that it has - --- some limitations that will *NOT* be fixed. - -- name_formatter = function(buf) -- buf contains a "name", "path" and "bufnr" - -- -- remove extension from markdown files for example - -- if buf.name:match('%.md') then - -- return vim.fn.fnamemodify(buf.name, ':t:r') - -- end - -- end, - max_name_length = 30, - max_prefix_length = 30, -- prefix used when a buffer is de-duplicated - tab_size = 21, - diagnostics = false, -- | "nvim_lsp" | "coc", - diagnostics_update_in_insert = false, - -- diagnostics_indicator = function(count, level, diagnostics_dict, context) - -- return "("..count..")" - -- end, - -- NOTE: this will be called a lot so don't do any heavy processing here - -- custom_filter = function(buf_number) - -- -- filter out filetypes you don't want to see - -- if vim.bo[buf_number].filetype ~= "" then - -- return true - -- end - -- -- filter out by buffer name - -- if vim.fn.bufname(buf_number) ~= "" then - -- return true - -- end - -- -- filter out based on arbitrary rules - -- -- e.g. filter out vim wiki buffer from tabline in your work repo - -- if vim.fn.getcwd() == "" and vim.bo[buf_number].filetype ~= "wiki" then - -- return true - -- end - -- end, - offsets = { { filetype = "NvimTree", text = "", padding = 1 } }, - show_buffer_icons = true, - 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 - -- can also be a table containing 2 custom separators - -- [focused and unfocused]. eg: { '|', '|' } - separator_style = "thin", -- | "thick" | "thin" | { 'any', 'any' }, - enforce_regular_tabs = true, - always_show_bufferline = true, - -- sort_by = 'id' | 'extension' | 'relative_directory' | 'directory' | 'tabs' | function(buffer_a, buffer_b) - -- -- add custom logic - -- return buffer_a.modified > buffer_b.modified - -- end - }, - highlights = { - fill = { - fg = { attribute = "fg", highlight = "#ff0000" }, - bg = { attribute = "bg", highlight = "TabLine" }, - }, - background = { - fg = { attribute = "fg", highlight = "TabLine" }, - bg = { attribute = "bg", highlight = "TabLine" }, - }, - - -- buffer_selected = { - -- fg = {attribute='fg',highlight='#ff0000'}, - -- bg = {attribute='bg',highlight='#0000ff'}, - -- gui = 'none' - -- }, - buffer_visible = { - fg = { attribute = "fg", highlight = "TabLine" }, - bg = { attribute = "bg", highlight = "TabLine" }, - }, - - close_button = { - fg = { attribute = "fg", highlight = "TabLine" }, - bg = { attribute = "bg", highlight = "TabLine" }, - }, - close_button_visible = { - fg = { attribute = "fg", highlight = "TabLine" }, - bg = { attribute = "bg", highlight = "TabLine" }, - }, - -- close_button_selected = { - -- fg = {attribute='fg',highlight='TabLineSel'}, - -- bg ={attribute='bg',highlight='TabLineSel'} - -- }, - - tab_selected = { - fg = { attribute = "fg", highlight = "Normal" }, - bg = { attribute = "bg", highlight = "Normal" }, - }, - tab = { - fg = { attribute = "fg", highlight = "TabLine" }, - bg = { attribute = "bg", highlight = "TabLine" }, - }, - tab_close = { - -- fg = {attribute='fg',highlight='LspDiagnosticsDefaultError'}, - fg = { attribute = "fg", highlight = "TabLineSel" }, - bg = { attribute = "bg", highlight = "Normal" }, - }, - - duplicate_selected = { - fg = { attribute = "fg", highlight = "TabLineSel" }, - bg = { attribute = "bg", highlight = "TabLineSel" }, - underline = true, - }, - duplicate_visible = { - fg = { attribute = "fg", highlight = "TabLine" }, - bg = { attribute = "bg", highlight = "TabLine" }, - underline = true, - }, - duplicate = { - fg = { attribute = "fg", highlight = "TabLine" }, - bg = { attribute = "bg", highlight = "TabLine" }, - underline = true, - }, - - modified = { - fg = { attribute = "fg", highlight = "TabLine" }, - bg = { attribute = "bg", highlight = "TabLine" }, - }, - modified_selected = { - fg = { attribute = "fg", highlight = "Normal" }, - bg = { attribute = "bg", highlight = "Normal" }, - }, - modified_visible = { - fg = { attribute = "fg", highlight = "TabLine" }, - bg = { attribute = "bg", highlight = "TabLine" }, - }, - - separator = { - fg = { attribute = "bg", highlight = "TabLine" }, - bg = { attribute = "bg", highlight = "TabLine" }, - }, - separator_selected = { - fg = { attribute = "bg", highlight = "Normal" }, - bg = { attribute = "bg", highlight = "Normal" }, - }, - -- separator_visible = { - -- fg = {attribute='bg',highlight='TabLine'}, - -- bg = {attribute='bg',highlight='TabLine'} - -- }, - indicator_selected = { - fg = { attribute = "fg", highlight = "LspDiagnosticsDefaultHint" }, - bg = { attribute = "bg", highlight = "Normal" }, - }, - }, -} diff --git a/lua/colorscheme.lua b/lua/colorscheme.lua deleted file mode 100755 index c2f965d..0000000 --- a/lua/colorscheme.lua +++ /dev/null @@ -1,21 +0,0 @@ --- define colorscheme here ---[[ -local colorscheme = "rose" - -local is_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme) -if not is_ok then - vim.notify("colorscheme " .. colorscheme .. " not found!") - return -end -]]-- - -function ColorSchemes(color) - color = color or "rose-pine" - vim.cmd.colorscheme(color) - - --vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) - --vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) -end - -ColorSchemes() - diff --git a/lua/grammar.lua b/lua/grammar.lua deleted file mode 100755 index 93c2044..0000000 --- a/lua/grammar.lua +++ /dev/null @@ -1,21 +0,0 @@ -require("grammar-guard").init() - -require("lspconfig").grammar_guard.setup({ - cmd = { '/usr/bin/ltex-ls' }, -- add this if you install ltex-ls yourself - settings = { - ltex = { - enabled = { "latex", "tex", "bib", "markdown" }, - language = "en", - diagnosticSeverity = "information", - setenceCacheSize = 2000, - additionalRules = { - enablePickyRules = true, - motherTongue = "en", - }, - trace = { server = "verbose" }, - dictionary = {}, - disabledRules = {}, - hiddenFalsePositives = {}, - }, - }, -}) diff --git a/lua/keymaps.lua b/lua/keymaps.lua deleted file mode 100755 index 9467674..0000000 --- a/lua/keymaps.lua +++ /dev/null @@ -1,84 +0,0 @@ --- define common options -local opts = { - noremap = true, -- non-recursive - silent = true, -- do not show message -} - ------------------ --- Normal mode -- ------------------ - --- Hint: see `:h vim.map.set()` --- Better window navigation -vim.keymap.set("n", "", "h", opts) -vim.keymap.set("n", "", "j", opts) -vim.keymap.set("n", "", "k", opts) -vim.keymap.set("n", "", "l", opts) - --- Resize with arrows --- delta: 2 lines -vim.keymap.set("n", "", ":resize -2", opts) -vim.keymap.set("n", "", ":resize +2", opts) -vim.keymap.set("n", "", ":vertical resize -2", opts) -vim.keymap.set("n", "", ":vertical resize +2", opts) - --- Open explorer ---vim.keymap.set("n", "pv", vim.cmd.Ex, opts) - --- Navigate buffers -vim.keymap.set("n", "", ":bnext", opts) -vim.keymap.set("n", "", ":bprevious", opts) - --- Telescope -local builtin = require("telescope.builtin") ---vim.keymap.set("n", "pf", builtin.find_files, {}) ---vim.keymap.set("n", "", builtin.git_files, {}) ---vim.keymap.set("n", "ps", function () --- builtin.grep_string( { search = vim.fn.input("Grep > ") } ); ---end) - --- Harpoon -local mark = require("harpoon.mark") -local ui = require("harpoon.ui") -vim.keymap.set("n", "a", mark.add_file) -vim.keymap.set("n", "", ui.toggle_quick_menu) - -vim.keymap.set("n", "", function () ui.nav_file(1) end) -vim.keymap.set("n", "", function () ui.nav_file(2) end) -vim.keymap.set("n", "", function () ui.nav_file(3) end) -vim.keymap.set("n", "", function () ui.nav_file(4) end) - --- Undotree -vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) - --- Fugitive -vim.keymap.set("n", "gs", vim.cmd.Git) - --- Put line bellow in-front of line -vim.keymap.set("n", "J", "mzJ`z") - --- Keep cursor in the middle -vim.keymap.set("n", "", "zz") -vim.keymap.set("n", "", "zz") -vim.keymap.set("n", "n", "nzzzv") -vim.keymap.set("n", "N", "Nzzzv") - --- Don't loose buffer -vim.keymap.set("x", "p", "\"_dP") - - ------------------ --- Visual mode -- ------------------ - --- Hint: start visual mode with the same area as the previous area and the same mode -vim.keymap.set("v", "<", "", ">gv", opts) - --- Move text on visual mode -vim.keymap.set("v", "J", ":m '>+1gv=gv", opts) -vim.keymap.set("v", "K", ":m '<-2gv=gv", opts) - - - - diff --git a/lua/lsp.lua b/lua/lsp.lua deleted file mode 100755 index 6a52ce7..0000000 --- a/lua/lsp.lua +++ /dev/null @@ -1,136 +0,0 @@ -require("mason").setup({ - ui = { - icons = { - package_installed = "✓", - package_pending = "➜", - package_uninstalled = "✗" - } - } -}) - -require("mason-lspconfig").setup({ - -- A list of servers to automatically install if they"re not already installed - --ensure_installed = { "pylsp", "gopls", "lua_ls", "rust_analyzer" }, - --ensure_installed = { "pylsp", "lua_ls", "julials", "zls", "ltex", "texlab" }, - ensure_installed = { "pylsp", "lua_ls", "julials", "zls", "ltex", "texlab" }, -}) - --- Set different settings for different languages" LSP --- LSP list: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md --- How to use setup({}): https://github.com/neovim/nvim-lspconfig/wiki/Understanding-setup-%7B%7D --- - the settings table is sent to the LSP --- - on_attach: a lua callback function to run after LSP attaches to a given buffer -local lspconfig = require("lspconfig") - --- Customized on_attach function --- See `:help vim.diagnostic.*` for documentation on any of the below functions -local opts = { noremap = true, silent = true } -vim.keymap.set("n", "e", vim.diagnostic.open_float, opts) -vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) -vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts) -vim.keymap.set("n", "q", vim.diagnostic.setloclist, opts) - --- Use an on_attach function to only map the following keys --- after the language server attaches to the current buffer -local on_attach = function(_, bufnr) - -- Enable completion triggered by - vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") - -- For Zig - --require("completion").on_attach() - - -- See `:help vim.lsp.*` for documentation on any of the below functions - local bufopts = { noremap = true, silent = true, buffer = bufnr } - vim.keymap.set("n", "gD", vim.lsp.buf.declaration, bufopts) - vim.keymap.set("n", "gd", vim.lsp.buf.definition, bufopts) - vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts) - vim.keymap.set("n", "gi", vim.lsp.buf.implementation, bufopts) - vim.keymap.set("n", "", vim.lsp.buf.signature_help, bufopts) - vim.keymap.set("n", "wa", vim.lsp.buf.add_workspace_folder, bufopts) - vim.keymap.set("n", "wr", vim.lsp.buf.remove_workspace_folder, bufopts) - vim.keymap.set("n", "wl", function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, bufopts) - vim.keymap.set("n", "D", vim.lsp.buf.type_definition, bufopts) - vim.keymap.set("n", "rn", vim.lsp.buf.rename, bufopts) - vim.keymap.set("n", "ca", vim.lsp.buf.code_action, bufopts) - vim.keymap.set("n", "gr", vim.lsp.buf.references, bufopts) - vim.keymap.set("n", "f", function() vim.lsp.buf.format { async = true } end, bufopts) -end - --- Configure each language - -lspconfig.lua_ls.setup { - 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 - library = vim.api.nvim_get_runtime_file("", true), - }, - -- Do not send telemetry data containing a randomized but unique identifier - telemetry = { - enable = false, - }, - }, - }, -} - -lspconfig.pylsp.setup({ - on_attach = on_attach, -}) - ---lspconfig.gopls.setup({ --- on_attach = on_attach, ---}) - -lspconfig.julials.setup({ - --on_attach = on_attach, - symbol_cache_download = true, - --symbol_server = "https://symbol-server", - on_new_config = function(new_config, _) - local julia = vim.fn.expand("/usr/share/julia/bin/julia") - if require'lspconfig'.util.path.is_file(julia) then - vim.notify("Hello!") - new_config.cmd[1] = julia - end - end -}) - -lspconfig.texlab.setup({ - on_attach = on_attach, -}) - -lspconfig.zls.setup({ - on_attach = on_attach, -}) - -lspconfig.bashls.setup({ - on_attach = on_attach, -}) - -lspconfig.ltex.setup({ - settings = { - ltex = { - language = "en-GB", - }, - }, -}) --- source: https://rust-analyzer.github.io/manual.html#nvim-lsp ---lspconfig.rust_analyzer.setup({ --- on_attach = on_attach, --- settings = { --- ["rust-analyzer"] = { --- inlayHints = { --- closingBraceHints = true, -- Whether to show inlay hints after a closing } to indicate what item it belongs to. --- } --- } --- } ---}) - diff --git a/lua/lua-line.lua b/lua/lua-line.lua deleted file mode 100755 index e6ae731..0000000 --- a/lua/lua-line.lua +++ /dev/null @@ -1,43 +0,0 @@ -require("lualine").setup({}) ---[[ -require("lualine").setup { - options = { - icons_enabled = true, - theme = "auto", - component_separators = { left = "", right = ""}, - section_separators = { left = "", right = ""}, - disabled_filetypes = { - statusline = {}, - winbar = {}, - }, - ignore_focus = {}, - always_divide_middle = true, - globalstatus = false, - refresh = { - statusline = 1000, - tabline = 1000, - winbar = 1000, - } - }, - sections = { - lualine_a = {"mode"}, - lualine_b = {"branch", "diff", "diagnostics"}, - lualine_c = {"filename"}, - lualine_x = {"encoding", "fileformat", "filetype"}, - lualine_y = {"progress"}, - lualine_z = {"location"} - }, - inactive_sections = { - lualine_a = {}, - lualine_b = {}, - lualine_c = {"filename"}, - lualine_x = {"location"}, - lualine_y = {}, - lualine_z = {} - }, - tabline = {}, - winbar = {}, - inactive_winbar = {}, - extensions = {} -} -]]-- diff --git a/lua/nvimtree.lua b/lua/nvimtree.lua deleted file mode 100755 index df3b05c..0000000 --- a/lua/nvimtree.lua +++ /dev/null @@ -1 +0,0 @@ -require("nvim-tree").setup() diff --git a/lua/options.lua b/lua/options.lua deleted file mode 100755 index daea7a7..0000000 --- a/lua/options.lua +++ /dev/null @@ -1,107 +0,0 @@ --- Hint: use `:h