--[[ THESE ARE EXAMPLE CONFIGS FEEL FREE TO CHANGE TO WHATEVER YOU WANT `lvim` is the global options object ]] -- vim options vim.opt.shiftwidth = 2 vim.opt.tabstop = 2 vim.opt.relativenumber = false -- general lvim.log.level = "info" lvim.format_on_save = { enabled = true, pattern = "*.tf", timeout = 1000, } -- to disable icons and use a minimalist setup, uncomment the following -- lvim.use_icons = false -- keymappings lvim.leader = "," lvim.keys.normal_mode[""] = ":" -- add your own keymapping lvim.keys.normal_mode[""] = ":w" lvim.keys.normal_mode[""] = "" lvim.keys.normal_mode[""] = "" lvim.keys.normal_mode[""] = ":MundoToggle" lvim.keys.normal_mode["gh"] = ":GBrowse" lvim.keys.visual_mode["gh"] = ":'<,'>GBrowse" -- lvim.keys.normal_mode[""] = ":BufferLineCycleNext" -- lvim.keys.normal_mode[""] = ":BufferLineCyclePrev" -- -- Use which-key to add extra bindings with the leader-key prefix -- lvim.builtin.which_key.mappings["W"] = { "noautocmd w", "Save without formatting" } lvim.builtin.which_key.mappings["P"] = { "Telescope projects", "Projects" } -- Gotta override the default buffer binding before adding a new one lvim.builtin.which_key.mappings["bb"] = false lvim.builtin.which_key.mappings["bb"] = { "Telescope buffers previewer=false", "Buffers" } lvim.builtin.which_key.mappings["bp"] = { "BufferLineCyclePrev", "Previous" } -- -- Change theme settings lvim.colorscheme = "nord" lvim.builtin.alpha.active = true lvim.builtin.alpha.mode = "dashboard" lvim.builtin.terminal.active = true lvim.builtin.nvimtree.setup.view.side = "left" lvim.builtin.nvimtree.setup.renderer.icons.show.git = false -- Automatically install missing parsers when entering buffer lvim.builtin.treesitter.auto_install = true -- lvim.builtin.treesitter.ignore_install = { "haskell" } -- -- always installed on startup, useful for parsers without a strict filetype -- lvim.builtin.treesitter.ensure_installed = { "comment", "markdown_inline", "regex" } -- -- generic LSP settings -- --- disable automatic installation of servers -- lvim.lsp.installer.setup.automatic_installation = false -- ---configure a server manually. IMPORTANT: Requires `:LvimCacheReset` to take effect -- ---see the full default list `:lua =lvim.lsp.automatic_configuration.skipped_servers` -- vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "pyright" }) -- local opts = {} -- check the lspconfig documentation for a list of all possible options -- require("lvim.lsp.manager").setup("pyright", opts) -- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. IMPORTANT: Requires `:LvimCacheReset` to take effect -- ---`:LvimInfo` lists which server(s) are skipped for the current filetype -- lvim.lsp.automatic_configuration.skipped_servers = vim.tbl_filter(function(server) -- return server ~= "emmet_ls" -- end, lvim.lsp.automatic_configuration.skipped_servers) -- -- 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) -- local function buf_set_option(...) -- vim.api.nvim_buf_set_option(bufnr, ...) -- end -- --Enable completion triggered by -- buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc") -- end -- -- linters and formatters -- local formatters = require "lvim.lsp.null-ls.formatters" -- formatters.setup { -- { command = "stylua" }, -- { -- command = "prettier", -- extra_args = { "--print-width", "100" }, -- filetypes = { "typescript", "typescriptreact" }, -- }, -- } -- local linters = require "lvim.lsp.null-ls.linters" -- linters.setup { -- { command = "flake8", filetypes = { "python" } }, -- { -- command = "shellcheck", -- args = { "--severity", "warning" }, -- }, -- } local has_words_before = function() if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then return false end local line, col = unpack(vim.api.nvim_win_get_cursor(0)) return col ~= 0 and vim.api.nvim_buf_get_text(0, line - 1, 0, line - 1, col, {})[1]:match("^%s*$") == nil end -- -- Additional Plugins lvim.plugins = { -- { -- "folke/trouble.nvim", -- cmd = "TroubleToggle", -- }, { "arcticicestudio/nord-vim" }, { "tpope/vim-fugitive", cmd = { "G", "Git", "Gdiffsplit", "Gread", "Gwrite", "Ggrep", "GMove", "GDelete", "GBrowse", "GRemove", "GRename", "Glgrep", "Gedit" }, ft = { "fugitive" } }, { "tpope/vim-rhubarb" }, { "rodjek/vim-puppet" }, { "hunner/vim-beancount" }, { "simnalamburt/vim-mundo" }, { "ethanholz/nvim-lastplace", event = "BufRead", config = function() require("nvim-lastplace").setup({ lastplace_ignore_buftype = { "quickfix", "nofile", "help" }, lastplace_ignore_filetype = { "gitcommit", "gitrebase", "svn", "hgcommit", }, lastplace_open_folds = true, }) end, }, { "zbirenbaum/copilot.lua", event = { "VimEnter" }, config = function() vim.defer_fn(function() require("copilot").setup { plugin_manager_path = get_runtime_dir() .. "/site/pack/packer", suggestion = { enabled = false }, panel = { enabled = false }, } end, 100) end, }, { "zbirenbaum/copilot-cmp", after = { "copilot.lua", "nvim-cmp" }, config = function() require("copilot_cmp").setup({ mapping = { [""] = vim.schedule_wrap(function(fallback) if lvim.builtin.cmp.visible() and has_words_before() then lvim.builtin.cmp.select_next_item({ behavior = lvim.builtin.cmp.SelectBehavior.Select }) else fallback() end end), }, }) end }, { "iamcco/markdown-preview.nvim", build = "cd app && npm install", ft = "markdown", config = function() vim.g.mkdp_auto_start = 1 end, }, -- { -- "Pocco81/auto-save.nvim", -- config = function() -- require("auto-save").setup() -- end, -- }, } lvim.builtin.cmp.formatting.source_names["copilot"] = "(Copilot)" table.insert(lvim.builtin.cmp.sources, 1, { name = "copilot" }) -- -- Autocommands (`:help autocmd`) -- vim.api.nvim_create_autocmd("FileType", { -- pattern = "zsh", -- callback = function() -- -- let treesitter use bash highlight for zsh files as well -- require("nvim-treesitter.highlight").attach(0, "bash") -- end, -- }) vim.api.nvim_create_autocmd("FileType", { pattern = { "Jenkinsfile" }, callback = function() require("nvim-treesitter.highlight").attach(0, "groovy") command = "set ft=groovy" end, })