diff --git a/lvim/after/ftplugin/py.lua b/lvim/after/ftplugin/py.lua new file mode 100644 index 0000000..9d85a8f --- /dev/null +++ b/lvim/after/ftplugin/py.lua @@ -0,0 +1 @@ +require("lvim.lsp.manager").setup("jedi_language_server") diff --git a/lvim/config.lua b/lvim/config.lua new file mode 100644 index 0000000..4548979 --- /dev/null +++ b/lvim/config.lua @@ -0,0 +1,207 @@ +-- general +lvim.log.level = "warn" +lvim.format_on_save = true +lvim.colorscheme = "onedarker" + +lvim.leader = "space" +lvim.keys.normal_mode[""] = ":w" + +-- 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 lua require('goto-preview').goto_preview_definition()") + -- vim.cmd("nnoremap gpi lua require('goto-preview').goto_preview_implementation()") + -- vim.cmd("nnoremap gP lua require('goto-preview').close_all_win()") + } + 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 = {"", "q"}, + goto_location = "", + focus_location = "o", + hover_symbol = "", + 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", "SymbolsOutline", {noremap=true}) + + +-- Autocommands (https://neovim.io/doc/user/autocmd.html) +-- lvim.autocommands.custom_groups = { +-- { "BufWinEnter", "*.lua", "setlocal ts=8 sw=8" }, +-- } diff --git a/lvim/lsp-settings/jedi_language_server.json b/lvim/lsp-settings/jedi_language_server.json new file mode 100644 index 0000000..8f8866c --- /dev/null +++ b/lvim/lsp-settings/jedi_language_server.json @@ -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 + } + } + } +} diff --git a/lvim/lsp-settings/pyright.json b/lvim/lsp-settings/pyright.json new file mode 100644 index 0000000..09fa984 --- /dev/null +++ b/lvim/lsp-settings/pyright.json @@ -0,0 +1,5 @@ +{ + "python.venvPath": "./env", + "python.analysis.autoImportCompletions": true, + "python.analysis.useLibraryCodeForTypes": true +}