---@diagnostic disable: undefined-global local option = vim.opt local keymap = vim.keymap vim.g.loaded_netrw = 1 vim.g.loaded_netrwPlugin = 1 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 vim.cmd([[ augroup RunPfOnSave autocmd! autocmd BufWritePost *.js,*.ts,*.jsx,*json,*.tsx,*.css,*.html,*.yaml,*.md silent! !prettier --write % autocmd BufWritePost *.tex silent! :VimtexCompile autocmd BufWritePost *.md silent! :MarkdownPreview autocmd BufWritePost *.php silent! !php-cs-fixer fix % augroup END ]]) -- Gui options vim.o.guifont = "Fira Code:h7" vim.g.vimtex_view_method = "zathura" vim.g.vimtex_compiler_method = "latexrun" 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", -- latest stable release lazypath, }) end vim.opt.rtp:prepend(lazypath) require("lazy").setup({ "nvim-lua/plenary.nvim", 'chriskempson/base16-vim', 'ryanoasis/vim-devicons', "airblade/vim-gitgutter", "lervag/vimtex", "nvim-tree/nvim-tree.lua", "norcalli/nvim-colorizer.lua", "nvim-treesitter/nvim-treesitter", "neovim/nvim-lspconfig", "williamboman/mason.nvim", "nvim-tree/nvim-web-devicons", "williamboman/mason-lspconfig.nvim", "iamcco/markdown-preview.nvim", cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, build = "cd app && yarn install", init = function() vim.g.mkdp_filetypes = { "markdown" } end, ft = { "markdown" }, 'nvimdev/lspsaga.nvim', config = function() require('lspsaga').setup({}) end, 'nvim-telescope/telescope.nvim', tag = '0.1.5', dependencies = { 'nvim-lua/plenary.nvim' }, { 'nvim-telescope/telescope-fzf-native.nvim', 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 = {} }, { 'numToStr/Comment.nvim', opts = {}, lazy = false, }, 'ms-jpq/coq_nvim', { 'ms-jpq/coq.artifacts', branch = "artifacts" }, }) require("colorizer").setup() vim.api.nvim_create_autocmd('InsertEnter', { command = 'COQnow --shut-up' }) vim.api.nvim_create_autocmd("BufWritePre", { callback = function() vim.lsp.buf.format() end, }) local lsp_servers = { clangd = {}, lua_ls = {}, rust_analyzer = { imports = { granularity = { group = 'module', }, prefix = 'self', }, cargo = { buildScripts = { enable = true, }, }, procMacro = { enable = true, }, }, } require("mason").setup() require("mason-lspconfig").setup { ensure_installed = lsp_servers, automatic_installation = true, } local server_maps = function(opts) vim.keymap.set("n", "d", vim.lsp.buf.definition, opts) -- goto def vim.keymap.set("n", "k", vim.lsp.buf.hover, opts) -- see docs 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 require("nvim-tree").setup({ sort = { sorter = "case_sensitive", }, view = { width = 30, }, renderer = { group_empty = true, }, filters = { dotfiles = true, }, }) vim.cmd.colorscheme("base16-brewer") 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 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 ]]) --Keybinds vim.g.mapleader = " " keymap.set("n", "e", vim.cmd.NvimTreeToggle) 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")