vim.g.mapleader = " " vim.o.number = true vim.o.relativenumber = true vim.o.undofile = true vim.o.ignorecase = true vim.o.expandtab = false vim.o.shiftwidth = 8 vim.o.tabstop = 8 vim.o.softtabstop = 8 vim.o.smartindent = true vim.o.autoindent = true vim.o.termguicolors = true vim.o.signcolumn = "yes" vim.o.winborder = 'single' vim.o.showmode = true vim.o.guicursor = "" vim.o.swapfile = false vim.o.list = true vim.o.cursorline = true -- •⏎.·○◦ vim.o.listchars = "tab:🡪 ,trail:·,eol:⏎,space:·,multispace:·,lead:·,leadmultispace:·" vim.o.completeopt = "fuzzy,menuone,noselect" vim.diagnostic.config({ virtual_text = true }) -- AUTOCOMPLETION vim.o.autocomplete = false vim.o.completeopt = 'menu,menuone,noselect' -- STATUSBAR vim.diagnostic.status() vim.lsp.status() -- COLORSCHEME vim.cmd [[colorscheme slate]] -- FRENCH SPELLS local spell_path = vim.fn.stdpath("data") .. "/site/spell" if not (vim.uv.fs_stat(spell_path .. "/fr.utf-8.spl") and vim.uv.fs_stat(spell_path .. "/fr.utf-8.sug")) then print("Installing french spells") -- Other mirrors can be found on https://www.vim.org/mirrors.php local mirror = "https://vim.mirror.garr.it/pub/vim/" .. "runtime/spell/" local files = { "fr.utf-8.spl", "fr.utf-8.sug" } vim.fn.mkdir(spell_path, "p") for _, file in ipairs(files) do vim.fn.system(string.format("curl -L %s%s -o %s/%s", mirror, file, spell_path, file)) end end vim.cmd [[set spelllang=en,fr]] vim.cmd [[set spell]] -- PLUGINS vim.pack.add({ { src = "https://github.com/neovim/nvim-lspconfig" }, { src = "https://github.com/ibhagwan/fzf-lua" }, { src = "https://github.com/mfussenegger/nvim-jdtls" }, { src = "https://github.com/lewis6991/gitsigns.nvim" }, { src = "https://github.com/stevearc/oil.nvim" }, { src = "https://github.com/sphamba/smear-cursor.nvim" }, { src = "https://github.com/saghen/blink.cmp" }, { src = "https://github.com/saghen/blink.lib" } }) require("blink.cmp").setup({}) require('blink.cmp').build():wait(60000) require("gitsigns").setup({}) require("oil").setup({ default_file_explorer = true, lsp_file_methods = { enabled = true, timeout_ms = 1000, autosave_changes = true, }, columns = { "permissions", "size", }, float = { max_width = 0.7, max_height = 0.6, border = vim.o.winborder, }, buf_options = { buflisted = false, bufhidden = "hide", }, view_options = { show_hidden = true, }, }) require("smear_cursor").setup({ smear_insert_mode = true, stiffness = 0.7, trailing_stiffness = 0.3, stiffness_insert_mode = 0.7, trailing_stiffness_insert_mode = 0.7, damping = 0.67, damping_insert_mode = 0.67, distance_stop_animating = 0.4, }) vim.cmd [[Gitsigns toggle_current_line_blame]] -- MAPPING local map = vim.keymap.set map("n", "", "zz") map("n", "", "zz") map("v", "J", ":m '>+1gv=gv") map("v", "K", ":m '<-2gv=gv") map("n", "n", "nzzzv") map("n", "N", "Nzzzv") map("n", "s", [[%s/\<\>//gI]]) map("n", "e", [[:Oil]]) map("n", "", vim.lsp.buf.format) local fzf = require("fzf-lua") -- blazing fast map("n", "F", ":FzfLua") map("n", "f", fzf.files) map("n", "t", fzf.treesitter) map("n", "/", fzf.live_grep) -- Configure lua_ls to use neovim runtime or all of lua_ls lib. -- We put way much load on the cpu if we open both. local lua_ls_lib = {} local neovim_config_path = vim.fn.expand("~/code/dox/artixlinux/home/.config/nvim/init.lua") if vim.api.nvim_buf_get_name(0) == neovim_config_path then lua_ls_lib = vim.api.nvim_get_runtime_file("", true) else for lib in vim.fn.expand("/usr/lib/lua-language-server/meta/3rd/*/library"):gmatch("[^\n]+") do table.insert(lua_ls_lib, lib) end end vim.lsp.config("lua_ls", { settings = { Lua = { workspace = { library = lua_ls_lib } } } }) -- do not enable jdtls here, we let the nvim-jdtls plugin do everything vim.lsp.enable({ "lua_ls", "cssls", "html", "jsonls", "clangd", "ts_ls", "tinymist", "marksman", "lemminx", "rust_analyzer", "pyright" }) -- AUTOCMDS vim.api.nvim_create_autocmd("TextYankPost", { callback = function() vim.hl.on_yank() end }) vim.api.nvim_create_autocmd("BufWritePre", { callback = function() vim.lsp.buf.format() end }) vim.api.nvim_create_autocmd("BufWritePost", { pattern = "*.tex", callback = function() vim.cmd [[! pdflatex % ]] end }) vim.api.nvim_create_autocmd("FileType", { pattern = "java", callback = function(args) local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") local workspace_dir = vim.fn.stdpath("data") .. package.config:sub(1, 1) .. "jdtls-workspace" .. package.config:sub(1, 1) .. project_name local config = { name = "jdtls", cmd = { "jdtls", "-data", workspace_dir, }, root_dir = vim.fs.root(0, { ".git", "meta", "gradlew", "mvnw" }), settings = { java = {} }, init_options = { bundles = {} }, } require('jdtls').start_or_attach(config) end }) --[[ function get_hl_groups() for hl_name, hl in pairs(vim.api.nvim_get_hl(0, {})) do print(hl_name) end end local function update_hl(group, tbl) local old_hl = vim.api.nvim_get_hl_by_name(group, true) local new_hl = vim.tbl_extend('force', old_hl, tbl) vim.api.nvim_set_hl(0, group, new_hl) end ]]