---@diagnostic disable: undefined-global, local option = vim.opt local keymap = vim.keymap vim.loader.enable() vim.g.netrw_banner = 0 vim.g.netrw_liststyle = 3 vim.g.netrw_altv = 0 vim.g.netrw_winsize = 25 vim.g.netrw_browse_split = 4 vim.g.rustfmt_autosave = 1 vim.g.mkdp_auto_start = 1 --Basic Editor Setup option.nu = true option.tabstop = 2 option.softtabstop = 2 option.shiftwidth = 2 option.expandtab = true option.smartindent = true option.ruler = false option.wrap = false option.swapfile = false option.hlsearch = false option.incsearch = true option.updatetime = 50 option.laststatus = 0 option.signcolumn = "number" option.autoindent = true option.clipboard = "unnamedplus" option.termguicolors = true option.fillchars = 'eob: ' option.autoindent = true option.lazyredraw = false option.updatetime = 300 option.timeoutlen = 500 vim.cmd [[autocmd BufWritePre lua vim.lsp.buf.format()]] vim.cmd([[ augroup RunPfOnSave autocmd! autocmd BufWritePost *.js,*.ts,*.jsx,*json,*.tsx,*.css,*.html,*.yaml,*.md silent! !prettier --write % autocmd BufWritePost *.tex silent! :VimtexCompile augroup END ]]) vim.cmd([[ augroup AutoDeleteNetrwHiddenBuffers au! au FileType netrw setlocal bufhidden=wipe augroup end ]]) vim.cmd([[ function! ToggleVExplorer() if exists("t:expl_buf_num") let expl_win_num = bufwinnr(t:expl_buf_num) if expl_win_num != -1 let cur_win_id = win_getid() exec expl_win_num . 'windo close' let prev_win_num = win_id2win(cur_win_id) if prev_win_num != 0 exec prev_win_num . 'wincmd w' endif endif unlet t:expl_buf_num else exec '1wincmd w' Vexplore let t:expl_buf_num = bufnr("%") endif endfunction ]]) -- Gui options vim.g.vimtex_view_method = "zathura" vim.g.vimtex_compiler_method = "latexmk" vim.g.vimtex_quickfix_mode = 0 vim.g.tex_conceal = "abdmg" vim.g.tex_flavor = "latex" vim.g.gitgutter_set_sign_backgrounds = 1 local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath, }) end vim.opt.rtp:prepend(lazypath) require("lazy").setup({ "airblade/vim-gitgutter", {"lervag/vimtex", lazy = true}, "norcalli/nvim-colorizer.lua", "nvim-treesitter/nvim-treesitter", { "neovim/nvim-lspconfig", lazy = false, dependencies = { { "ms-jpq/coq_nvim", branch = "coq" }, { "ms-jpq/coq.artifacts", branch = "artifacts" }, { 'ms-jpq/coq.thirdparty', branch = "3p" }, "williamboman/mason.nvim", "williamboman/mason-lspconfig.nvim", }, init = function() vim.g.coq_settings = { auto_start = 'shut-up' } end, config = function() end, }, 'nvim-telescope/telescope.nvim', lazy = true, tag = '0.1.5', dependencies = { 'nvim-lua/plenary.nvim' }, { 'nvim-telescope/telescope-fzf-native.nvim', lazy = true, build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build', keys = { { "/", false }, { "f", "Telescope find_files", desc = "Find Files" }, { "g", "Telescope live_grep", desc = "Grep" }, { "b", "Telescope buffers", desc = "Grep" }, { "s", "Telescope buffers", desc = "Grep" }, } }}, { 'windwp/nvim-autopairs', event = "InsertEnter", opts = {} } ) require("colorizer").setup() vim.api.nvim_create_autocmd("BufWritePre", { callback = function() vim.lsp.buf.format() end, }) local lsp_servers = { rust_analyzer = { imports = { granularity = { group = 'module', }, prefix = 'self', }, cargo = { buildScripts = { enable = true, }, }, procMacro = { enable = true, }, }, } require("mason").setup({ ui = { icons = { package_installed = "✓", package_pending = "➜", package_uninstalled = "✗" } } }) local server_maps = function(opts) end for lsp, settings in pairs(lsp_servers) do require("lspconfig")[lsp].setup(coq.lsp_ensure_capabilities({ on_attach = function(_, buffer) server_maps({ buffer = buffer }) end, settings = settings, })) end vim.cmd([[ highlight GitGutterAdd ctermbg=none guibg=none highlight GitGutterDelete guibg=none ctermbg=none highlight GitGutterChange guibg=none ctermbg=none highlight GitGutterChangeAdd guibg=none ctermbg=none highlight GitGutterChangeDelete guibg=none ctermbg=none highlight NonText guifg=none highlight EndOfBuffer ctermfg=none ctermbg=none highlight Normal ctermbg=none guibg=none highlight signcolumn ctermbg=none guibg=none highlight StatusLine ctermbg=none guibg=none highlight DiagnosticError ctermbg=none guibg=none highlight DiagnosticWarn ctermbg=none guibg=none highlight DiagnosticInfo ctermbg=none guibg=none highlight DiagnosticHint ctermbg=none guibg=none highlight Pmenu ctermbg=none guibg=none highlight DiagnosticVirtualError ctermbg=none guibg=none highlight DiagnosticVirtualWarn ctermbg=none guibg=none highlight DiagnosticVirtualInfo ctermbg=none guibg=none highlight DiagnosticVirtualHint ctermbg=none guibg=none highlight LspFloatWinNormal ctermbg=none guibg=none highlight NormalFloat ctermbg=none guibg=none highlight LineNr ctermbg=none guibg=none highlight StatusLineNc ctermbg=none guibg=none highlight StatusLineNc ctermfg=none guifg=none highlight StatusLine ctermbg=none guibg=none highlight StatusLine ctermfg=none guifg=none highlight NvimTreeWinSeparator ctermfg=none guifg=none highlight CursorColumn ctermfg=none guifg=none highlight CursorLine ctermbg=none guibg=none highlight VertSplit ctermbg=none guibg=none highlight DiagnosticVirtualTextError ctermbg=none guibg=none highlight DiagnosticVirtualTextWarn ctermbg=none guibg=none highlight DiagnosticVirtualTextInfo ctermbg=none guibg=none highlight DiagnosticVirtualTextHint ctermbg=none guibg=none ]]) vim.g.mapleader = " " keymap.set("n", "e", ":call ToggleVExplorer() ") keymap.set("n", "z", [[:%s/\<\>//gI]]) keymap.set("n", "a", "ggVG") keymap.set("n", "y", "cc") keymap.set("n", "", "yy") keymap.set("n", "", "p") keymap.set("n", "", "u") keymap.set("v", "J", ":m '>+1gv=gv") keymap.set("n", "j", "5j") keymap.set("n", "k", "5k") keymap.set("v", "K", ":m '<-2gv=gv") keymap.set("n", "ca", "Lspsaga code_action") keymap.set("n", "f", "Telescope find_files") keymap.set("n", "g", "Telescope live_grep") keymap.set("n", "t", "Lspsaga term_toggle ") keymap.set("n", "d", vim.lsp.buf.definition, opts) -- goto def keymap.set("n", "k", vim.lsp.buf.hover, opts)