nvim dot files

Merge pull request #1 from shailpatels/switch_lazy_nvim

Switch lazy nvim

authored by shailpatels.me and committed by

GitHub ed6b1fa8 e4ad9b18

+223 -188
+1 -1
.gitignore
··· 1 - plugin/packer_compiled.lua 1 + lazy-lock.json
-4
after/plugin/airline.lua
··· 1 - 2 - vim.cmd [[ 3 - AirlineTheme lucius 4 - ]]
-1
after/plugin/fugitive.lua
··· 1 - vim.keymap.set("n", "<leader>gs", vim.cmd.Git);
-29
after/plugin/lsp.lua
··· 1 - -- Learn the keybindings, see :help lsp-zero-keybindings 2 - -- Learn to configure LSP servers, see :help lsp-zero-api-showcase 3 - local lsp = require('lsp-zero') 4 - lsp.preset('recommended') 5 - 6 - lsp.ensure_installed({ 7 - 'tsserver', 8 - 'eslint', 9 - 'rust_analyzer' 10 - }) 11 - 12 - local cmp = require('cmp') 13 - local cmp_select = { behavior = cmp.SelectBehavior.Select } 14 - local cmp_mappings = lsp.defaults.cmp_mappings({ 15 - ['<C-p>'] = cmp.mapping.select_prev_item(cmp_select), 16 - ['<C-n>'] = cmp.mapping.select_next_item(cmp_select), 17 - ['<CR>'] = cmp.mapping.confirm({ select = true }), 18 - ["<C-Space>"] = cmp.mapping.complete(), 19 - }) 20 - 21 - lsp.set_preferences({ 22 - sign_icons = { } 23 - }) 24 - 25 - lsp.setup_nvim_cmp({ 26 - mapping = cmp_mappings 27 - }) 28 - 29 - lsp.setup()
-9
after/plugin/nerdtree.lua
··· 1 - vim.keymap.set("n", "<C-B>", ":NERDTreeToggle<CR>") 2 - 3 - vim.cmd [[ 4 - autocmd VimEnter * NERDTree | wincmd p 5 - autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif 6 - autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 | 7 - \ let buf=bufnr() | buffer# | execute "normal! \<C-W>w" | execute 'buffer'.buf | endif 8 - let NERDTreeShowHidden=1 9 - ]]
-8
after/plugin/telescope.lua
··· 1 - local builtin = require('telescope.builtin') 2 - vim.keymap.set('n', '<leader>ff', builtin.find_files, {}) 3 - vim.keymap.set('n', '<leader>fg', builtin.live_grep, {}) 4 - vim.keymap.set('n', '<C-p>', builtin.git_files, {}) 5 - 6 - vim.keymap.set('n', '<leader>ps', function() 7 - builtin.grep_string({ search = vim.fn.input("Grep > ") }) 8 - end)
-22
after/plugin/treesitter.lua
··· 1 - require'nvim-treesitter.configs'.setup { 2 - -- A list of parser names, or "all" 3 - ensure_installed = { "c", "zig", "lua", "rust", "javascript", "typescript" }, 4 - 5 - -- Install parsers synchronously (only applied to `ensure_installed`) 6 - sync_install = false, 7 - 8 - -- Automatically install missing parsers when entering buffer 9 - -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally 10 - auto_install = true, 11 - 12 - highlight = { 13 - -- `false` will disable the whole extension 14 - enable = true, 15 - 16 - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. 17 - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). 18 - -- Using this option may slow down your editor, and you may see some duplicate highlights. 19 - -- Instead of true it can also be a list of languages 20 - additional_vim_regex_highlighting = false, 21 - }, 22 - }
-19
after/plugin/trouble.lua
··· 1 - -- https://github.com/folke/trouble.nvim 2 - 3 - local trouble = require('trouble') 4 - 5 - trouble.setup{ 6 - icons = false, 7 - fold_open = "v", -- icon used for open folds 8 - fold_closed = ">", -- icon used for closed folds 9 - indent_lines = false, -- add an indent guide below the fold icons 10 - signs = { 11 - -- icons / text used for a diagnostic 12 - error = "error", 13 - warning = "warn", 14 - hint = "hint", 15 - information = "info" 16 - }, 17 - } 18 - 19 - vim.keymap.set("n", "<leader>xx", function() trouble.toggle() end)
+5 -1
init.lua
··· 1 - require("shail") 1 + 2 + 3 + require("config.lazy") 4 + 5 +
+49
lua/config/lazy.lua
··· 1 + -- Bootstrap lazy.nvim 2 + local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" 3 + if not (vim.uv or vim.loop).fs_stat(lazypath) then 4 + local lazyrepo = "https://github.com/folke/lazy.nvim.git" 5 + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) 6 + if vim.v.shell_error ~= 0 then 7 + vim.api.nvim_echo({ 8 + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, 9 + { out, "WarningMsg" }, 10 + { "\nPress any key to exit..." }, 11 + }, true, {}) 12 + vim.fn.getchar() 13 + os.exit(1) 14 + end 15 + end 16 + vim.opt.rtp:prepend(lazypath) 17 + 18 + -- Make sure to setup `mapleader` and `maplocalleader` before 19 + -- loading lazy.nvim so that mappings are correct. 20 + -- This is also a good place to setup other settings (vim.opt) 21 + vim.g.mapleader = " " 22 + vim.g.maplocalleader = "\\" 23 + 24 + vim.opt.nu = true 25 + vim.opt.relativenumber = true 26 + vim.opt.tabstop = 4 27 + vim.opt.softtabstop = 4 28 + vim.opt.shiftwidth = 4 29 + vim.opt.expandtab = true 30 + vim.opt.smartindent = true 31 + vim.opt.wrap = false 32 + vim.opt.background = "light" 33 + vim.opt.incsearch = true 34 + vim.opt.termguicolors = true 35 + vim.opt.updatetime = 50 36 + vim.opt.signcolumn = 'no' 37 + 38 + -- Setup lazy.nvim 39 + require("lazy").setup({ 40 + spec = { 41 + -- import your plugins 42 + { import = "plugins" }, 43 + }, 44 + -- Configure any other settings here. See the documentation for more details. 45 + -- colorscheme that will be used when installing plugins. 46 + install = { }, 47 + -- automatically check for plugin updates 48 + checker = { enabled = true }, 49 + })
+12
lua/plugins/airline.lua
··· 1 + return { 2 + { 'vim-airline/vim-airline', 3 + dependencies = { 4 + { 'vim-airline/vim-airline-themes' } 5 + }, 6 + config = function() 7 + vim.cmd([[AirlineTheme lucius]]) 8 + vim.cmd([[let g:airline#extensions#tabline#enabled = 1]]) 9 + end 10 + } 11 + 12 + }
+3
lua/plugins/fugitive.lua
··· 1 + return { 2 + 'tpope/vim-fugitive' 3 + }
+28
lua/plugins/gruvbox.lua
··· 1 + return { 2 + { "ellisonleao/gruvbox.nvim", priority = 1000 , eager = true, config = true, opts = { 3 + undercurl = true, 4 + underline = true, 5 + bold = true, 6 + italic = { 7 + strings = true, 8 + operators = true, 9 + comments = true, 10 + }, 11 + strikethrough = true, 12 + invert_selection = false, 13 + invert_signs = false, 14 + invert_tabline = false, 15 + invert_intend_guides = false, 16 + inverse = true, -- invert background for search, diffs, statuslines and errors 17 + contrast = "hard", -- can be "hard", "soft" or empty string 18 + palette_overrides = {}, 19 + overrides = {}, 20 + dim_inactive = false, 21 + transparent_mode = false, 22 + }, 23 + config = function() 24 + -- load the colorscheme here 25 + vim.cmd([[colorscheme gruvbox]]) 26 + end, 27 + } 28 + }
+101
lua/plugins/lsp.lua
··· 1 + return { 2 + { 3 + { 4 + "williamboman/mason.nvim", 5 + config = function() 6 + require('mason').setup() 7 + end 8 + }, 9 + 10 + { 11 + "williamboman/mason-lspconfig.nvim", 12 + config = function() 13 + require('mason-lspconfig').setup({ 14 + ensure_installed = { "pyright", "rust_analyzer", "zls" }, 15 + }) 16 + end, 17 + }, 18 + 19 + { 20 + "neovim/nvim-lspconfig", 21 + config = function() 22 + local lspconfig = require('lspconfig') 23 + local on_attach = function(client, bufnr) 24 + local bufopts = { noremap = true, silent = true, buffer = bufnr } 25 + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) 26 + vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts) 27 + vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) 28 + vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts) 29 + vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts) 30 + vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts) 31 + vim.keymap.set('n', '<space>f', vim.lsp.buf.formatting, bufopts) 32 + end 33 + 34 + lspconfig.pyright.setup({ on_attach = on_attach }) 35 + lspconfig.tsserver.setup({ on_attach = on_attach }) 36 + lspconfig.rust_analyzer.setup({ 37 + on_attach = on_attach, 38 + settings = { 39 + ["rust-analyzer"] = { 40 + imports = { 41 + granularity = { 42 + group = "module", 43 + }, 44 + prefix = "self", 45 + }, 46 + cargo = { 47 + buildScripts = { 48 + enable = true, 49 + }, 50 + }, 51 + procMacro = { 52 + enable = true 53 + }, 54 + } 55 + } 56 + }) 57 + 58 + lspconfig.zls.setup({ 59 + on_attach = on_attach, 60 + settings = { 61 + zls = { 62 + zig_exe_path = "/home/shail/GitHub/zig/build/stage3/bin/zig", 63 + } 64 + } 65 + }) 66 + end, 67 + }, 68 + 69 + { 70 + 'hrsh7th/nvim-cmp', 71 + config = function() 72 + local cmp = require('cmp') 73 + cmp.setup({ 74 + snippet = { 75 + expand = function(args) 76 + require('luasnip').lsp_expand(args.body) 77 + end, 78 + }, 79 + mapping = cmp.mapping.preset.insert({ 80 + ['<C-b>'] = cmp.mapping.scroll_docs(-4), 81 + ['<C-f>'] = cmp.mapping.scroll_docs(4), 82 + ['<C-Space>'] = cmp.mapping.complete(), 83 + ['<C-e>'] = cmp.mapping.abort(), 84 + ['<CR>'] = cmp.mapping.confirm({ select = true }), 85 + ['<C-p>'] = cmp.mapping.select_prev_item(), 86 + ['<C-n>'] = cmp.mapping.select_next_item(), 87 + }), 88 + sources = cmp.config.sources({ 89 + {name = 'nvim_lsp' }, 90 + {name = 'buffer' }, 91 + {name = 'path' }, 92 + }) 93 + }) 94 + end, 95 + }, 96 + 97 + 'hrsh7th/cmp-nvim-lsp', 98 + 'L3MON4D3/LuaSnip', 99 + } 100 + 101 + }
+12
lua/plugins/nerdtree.lua
··· 1 + return { 2 + { "preservim/nerdtree", 3 + init = function() 4 + -- automatically open nerdtree 5 + vim.cmd([[autocmd VimEnter * NERDTree | wincmd p]]); 6 + -- close nerdtree if its the last buffer 7 + vim.cmd([[autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | call feedkeys(":quit\<CR>:\<BS>") | endif]]) 8 + -- open nerdtree in the target dir given 9 + vim.cmd([[autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in') | execute 'NERDTree' argv()[0] | wincmd p | enew | execute 'cd '.argv()[0] | endif]]) 10 + end 11 + } 12 + }
+12
lua/plugins/telescope.lua
··· 1 + return { 2 + 'nvim-telescope/telescope.nvim', tag = '0.1.8', 3 + -- or , branch = '0.1.x', 4 + dependencies = { 'nvim-lua/plenary.nvim' }, 5 + keys = { 6 + { "<leader>ff", "<cmd>Telescope find_files<cr>", desc = "Find files" }, 7 + { "<leader>fg", "<cmd>Telescope live_grep<cr>", desc = "Live grep" }, 8 + { "<leader>fb", "<cmd>Telescope buffers<cr>", desc = "Telescope Buffers" }, 9 + { "<leader>fh", "<cmd>Telescope help_tags<cr>", desc = "Telescrope help tags" } 10 + 11 + } 12 + }
-41
lua/shail/init.lua
··· 1 - require("shail.packer") 2 - 3 - vim.opt.nu = true 4 - vim.opt.relativenumber = true 5 - vim.opt.tabstop = 4 6 - vim.opt.softtabstop = 4 7 - vim.opt.shiftwidth = 4 8 - vim.opt.expandtab = true 9 - vim.opt.smartindent = true 10 - vim.opt.wrap = false 11 - vim.opt.background = "light" 12 - vim.opt.incsearch = true 13 - vim.opt.termguicolors = true 14 - vim.opt.updatetime = 50 15 - vim.g.mapleader = " " 16 - vim.opt.signcolumn = 'no' 17 - 18 - -- https://github.com/ellisonleao/gruvbox.nvim 19 - require("gruvbox").setup({ 20 - undercurl = true, 21 - underline = true, 22 - bold = true, 23 - italic = { 24 - strings = true, 25 - operators = true, 26 - comments = true, 27 - }, 28 - strikethrough = true, 29 - invert_selection = false, 30 - invert_signs = false, 31 - invert_tabline = false, 32 - invert_intend_guides = false, 33 - inverse = true, -- invert background for search, diffs, statuslines and errors 34 - contrast = "hard", -- can be "hard", "soft" or empty string 35 - palette_overrides = {}, 36 - overrides = {}, 37 - dim_inactive = false, 38 - transparent_mode = false, 39 - }) 40 - 41 - vim.cmd([[colorscheme gruvbox]])
-53
lua/shail/packer.lua
··· 1 - 2 - -- Only required if you have packer configured as `opt` 3 - vim.cmd [[packadd packer.nvim]] 4 - 5 - return require('packer').startup(function(use) 6 - -- Packer can manage itself 7 - use 'wbthomason/packer.nvim' 8 - 9 - 10 - use { 11 - 'nvim-telescope/telescope.nvim', tag = '0.1.0', 12 - -- or , branch = '0.1.x', 13 - requires = { {'nvim-lua/plenary.nvim'} } 14 - } 15 - 16 - use { "ellisonleao/gruvbox.nvim" } 17 - 18 - use ( "nvim-treesitter/nvim-treesitter", { run = ':TSUpdate'} ) 19 - use ( "nvim-treesitter/playground" ) 20 - 21 - use ( "tpope/vim-fugitive" ) 22 - 23 - use { 24 - 'VonHeikemen/lsp-zero.nvim', 25 - requires = { 26 - -- LSP Support 27 - {'neovim/nvim-lspconfig'}, 28 - {'williamboman/mason.nvim'}, 29 - {'williamboman/mason-lspconfig.nvim'}, 30 - 31 - -- Autocompletion 32 - {'hrsh7th/nvim-cmp'}, 33 - {'hrsh7th/cmp-buffer'}, 34 - {'hrsh7th/cmp-path'}, 35 - {'saadparwaiz1/cmp_luasnip'}, 36 - {'hrsh7th/cmp-nvim-lsp'}, 37 - {'hrsh7th/cmp-nvim-lua'}, 38 - 39 - -- Snippets 40 - {'L3MON4D3/LuaSnip'}, 41 - -- Snippet Collection (Optional) 42 - {'rafamadriz/friendly-snippets'}, 43 - } 44 - } 45 - 46 - use 'preservim/nerdtree' 47 - 48 - use 'ap/vim-buftabline' 49 - use 'vim-airline/vim-airline' 50 - use 'vim-airline/vim-airline-themes' 51 - 52 - use 'folke/trouble.nvim' 53 - end)