You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

205 lines
7.1 KiB

-- Read the docs: https://www.lunarvim.org/docs/configuration
-- Video Tutorials: https://www.youtube.com/watch?v=sFA9kX-Ud_c&list=PLhoH5vyxr6QqGu0i7tt_XoVK9v-KvZ3m6
-- Forum: https://www.reddit.com/r/lunarvim/
-- Discord: https://discord.com/invite/Xb9B4Ny
--[[
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 = true
-- general
lvim.log.level = "info"
lvim.format_on_save = {
enabled = true,
pattern = "*.lua",
timeout = 1000,
}
-- to disable icons and use a minimalist setup, uncomment the following
-- lvim.use_icons = false
-- keymappings <https://www.lunarvim.org/docs/configuration/keybindings>
lvim.leader = "\\"
-- add your own keymapping
lvim.keys.normal_mode["<C-s>"] = ":w<cr>"
-- lvim.keys.normal_mode["<S-l>"] = ":BufferLineCycleNext<CR>"
-- lvim.keys.normal_mode["<S-h>"] = ":BufferLineCyclePrev<CR>"
-- -- Use which-key to add extra bindings with the leader-key prefix
-- lvim.builtin.which_key.mappings["W"] = { "<cmd>noautocmd w<cr>", "Save without formatting" }
-- lvim.builtin.which_key.mappings["P"] = { "<cmd>Telescope projects<CR>", "Projects" }
-- -- Change theme settings
-- lvim.colorscheme = "lunar"
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 <https://www.lunarvim.org/docs/languages#lsp-support>
-- --- 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`
-- add `pylyzer` to `skipped_servers` list
vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "pylyzer" })
-- remove `pyright` from `skipped_servers` list
lvim.lsp.automatic_configuration.skipped_servers = vim.tbl_filter(function(server)
return server ~= "pyright"
end, lvim.lsp.automatic_configuration.skipped_servers)
require("mason-lspconfig").setup {
automatic_installation = { exclude = { "puppet", "pylyzer" } }
}
-- local opts = {} -- check the lspconfig documentation for a list of all possible options
-- require("lvim.lsp.manager").setup("pyright", opts)
--require 'lspconfig'.puppet.setup {}
local null_ls = require("null-ls")
null_ls.setup({
sources = {
null_ls.builtins.diagnostics.puppet_lint,
null_ls.builtins.formatting.puppet_lint,
},
})
-- ---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 <https://github.com/neovim/nvim-lspconfig#keybindings-and-completion>
-- 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 <c-x><c-o>
-- buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
-- end
-- -- linters, formatters and code actions <https://www.lunarvim.org/docs/languages#lintingformatting>
local formatters = require "lvim.lsp.null-ls.formatters"
formatters.setup {
{ command = "stylua" },
{
command = "prettier",
extra_args = { "--print-width", "100" },
filetypes = { "typescript", "typescriptreact" },
},
{
command = "yapf",
-- extra_args = { "-i" },
filetypes = { "python" },
},
{
command = "isort",
filetypes = { "python" },
},
{
command = "shfmt",
extra_args = { "-w" },
filetypes = { "sh" },
},
}
-- local linters = require "lvim.lsp.null-ls.linters"
-- linters.setup {
-- { command = "flake8", filetypes = { "python" } },
-- {
-- command = "shellcheck",
-- args = { "--severity", "warning" },
-- },
-- }
-- local code_actions = require "lvim.lsp.null-ls.code_actions"
-- code_actions.setup {
-- {
-- exe = "eslint",
-- filetypes = { "typescript", "typescriptreact" },
-- },
-- }
-- -- Additional Plugins <https://www.lunarvim.org/docs/plugins#user-plugins>
lvim.plugins = {
{
"rodjek/vim-puppet",
'tpope/vim-surround',
-- {
-- 'huggingface/llm.nvim',
-- opts = {
-- api_token = "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",
-- model = "bigcode/starcoder", -- can be a model ID or an http(s) endpoint
-- tokens_to_clear = { "<|endoftext|>" }, -- tokens to remove from the model's output
-- -- parameters that are added to the request body
-- query_params = {
-- max_new_tokens = 60,
-- temperature = 0.2,
-- top_p = 0.95,
-- stop_tokens = nil,
-- },
-- -- set this if the model supports fill in the middle
-- fim = {
-- enabled = true,
-- prefix = "<fim_prefix>",
-- middle = "<fim_middle>",
-- suffix = "<fim_suffix>",
-- },
-- debounce_ms = 150,
-- accept_keymap = "<Tab>",
-- dismiss_keymap = "<S-Tab>",
-- tls_skip_verify_insecure = false,
-- -- llm-ls configuration, cf llm-ls section
-- lsp = {
-- bin_path = nil,
-- version = "0.3.0",
-- },
-- tokenizer = nil, -- cf Tokenizer paragraph
-- context_window = 8192, -- max number of tokens for the context window
-- enable_suggestions_on_startup = true,
-- enable_suggestions_on_files = "*",
-- }
-- },
{ 'tabbyml/tabby', name = 'tabby', dir = '~/sources/tabby/clients/vim', enabled = true },
},
}
-- -- Autocommands (`:help autocmd`) <https://neovim.io/doc/user/autocmd.html>
vim.api.nvim_create_autocmd("BufReadPost", {
pattern = { "*" },
callback = function()
if vim.fn.line("'\"") > 1 and vim.fn.line("'\"") <= vim.fn.line("$") then
vim.api.nvim_exec("normal! g'\"", false)
end
end
})
-- 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.g.tabby_server_url = 'https://tabby:BogMeempAldEttEndyoravatDadnitmusfuothOl@tabby-lab.sunet.se'
-- vim.g.tabby_server_url = 'https://tabby-test.sunet.se'
vim.g.tabby_accept_binding = '<C-Right>'
vim.g.tabby_dismiss_binding = '<C-Left>'
vim.g.tabby_suggestion_delay = 100