From ec6df57f476c34d76d64cec6ef69a3969ae445ba Mon Sep 17 00:00:00 2001 From: Ted Kulp Date: Wed, 10 Nov 2021 08:45:45 -0500 Subject: [PATCH] Updated lvim config --- .config/lvim/config.lua | 178 +++++++++++++++++++++++++++++----------- .config/zsh/git.zsh | 2 + .config/zsh/tmux.zsh | 1 + 3 files changed, 132 insertions(+), 49 deletions(-) diff --git a/.config/lvim/config.lua b/.config/lvim/config.lua index e1a2bf7..9c9c30d 100644 --- a/.config/lvim/config.lua +++ b/.config/lvim/config.lua @@ -12,30 +12,34 @@ an executable lvim.log.level = "warn" lvim.format_on_save = true lvim.colorscheme = "onedarker" -vim.opt.clipboard = "unnamedplus" +vim.opt.clipboard = "unnamed,unnamedplus" -- keymappings [view all the defaults by pressing Lk] lvim.leader = "space" -- add your own keymapping lvim.keys.normal_mode[""] = ":w" - -- unmap a default keymapping -- lvim.keys.normal_mode[""] = "" -- edit a default keymapping -- lvim.keys.normal_mode[""] = ":q" -- Change Telescope navigation to use j and k for navigation and n and p for history in both input and normal mode. --- lvim.builtin.telescope.on_config_done = function() --- local actions = require "telescope.actions" --- -- for input mode --- lvim.builtin.telescope.defaults.mappings.i[""] = actions.move_selection_next --- lvim.builtin.telescope.defaults.mappings.i[""] = actions.cycle_history_next --- lvim.builtin.telescope.defaults.mappings.i[""] = actions.move_selection_previous --- lvim.builtin.telescope.defaults.mappings.i[""] = actions.cycle_history_prev --- -- for normal mode --- lvim.builtin.telescope.defaults.mappings.n[""] = actions.move_selection_next --- lvim.builtin.telescope.defaults.mappings.n[""] = actions.move_selection_previous --- end +-- we use protected-mode (pcall) just in case the plugin wasn't loaded yet. +local _, actions = pcall(require, "telescope.actions") +lvim.builtin.telescope.defaults.mappings = { + -- for input mode + i = { + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + [""] = actions.cycle_history_next, + [""] = actions.cycle_history_prev, + }, + -- for normal mode + n = { + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + }, +} -- Use which-key to add extra bindings with the leader-key prefix -- lvim.builtin.which_key.mappings["P"] = { "Telescope projects", "Projects" } @@ -53,18 +57,43 @@ lvim.keys.normal_mode[""] = ":w" -- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile lvim.builtin.dashboard.active = true lvim.builtin.terminal.active = true -lvim.builtin.lualine.active = true -lvim.builtin.dap.active = true --- lvim.builtin.bufferline = true -lvim.builtin.nvimtree.side = "left" -lvim.builtin.nvimtree.show_icons.git = 1 +lvim.builtin.nvimtree.setup.view.side = "left" +lvim.builtin.nvimtree.show_icons.git = 0 -- if you don't want all the parsers change this to a table of the ones you want -lvim.builtin.treesitter.ensure_installed = "maintained" +lvim.builtin.treesitter.ensure_installed = { + "bash", + "c", + "javascript", + "json", + "lua", + "python", + "typescript", + "css", + "rust", + "java", + "yaml", + "go", +} + lvim.builtin.treesitter.ignore_install = { "haskell" } lvim.builtin.treesitter.highlight.enabled = true +lvim.lsp.automatic_servers_installation = true + -- generic LSP settings + +-- ---@usage disable automatic installation of servers +-- lvim.lsp.automatic_servers_installation = false + +-- ---@usage Select which servers should be configured manually. Requires `:LvimCacheRest` to take effect. +-- See the full default list `:lua print(vim.inspect(lvim.lsp.override))` +-- vim.list_extend(lvim.lsp.override, { "pyright" }) + +-- ---@usage setup a server -- see: https://www.lunarvim.org/languages/#overriding-the-default-configuration +-- local opts = {} -- check the lspconfig documentation for a list of all possible options +-- require("lvim.lsp.manager").setup("pylsp", opts) + -- you can set a custom on_attach function that will be used for all the language servers -- See -- lvim.lsp.on_attach_callback = function(client, bufnr) @@ -90,22 +119,52 @@ lvim.builtin.treesitter.highlight.enabled = true -- end -- end --- set a formatter if you want to override the default lsp one (if it exists) --- lvim.lang.python.formatters = { +-- -- set a formatter, this will override the language server formatting capabilities (if it exists) +-- local formatters = require "lvim.lsp.null-ls.formatters" +-- formatters.setup { +-- { exe = "black", filetypes = { "python" } }, +-- { exe = "isort", filetypes = { "python" } }, -- { --- exe = "black", --- } --- } --- set an additional linter --- lvim.lang.python.linters = { --- { --- exe = "flake8", --- } +-- exe = "prettier", +-- ---@usage arguments to pass to the formatter +-- -- these cannot contain whitespaces, options such as `--line-width 80` become either `{'--line-width', '80'}` or `{'--line-width=80'}` +-- args = { "--print-with", "100" }, +-- ---@usage specify which filetypes to enable. By default a providers will attach to all the filetypes it supports. +-- filetypes = { "typescript", "typescriptreact" }, +-- }, -- } -vim.cmd("set timeoutlen=500") +-- -- set additional linters +-- local linters = require "lvim.lsp.null-ls.linters" +-- linters.setup { +-- { exe = "flake8", filetypes = { "python" } }, +-- { +-- exe = "shellcheck", +-- ---@usage arguments to pass to the formatter +-- -- these cannot contain whitespaces, options such as `--line-width 80` become either `{'--line-width', '80'}` or `{'--line-width=80'}` +-- 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/tokyonight.nvim"}, +-- { +-- "folke/trouble.nvim", +-- cmd = "TroubleToggle", +-- }, +-- } + +-- Autocommands (https://neovim.io/doc/user/autocmd.html) +-- lvim.autocommands.custom_groups = { +-- { "BufWinEnter", "*.lua", "setlocal ts=8 sw=8" }, +-- } + lvim.plugins = { { "tpope/vim-surround", @@ -142,6 +201,15 @@ lvim.plugins = { { "ggandor/lightspeed.nvim", event = "BufRead", + config = function() + require('lightspeed').setup { + exit_after_idle_msecs = { + labeled = 3000, + unlabeled = 3000, + }, + limit_ft_matches = 5, + } + end }, { "nacro90/numb.nvim", @@ -199,25 +267,37 @@ lvim.plugins = { table.insert(dial.config.searchlist.normal, "custom#Boolean") end, }, + { + "mrjones2014/dash.nvim", + run = "make install", + }, } --- Autocommands (https://neovim.io/doc/user/autocmd.html) --- lvim.autocommands.custom_groups = { --- { "BufWinEnter", "*.lua", "setlocal ts=8 sw=8" }, --- } +local formatters = require "lvim.lsp.null-ls.formatters" +formatters.setup { + { + exe = "prettier", + filetypes = { "typescript", "typescriptreact", "javascript", "javascriptreact", "json" }, + }, + { + exe = "eslint", + filetypes = { "typescript", "typescriptreact", "javascript", "javascriptreact" }, + }, + { + exe = "rustfmt", + filetypes = { "rust" }, + }, + { + exe = "gofmt", + filetypes = { "go" }, + }, +} --- Typescript/javascript -lvim.lang.typescript.formatters = { { exe = "eslint" }, { exe = "prettier" } } -lvim.lang.typescriptreact.formatters = lvim.lang.typescript.formatters -lvim.lang.typescript.linters = { { exe = "eslint" } } -lvim.lang.typescriptreact.linters = lvim.lang.typescript.linters -lvim.lang.javascript.formatters = { { exe = "eslint" }, { exe = "prettier" } } -lvim.lang.javascriptreact.formatters = lvim.lang.javascript.formatters -lvim.lang.javascript.linters = { { exe = "eslint" } } -lvim.lang.javascriptreact.linters = lvim.lang.javascript.linters - --- JSON -lvim.lang.json.formatters = { { exe = "prettier" } } - --- Lua -lvim.lang.lua.formatters = { { exe = "stylua" } } +-- set additional linters +local linters = require "lvim.lsp.null-ls.linters" +linters.setup { + { + exe = "eslint", + filetypes = { "typescript", "typescriptreact", "javascript", "javascriptreact" }, + }, +} diff --git a/.config/zsh/git.zsh b/.config/zsh/git.zsh index 4671bf1..95f9eb5 100644 --- a/.config/zsh/git.zsh +++ b/.config/zsh/git.zsh @@ -18,6 +18,8 @@ alias gie='git init && git commit --allow-empty -m "Initial commit"' alias grc="git branch --merged | grep -v '\*' | grep -v master | grep -v stage | xargs -n 1 git branch -d" alias grcr="git fetch --all -p && git branch -r --merged | grep -v '\*' | grep origin | grep -v master | grep -v stage | sed 's/origin\//:/' | xargs -n 1 echo git push origin" +alias lg="lazygit" + krak () { dir="$(cd "$(dirname "$1")"; pwd -P)/$(basename "$1")" open gitkraken://repo/$dir diff --git a/.config/zsh/tmux.zsh b/.config/zsh/tmux.zsh index 3699d61..51e701b 100644 --- a/.config/zsh/tmux.zsh +++ b/.config/zsh/tmux.zsh @@ -1 +1,2 @@ alias xssh="xpanes --ssh" +alias tmux="tmux -2"