add lunarvim config

This commit is contained in:
ksyasuda 2022-01-02 20:45:45 -08:00
parent 2140d3ca05
commit 914a5dd2e9
4 changed files with 301 additions and 0 deletions

View File

@ -0,0 +1 @@
require("lvim.lsp.manager").setup("jedi_language_server")

207
lvim/config.lua Normal file
View File

@ -0,0 +1,207 @@
-- general
lvim.log.level = "warn"
lvim.format_on_save = true
lvim.colorscheme = "onedarker"
lvim.leader = "space"
lvim.keys.normal_mode["<C-s>"] = ":w<cr>"
-- custom settings
vim.opt.relativenumber = true
vim.opt.wrap = true
vim.opt.undofile = false
lvim.builtin.dashboard.active = true
lvim.builtin.terminal.active = true
lvim.builtin.nvimtree.setup.view.side = "left"
lvim.builtin.nvimtree.show_icons.git = 1
local components = require("lvim.core.lualine.components")
lvim.builtin.lualine.sections.lualine_a = { "mode" }
lvim.builtin.lualine.sections.lualine_c = { components.python_env }
lvim.builtin.lualine.sections.lualine_y = {
components.location,
}
lvim.builtin.treesitter.ensure_installed = {
"bash",
"c",
"javascript",
"json",
"lua",
"python",
"typescript",
"css",
"rust",
"java",
"yaml",
}
lvim.builtin.treesitter.ignore_install = { "haskell" }
lvim.builtin.treesitter.highlight.enabled = true
local formatters = require "lvim.lsp.null-ls.formatters"
formatters.setup {
{ exe = "black", filetypes = { "python" } },
{ exe = "isort", filetypes = { "python" } },
{
exe = "prettier",
args = { "--print-with", "80" },
filetypes = { "typescript", "typescriptreact", "javascript", "javascriptreact" },
},
{ exe = "shfmt", filetypes = { "shell", "sh" }, args = {'-i=0','-sr', '-ci'} },
}
-- -- set additional linters
local linters = require "lvim.lsp.null-ls.linters"
linters.setup {
{ exe = "flake8", filetypes = { "python" } },
{
exe = "shellcheck",
fieltypes = { "shell" },
args = { "--severity", "warning" },
},
-- {
-- exe = "codespell",
-- ---@usage specify which filetypes to enable. By default a providers will attach to all the filetypes it supports.
-- filetypes = { "javascript", "python" },
-- },
}
-- Additional Plugins
lvim.plugins = {
{
"folke/trouble.nvim",
cmd = "TroubleToggle",
},
{
"simrat39/symbols-outline.nvim",
cmd = "SymbolsOutline",
},
{
"ray-x/lsp_signature.nvim",
event = "BufRead",
config = function()
require "lsp_signature".setup()
end
},
{
"rmagatti/goto-preview",
config = function()
require('goto-preview').setup {
width = 120; -- Width of the floating window
height = 25; -- Height of the floating window
default_mappings = false; -- Bind default mappings
debug = false; -- Print debug information
opacity = nil; -- 0-100 opacity level of the floating window where 100 is fully transparent.
post_open_hook = nil -- A function taking two arguments, a buffer and a window to be ran as a hook.
-- You can use "default_mappings = true" setup option
-- Or explicitly set keybindings
-- vim.cmd("nnoremap gpd <cmd>lua require('goto-preview').goto_preview_definition()<CR>")
-- vim.cmd("nnoremap gpi <cmd>lua require('goto-preview').goto_preview_implementation()<CR>")
-- vim.cmd("nnoremap gP <cmd>lua require('goto-preview').close_all_win()<CR>")
}
end
},
'ethanholz/nvim-lastplace',
'wakatime/vim-wakatime',
'ap/vim-css-color'
}
-- add jedi_language_server
lvim.lsp.templates_dir = join_paths(get_runtime_dir(), "after", "ftplugin")
local opts = {}
require("lvim.lsp.manager").setup("jedi_language_server", opts)
require'lspconfig'.sqlls.setup{}
-- add bashls
-- require('lspconfig').bashls.setup{}
require'lspconfig'.bashls.setup{}
-- lsp_signature
require "lsp_signature".setup()
require'nvim-lastplace'.setup {
lastplace_ignore_buftype = {"quickfix", "nofile", "help"},
lastplace_ignore_filetype = {"gitcommit", "gitrebase", "svn", "hgcommit"},
lastplace_open_folds = true
}
require('goto-preview').setup {
width = 220; -- Width of the floating window
height = 55; -- Height of the floating window
border = {"", "" ,"", "", "", "", "", ""}; -- Border characters of the floating window
default_mappings = true; -- Bind default mappings
debug = false; -- Print debug information
opacity = nil; -- 0-100 opacity level of the floating window where 100 is fully transparent.
resizing_mappings = false; -- Binds arrow keys to resizing the floating window.
post_open_hook = nil; -- A function taking two arguments, a buffer and a window to be ran as a hook.
-- These two configs can also be passed down to the goto-preview definition and implementation calls for one off "peak" functionality.
focus_on_open = true; -- Focus the floating window when opening it.
dismiss_on_move = false; -- Dismiss the floating window when moving the cursor.
force_close = true, -- passed into vim.api.nvim_win_close's second argument. See :h nvim_win_close
bufhidden = "wipe", -- the bufhidden option to set on the floating window. See :h bufhidden
}
-- init.lua
vim.g.symbols_outline = {
highlight_hovered_item = true,
show_guides = true,
auto_preview = true,
position = 'right',
relative_width = true,
width = 25,
show_numbers = false,
show_relative_numbers = false,
show_symbol_details = true,
preview_bg_highlight = 'Pmenu',
keymaps = { -- These keymaps can be a string or a table for multiple keys
close = {"<Esc>", "q"},
goto_location = "<Cr>",
focus_location = "o",
hover_symbol = "<C-space>",
toggle_preview = "K",
rename_symbol = "r",
code_actions = "a",
},
lsp_blacklist = {},
symbol_blacklist = {},
symbols = {
File = {icon = "", hl = "TSURI"},
Module = {icon = "", hl = "TSNamespace"},
Namespace = {icon = "", hl = "TSNamespace"},
Package = {icon = "", hl = "TSNamespace"},
Class = {icon = "𝓒", hl = "TSType"},
Method = {icon = "ƒ", hl = "TSMethod"},
Property = {icon = "", hl = "TSMethod"},
Field = {icon = "", hl = "TSField"},
Constructor = {icon = "", hl = "TSConstructor"},
Enum = {icon = "", hl = "TSType"},
Interface = {icon = "", hl = "TSType"},
Function = {icon = "", hl = "TSFunction"},
Variable = {icon = "", hl = "TSConstant"},
Constant = {icon = "", hl = "TSConstant"},
String = {icon = "𝓐", hl = "TSString"},
Number = {icon = "#", hl = "TSNumber"},
Boolean = {icon = "", hl = "TSBoolean"},
Array = {icon = "", hl = "TSConstant"},
Object = {icon = "⦿", hl = "TSType"},
Key = {icon = "🔐", hl = "TSType"},
Null = {icon = "NULL", hl = "TSType"},
EnumMember = {icon = "", hl = "TSField"},
Struct = {icon = "𝓢", hl = "TSType"},
Event = {icon = "🗲", hl = "TSType"},
Operator = {icon = "+", hl = "TSOperator"},
TypeParameter = {icon = "𝙏", hl = "TSParameter"}
}
}
vim.api.nvim_set_keymap("n", "ss", "<cmd>SymbolsOutline<CR>", {noremap=true})
-- Autocommands (https://neovim.io/doc/user/autocmd.html)
-- lvim.autocommands.custom_groups = {
-- { "BufWinEnter", "*.lua", "setlocal ts=8 sw=8" },
-- }

View File

@ -0,0 +1,88 @@
{
"initializationOptions": {
"codeAction": {
"nameExtractVariable": "jls_extract_var",
"nameExtractFunction": "jls_extract_def"
},
"completion": {
"disableSnippets": false,
"resolveEagerly": false,
"ignorePatterns": []
},
"diagnostics": {
"enable": true,
"didOpen": true,
"didChange": true,
"didSave": true
},
"hover": {
"enable": true,
"disable": {
"class": {
"all": false,
"names": [],
"fullNames": []
},
"function": {
"all": false,
"names": [],
"fullNames": []
},
"instance": {
"all": false,
"names": [],
"fullNames": []
},
"keyword": {
"all": false,
"names": [],
"fullNames": []
},
"module": {
"all": false,
"names": [],
"fullNames": []
},
"param": {
"all": false,
"names": [],
"fullNames": []
},
"path": {
"all": false,
"names": [],
"fullNames": []
},
"property": {
"all": false,
"names": [],
"fullNames": []
},
"statement": {
"all": false,
"names": [],
"fullNames": []
}
}
},
"jediSettings": {
"autoImportModules": [],
"caseInsensitiveCompletion": true,
"debug": false
},
"markupKindPreferred": "markdown",
"workspace": {
"extraPaths": [],
"symbols": {
"ignoreFolders": [
".nox",
".tox",
".venv",
"__pycache__",
"venv"
],
"maxSymbols": 20
}
}
}
}

View File

@ -0,0 +1,5 @@
{
"python.venvPath": "./env",
"python.analysis.autoImportCompletions": true,
"python.analysis.useLibraryCodeForTypes": true
}