diff --git a/config/lvim/config.lua b/config/lvim/config.lua index 19385e8..1bf4a53 100644 --- a/config/lvim/config.lua +++ b/config/lvim/config.lua @@ -12,94 +12,29 @@ lvim.builtin.gitsigns.opts.current_line_blame = true lvim.builtin.gitsigns.opts.current_line_blame_opts = { delay = 200 } -- TreeSitter -lvim.builtin.treesitter.ensure_installed = { "javascript", "typescript", "jsdoc", "lua", "go" } -lvim.builtin.treesitter.indent.disable = { "clojure", "java", "python" } +lvim.builtin.treesitter.ensure_installed = { + "javascript", + "typescript", + "jsdoc", + "yaml", + "toml", + "lua", + "go", +} +lvim.builtin.treesitter.indent.disable = { "python" } -- Telescope lvim.builtin.telescope.defaults.layout_config.prompt_position = "top" -lvim.builtin.telescope.defaults.file_ignore_patterns = { ".git", "node_modules", "env", ".bin" } +lvim.builtin.telescope.defaults.file_ignore_patterns = { + ".git", + "node_modules", + "env", + ".bin", +} -- NvimTree lvim.builtin.nvimtree.ignore = { ".git", "node_modules", ".bin", "env" } --- Mappings -lvim.keys.normal_mode[""] = "BufferClose" -lvim.keys.normal_mode[""] = "w" -lvim.keys.visual_mode["jk"] = "" -lvim.builtin.which_key.mappings.l.a = { "Telescope lsp_code_actions", "Code Actions" } -lvim.builtin.which_key.mappings.l.d = { "TroubleToggle", "Diagnostics" } -lvim.builtin.which_key.mappings.l.R = { "TroubleToggle lsp_references", "References" } -lvim.builtin.which_key.mappings["t"] = { - name = "Test", - t = { "Ultest", "Run test" }, - s = { "UltestStop", "Stop test" }, - c = { "UltestClear", "Clear test result" }, - n = { "UltestNearest", "Run test order by cursor" }, - o = { "UltestOutput", "Show output order by cursor" }, - j = { "(ultest-next-fail)", "Next fail" }, - k = { "(ultest-prev-fail)", "Prev fail" }, -} - -for i = 1, 9 do - lvim.keys.normal_mode[string.format("", i)] = string.format("BufferGoto %d", i) -end - --- Pluginos -lvim.plugins = { - { "tpope/vim-surround", keys = { "c", "y", "d" }, event = "BufRead" }, - { "folke/trouble.nvim", cmd = { "TroubleToggle" } }, - { "editorconfig/editorconfig-vim" }, - { - "theHamsta/nvim-dap-virtual-text", - config = function() - require("user.conjure").setup() - end, - }, - { - "folke/todo-comments.nvim", - event = "BufRead", - config = function() - require("todo-comments").setup({}) - end, - }, - { - "tzachar/cmp-tabnine", - run = "./install.sh", - event = "InsertEnter", - config = function() - require("cmp_tabnine.config"):setup({ - max_lines = 1000, - max_num_results = 10, - sort = true, - }) - end, - }, - { - "folke/lua-dev.nvim", - ft = "lua", - config = function() - require("user.lua-dev").setup() - end, - }, - { - "Smirnov-O/ts-unit.nvim", - keys = { "vip", "cip", "yip", "dip" }, - config = function() - require("ts-unit").setup({ keymaps = true }) - end, - }, - { - "Olical/conjure", - ft = { "clojure", "fennel", "scheme" }, - requires = { { "PaterJason/cmp-conjure", after = "conjure" } }, - config = function() - require("user.conjure").setup() - end, - }, - { - "rcarriga/vim-ultest", - requires = { { "vim-test/vim-test", after = "vim-ultest" } }, - cmd = { "Ultest", "UltestStop", "UltestClear", "UltestNearest", "UltestOutput" }, - run = ":UpdateRemotePlugins", - }, -} +-- Others +require "user.plugins" +require "user.keymaps" diff --git a/config/lvim/ftplugin/java.lua b/config/lvim/ftplugin/java.lua deleted file mode 100644 index 6529eba..0000000 --- a/config/lvim/ftplugin/java.lua +++ /dev/null @@ -1,22 +0,0 @@ -if vim.fn.has("mac") == 1 then - WORKSPACE_PATH = "/Users/" .. USER .. "/workspace/" -elseif vim.fn.has("unix") == 1 then - WORKSPACE_PATH = "/home/" .. USER .. "/workspace/" -else - print("Unsupported system") -end - -JAVA_LS_EXECUTABLE = os.getenv("HOME") .. "/.local/share/lunarvim/lvim/utils/bin/jdtls" - -require("jdtls").start_or_attach({ - on_attach = require("lsp").common_on_attach, - cmd = { JAVA_LS_EXECUTABLE, WORKSPACE_PATH .. vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") }, -}) - -vim.api.nvim_set_keymap("n", "la", ":lua require('jdtls').code_action()", { noremap = true, silent = true }) - -vim.cmd("command! -buffer JdtCompile lua require('jdtls').compile()") -vim.cmd("command! -buffer JdtUpdateConfig lua require('jdtls').update_project_config()") -vim.cmd("command! -buffer JdtJol lua require('jdtls').jol()") -vim.cmd("command! -buffer JdtBytecode lua require('jdtls').javap()") -vim.cmd("command! -buffer JdtJshell lua require('jdtls').jshell()") diff --git a/config/lvim/lsp-settings/jdtls.json b/config/lvim/lsp-settings/jdtls.json deleted file mode 100644 index a9132f7..0000000 --- a/config/lvim/lsp-settings/jdtls.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "java.format.enabled": true -} diff --git a/config/lvim/lsp-settings/yamlls.json b/config/lvim/lsp-settings/yamlls.json index 9b86baf..7e9daa7 100644 --- a/config/lvim/lsp-settings/yamlls.json +++ b/config/lvim/lsp-settings/yamlls.json @@ -1,7 +1,6 @@ { "yaml.schemas": { "https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json": ["docker-compose.yml", "docker-compose.yaml"], - "https://json.schemastore.org/ansible-playbook.json": ["*/playbook/**/*.yml", "*/playbooks/**/*.yml", "*/playbook/**/*.yaml", "*/playbooks/**/*.yaml", "ansible-playbook.yml"], "https://json.schemastore.org/yamllint.json": [".yamllint", ".yamllint.yml", ".yamllint.yaml"], "https://yarnpkg.com/configuration/yarnrc.json": [".yarnrc", ".yarnrc.yml"], "https://json.schemastore.org/github-action.json": ["*/.github/workflows/**/*.yml", "*/.github/workflows/**/*.yaml" ], diff --git a/config/lvim/lua/user/dap-virtual-text.lua b/config/lvim/lua/plug/dap.lua similarity index 61% rename from config/lvim/lua/user/dap-virtual-text.lua rename to config/lvim/lua/plug/dap.lua index 755f7b8..406f671 100644 --- a/config/lvim/lua/user/dap-virtual-text.lua +++ b/config/lvim/lua/plug/dap.lua @@ -1,6 +1,7 @@ local M = {} -M.setup = function () +function M.setup() + -- Virtual text vim.g.dap_virtual_text = true end diff --git a/config/lvim/lua/plug/lua-dev.lua b/config/lvim/lua/plug/lua-dev.lua new file mode 100644 index 0000000..6063bb2 --- /dev/null +++ b/config/lvim/lua/plug/lua-dev.lua @@ -0,0 +1,12 @@ +local M = {} + +function M.setup() + local ok, lua_dev = pcall(require, "lua-dev") + if not ok then + return + end + + lua_dev.setup {} +end + +return M diff --git a/config/lvim/lua/plug/tabnine.lua b/config/lvim/lua/plug/tabnine.lua new file mode 100644 index 0000000..fda0bd1 --- /dev/null +++ b/config/lvim/lua/plug/tabnine.lua @@ -0,0 +1,16 @@ +local M = {} + +function M.setup() + local ok, tabnine = pcall(require, "cmp_tabnine.config") + if not ok then + return + end + + tabnine:setup { + max_lines = 1000, + max_num_results = 10, + sort = true, + } +end + +return M diff --git a/config/lvim/lua/plug/todo-comment.lua b/config/lvim/lua/plug/todo-comment.lua new file mode 100644 index 0000000..5bbfbfd --- /dev/null +++ b/config/lvim/lua/plug/todo-comment.lua @@ -0,0 +1,12 @@ +local M = {} + +function M.setup() + local ok, todo_comments = pcall(require, "todo-comments") + if not ok then + return + end + + todo_comments.setup {} +end + +return M diff --git a/config/lvim/lua/plug/ts-unit.lua b/config/lvim/lua/plug/ts-unit.lua new file mode 100644 index 0000000..a5f23c4 --- /dev/null +++ b/config/lvim/lua/plug/ts-unit.lua @@ -0,0 +1,14 @@ +local M = {} + +function M.setup() + local ok, ts_unit = pcall(require, "ts-unit") + if not ok then + return + end + + ts_unit.setup { + keymaps = true, + } +end + +return M diff --git a/config/lvim/lua/user/conjure.lua b/config/lvim/lua/user/conjure.lua deleted file mode 100644 index 4fa27c0..0000000 --- a/config/lvim/lua/user/conjure.lua +++ /dev/null @@ -1,16 +0,0 @@ -local M = {} - -M.setup = function() - vim.g.maplocalleader = "," - vim.g["conjure#mapping#doc_word"] = "K" - - -- Clojure - vim.g["conjure#client#clojure#nrepl#eval#auto_require"] = false - vim.g["conjure#client#clojure#nrepl#connection#auto_repl#enabled"] = false - - -- Scheme - vim.g["conjure#client#scheme#stdio#command"] = "chicken-csi -quiet -:c" - vim.g["conjure#client#scheme#stdio#prompt_pattern"] = "\n-#;%d-> " -end - -return M diff --git a/config/lvim/lua/user/keymaps.lua b/config/lvim/lua/user/keymaps.lua new file mode 100644 index 0000000..64d09e1 --- /dev/null +++ b/config/lvim/lua/user/keymaps.lua @@ -0,0 +1,25 @@ +lvim.keys.normal_mode[""] = "BufferClose" +lvim.keys.normal_mode[""] = "w" +lvim.keys.visual_mode["jk"] = "" + +-- Which key +lvim.builtin.which_key.mappings.l.a = { "Telescope lsp_code_actions", "Code Actions" } +lvim.builtin.which_key.mappings.l.d = { "TroubleToggle", "Diagnostics" } +lvim.builtin.which_key.mappings.l.R = { "TroubleToggle lsp_references", "References" } +lvim.builtin.which_key.mappings.s.P = { "Telescope projects", "Projects" } +lvim.builtin.which_key.mappings["t"] = { + name = "Test", + t = { "Ultest", "Run tests" }, + s = { "UltestStop", "Stop tests" }, + c = { "UltestClear", "Clear result" }, + n = { "UltestNearest", "Run test" }, + o = { "UltestOutput", "Show output" }, + j = { "(ultest-next-fail)", "Next fail" }, + k = { "(ultest-prev-fail)", "Prev fail" }, +} + +-- Beffers +local fmt = string.format +for i = 1, 9 do + lvim.keys.normal_mode[fmt("", i)] = fmt("BufferGoto %d", i) +end diff --git a/config/lvim/lua/user/plugins.lua b/config/lvim/lua/user/plugins.lua new file mode 100644 index 0000000..1fd7d45 --- /dev/null +++ b/config/lvim/lua/user/plugins.lua @@ -0,0 +1,53 @@ +lvim.plugins = { + { "tpope/vim-surround", keys = { "c", "y", "d" }, event = "BufRead" }, + { "folke/trouble.nvim", cmd = "TroubleToggle" }, + { + "theHamsta/nvim-dap-virtual-text", + config = function() + require("plug.dap").setup() + end, + }, + { + "folke/todo-comments.nvim", + event = "BufRead", + config = function() + require "plug.todo-comment" + end, + }, + { + "tzachar/cmp-tabnine", + run = "./install.sh", + event = "InsertEnter", + config = function() + require "plug.tabnine" + end, + }, + { + "folke/lua-dev.nvim", + ft = "lua", + config = function() + require("plug.lua-dev").setup() + end, + }, + { + "Smirnov-O/ts-unit.nvim", + keys = { "vip", "cip", "yip", "dip" }, + config = function() + require "plug.ts-unit" + end, + }, + { + "rcarriga/vim-ultest", + requires = { + { "vim-test/vim-test", after = "vim-ultest" }, + }, + run = ":UpdateRemotePlugins", + cmd = { + "Ultest", + "UltestStop", + "UltestClear", + "UltestNearest", + "UltestOutput", + }, + }, +} diff --git a/config/lvim/selene.toml b/config/lvim/selene.toml new file mode 100644 index 0000000..7312a91 --- /dev/null +++ b/config/lvim/selene.toml @@ -0,0 +1 @@ +std="vim" diff --git a/config/lvim/stylua.toml b/config/lvim/stylua.toml new file mode 100644 index 0000000..df96b7b --- /dev/null +++ b/config/lvim/stylua.toml @@ -0,0 +1,6 @@ +column_width = 120 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" +no_call_parentheses = true diff --git a/config/lvim/vim.toml b/config/lvim/vim.toml new file mode 100644 index 0000000..0ebbeb1 --- /dev/null +++ b/config/lvim/vim.toml @@ -0,0 +1,9 @@ +[selene] +base = "lua52" +name = "vim" + +[vim] +any = true + +[lvim] +any = true