-- Put in ~/AppData/Local/nvim vim.opt.signcolumn = 'yes'; vim.opt.scrolloff = 8; vim.opt.autoindent = true; vim.opt.expandtab = true; vim.opt.foldlevel = 20; vim.opt.foldmethod = "expr"; vim.opt.foldexpr = "nvim_treesitter#foldexpr()"; vim.opt.foldenable = true; -- Disable folding at startup. vim.opt.number = true; vim.opt.shiftwidth = 4; vim.opt.tabstop = 4; vim.g.mapleader = ' '; vim.keymap.set("v", ">", ">gv"); vim.keymap.set("v", "<", "+1gv=gv"); vim.keymap.set("v", "K", ":m '<-2gv=gv"); vim.keymap.set("n", "", "zz"); vim.keymap.set("n", "", "zz"); vim.keymap.set("n", "n", "nzzzv"); vim.keymap.set("n", "N", "Nzzzv"); vim.keymap.set("x", "p", "\"_dP"); vim.keymap.set("n", "y", "\"+y"); vim.keymap.set("v", "y", "\"+y"); vim.keymap.set("n", "Y", "\"+Y"); vim.keymap.set("n", "d", "\"_d"); vim.keymap.set("v", "d", "\"_d"); vim.keymap.set("n", ".", "Telescope find_files") vim.keymap.set("n", "o.", "Telescope file_browser") vim.keymap.set("n", "of", "Telescope live_grep") 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) -- Use a protected call so we don't error out on first use local status_ok, lazy = pcall(require, 'lazy') if not status_ok then return end lazy.setup({ spec = { -- Colorscheme: -- The colorscheme should be available when starting Neovim. { 'tanvirtin/monokai.nvim', lazy = false, priority = 1000, -- make sure to load this before all the other start plugins }, -- Treesitter { 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate' }, -- Autopair { 'windwp/nvim-autopairs', event = 'InsertEnter', config = function() require('nvim-autopairs').setup{} end }, -- init.lua: { 'nvim-telescope/telescope.nvim', tag = '0.1.5', -- or , branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim' } }, -- LSP { 'neovim/nvim-lspconfig' }, -- Autocomplete { 'hrsh7th/nvim-cmp', -- load cmp on InsertEnter event = 'InsertEnter', -- these dependencies will only be loaded when cmp loads -- dependencies are always lazy-loaded unless specified otherwise dependencies = { 'L3MON4D3/LuaSnip', 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-path', 'hrsh7th/cmp-buffer', 'saadparwaiz1/cmp_luasnip', }, }, } }) vim.cmd([[colorscheme monokai_pro]]) require("luasnip/loaders/from_vscode").lazy_load() vim.opt.completeopt = "menu,menuone,noselect" local cmp = require 'cmp' cmp.setup { snippet = { expand = function(args) luasnip.lsp_expand(args.body) end, }, mapping = cmp.mapping.preset.insert({ [''] = cmp.mapping.scroll_docs(-4), -- Up [''] = cmp.mapping.scroll_docs(4), -- Down -- C-b (back) C-f (forward) for snippet placeholder navigation. [''] = cmp.mapping.complete(), [''] = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, select = true, }, [''] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() elseif luasnip.expand_or_jumpable() then luasnip.expand_or_jump() else fallback() end end, { 'i', 's' }), [''] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() elseif luasnip.jumpable(-1) then luasnip.jump(-1) else fallback() end end, { 'i', 's' }), }), sources = { { name = 'nvim_lsp' }, { name = 'luasnip' }, }, } -- require("autoclose").setup() require 'nvim-treesitter.install'.compilers = { 'zig' } vim.api.nvim_create_autocmd('BufWinEnter', { pattern = '?*', callback = function() vim.cmd('normal! zX') vim.cmd('silent! loadview') end, }) -- Setup language servers. local lspconfig = require('lspconfig') lspconfig.pyright.setup {} lspconfig.html.setup {} lspconfig.cssls.setup {} lspconfig.eslint.setup {} lspconfig.tsserver.setup {} lspconfig.rust_analyzer.setup { -- Server-specific settings. See `:help lspconfig-setup` settings = { ['rust-analyzer'] = {}, }, } --Enable (broadcasting) snippet capability for completion local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities.textDocument.completion.completionItem.snippetSupport = true require'lspconfig'.cssls.setup { } require'nvim-treesitter.configs'.setup { -- A list of parser names, or "all" (the five listed parsers should always be installed) ensure_installed = { "cpp", "lua", "vim", "html", "javascript", "rust", "go", "sql", "c_sharp" }, -- Install parsers synchronously (only applied to `ensure_installed`) sync_install = false, -- Automatically install missing parsers when entering buffer -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally auto_install = false, ---- If you need to change the installation directory of the parsers (see -> Advanced Setup) -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")! highlight = { enable = true, -- Setting this to true will run `:h syntax` and tree-sitter at the same time. -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). -- Using this option may slow down your editor, and you may see some duplicate highlights. -- Instead of true it can also be a list of languages additional_vim_regex_highlighting = false, }, }