update lvim

This commit is contained in:
neoteny 2021-10-03 17:31:30 +03:00
parent a537caddf0
commit da1068fdc2
15 changed files with 169 additions and 127 deletions

View file

@ -12,94 +12,29 @@ lvim.builtin.gitsigns.opts.current_line_blame = true
lvim.builtin.gitsigns.opts.current_line_blame_opts = { delay = 200 } lvim.builtin.gitsigns.opts.current_line_blame_opts = { delay = 200 }
-- TreeSitter -- TreeSitter
lvim.builtin.treesitter.ensure_installed = { "javascript", "typescript", "jsdoc", "lua", "go" } lvim.builtin.treesitter.ensure_installed = {
lvim.builtin.treesitter.indent.disable = { "clojure", "java", "python" } "javascript",
"typescript",
"jsdoc",
"yaml",
"toml",
"lua",
"go",
}
lvim.builtin.treesitter.indent.disable = { "python" }
-- Telescope -- Telescope
lvim.builtin.telescope.defaults.layout_config.prompt_position = "top" 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 -- NvimTree
lvim.builtin.nvimtree.ignore = { ".git", "node_modules", ".bin", "env" } lvim.builtin.nvimtree.ignore = { ".git", "node_modules", ".bin", "env" }
-- Mappings -- Others
lvim.keys.normal_mode["<C-w>"] = "<cmd>BufferClose<cr>" require "user.plugins"
lvim.keys.normal_mode["<C-s>"] = "<cmd>w<cr>" require "user.keymaps"
lvim.keys.visual_mode["jk"] = "<esc>"
lvim.builtin.which_key.mappings.l.a = { "<cmd>Telescope lsp_code_actions<cr>", "Code Actions" }
lvim.builtin.which_key.mappings.l.d = { "<cmd>TroubleToggle<cr>", "Diagnostics" }
lvim.builtin.which_key.mappings.l.R = { "<cmd>TroubleToggle lsp_references<cr>", "References" }
lvim.builtin.which_key.mappings["t"] = {
name = "Test",
t = { "<cmd>Ultest<cr>", "Run test" },
s = { "<cmd>UltestStop<cr>", "Stop test" },
c = { "<cmd>UltestClear<cr>", "Clear test result" },
n = { "<cmd>UltestNearest<cr>", "Run test order by cursor" },
o = { "<cmd>UltestOutput<cr>", "Show output order by cursor" },
j = { "<Plug>(ultest-next-fail)", "Next fail" },
k = { "<Plug>(ultest-prev-fail)", "Prev fail" },
}
for i = 1, 9 do
lvim.keys.normal_mode[string.format("<A-%d>", i)] = string.format("<cmd>BufferGoto %d<cr>", 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",
},
}

View file

@ -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", "<leader>la", ":lua require('jdtls').code_action()<CR>", { 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()")

View file

@ -1,3 +0,0 @@
{
"java.format.enabled": true
}

View file

@ -1,7 +1,6 @@
{ {
"yaml.schemas": { "yaml.schemas": {
"https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json": ["docker-compose.yml", "docker-compose.yaml"], "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://json.schemastore.org/yamllint.json": [".yamllint", ".yamllint.yml", ".yamllint.yaml"],
"https://yarnpkg.com/configuration/yarnrc.json": [".yarnrc", ".yarnrc.yml"], "https://yarnpkg.com/configuration/yarnrc.json": [".yarnrc", ".yarnrc.yml"],
"https://json.schemastore.org/github-action.json": ["*/.github/workflows/**/*.yml", "*/.github/workflows/**/*.yaml" ], "https://json.schemastore.org/github-action.json": ["*/.github/workflows/**/*.yml", "*/.github/workflows/**/*.yaml" ],

View file

@ -1,6 +1,7 @@
local M = {} local M = {}
M.setup = function () function M.setup()
-- Virtual text
vim.g.dap_virtual_text = true vim.g.dap_virtual_text = true
end end

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -0,0 +1,25 @@
lvim.keys.normal_mode["<C-w>"] = "<cmd>BufferClose<cr>"
lvim.keys.normal_mode["<C-s>"] = "<cmd>w<cr>"
lvim.keys.visual_mode["jk"] = "<esc>"
-- Which key
lvim.builtin.which_key.mappings.l.a = { "<cmd>Telescope lsp_code_actions<cr>", "Code Actions" }
lvim.builtin.which_key.mappings.l.d = { "<cmd>TroubleToggle<cr>", "Diagnostics" }
lvim.builtin.which_key.mappings.l.R = { "<cmd>TroubleToggle lsp_references<cr>", "References" }
lvim.builtin.which_key.mappings.s.P = { "<cmd>Telescope projects<cr>", "Projects" }
lvim.builtin.which_key.mappings["t"] = {
name = "Test",
t = { "<cmd>Ultest<cr>", "Run tests" },
s = { "<cmd>UltestStop<cr>", "Stop tests" },
c = { "<cmd>UltestClear<cr>", "Clear result" },
n = { "<cmd>UltestNearest<cr>", "Run test" },
o = { "<cmd>UltestOutput<cr>", "Show output" },
j = { "<Plug>(ultest-next-fail)", "Next fail" },
k = { "<Plug>(ultest-prev-fail)", "Prev fail" },
}
-- Beffers
local fmt = string.format
for i = 1, 9 do
lvim.keys.normal_mode[fmt("<A-%d>", i)] = fmt("<cmd>BufferGoto %d<cr>", i)
end

View file

@ -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",
},
},
}

1
config/lvim/selene.toml Normal file
View file

@ -0,0 +1 @@
std="vim"

6
config/lvim/stylua.toml Normal file
View file

@ -0,0 +1,6 @@
column_width = 120
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferDouble"
no_call_parentheses = true

9
config/lvim/vim.toml Normal file
View file

@ -0,0 +1,9 @@
[selene]
base = "lua52"
name = "vim"
[vim]
any = true
[lvim]
any = true