Prevent neovim from crashing when no plugins are installed yet
This commit is contained in:
		
							parent
							
								
									836aca02b7
								
							
						
					
					
						commit
						32cacdd82f
					
				|  | @ -5,41 +5,26 @@ require('lsp_config') | |||
| require('telescope_config') | ||||
| require('lualine_config') | ||||
| require('mappings') | ||||
| require('trim_config') | ||||
| require('nvim_tree_config') | ||||
| 
 | ||||
| require('trim').setup({ | ||||
|     ft_blocklist= {"markdown", "vimwiki"}, | ||||
|     patterns = { | ||||
|         [[%s/\s\+$//e]],           -- remove unwanted spaces | ||||
|         [[%s/\($\n\s*\)\+\%$//]],  -- trim last line | ||||
|         [[%s/\%^\n\+//]],          -- trim first line | ||||
|     }, | ||||
| }) | ||||
| local hasleap, leap = pcall(require, 'leap') | ||||
| if hasleap then | ||||
|     leap.set_default_keymaps() | ||||
| end | ||||
| 
 | ||||
| require('leap').set_default_keymaps() | ||||
| require('Comment').setup() | ||||
| require("nvim-tree").setup({ | ||||
|     sort_by = "case_sensitive", | ||||
|     sync_root_with_cwd = true, | ||||
|     update_focused_file = { | ||||
|         update_root = true, | ||||
|     }, | ||||
|     view = { | ||||
|         adaptive_size = true, | ||||
|         mappings = { | ||||
|             list = { | ||||
|                 {key = "cd", action = "cd"} | ||||
|             } | ||||
|         }, | ||||
|     }, | ||||
|     renderer = { | ||||
|         group_empty = true, | ||||
|     }, | ||||
|     filters = { | ||||
|         dotfiles = true, | ||||
|     }, | ||||
| }) | ||||
| local hasComment, Comment = pcall(require, 'Comment') | ||||
| if hasComment then | ||||
|     Comment.setup() | ||||
| end | ||||
| 
 | ||||
| local hastrouble, trouble = pcall(require, 'trouble') | ||||
| if hastrouble then | ||||
|     trouble.setup() | ||||
| end | ||||
| 
 | ||||
| pcall(function() vim.cmd("colorscheme material") end) | ||||
| 
 | ||||
| vim.cmd("colorscheme material") | ||||
| vim.api.nvim_create_autocmd("FileType", { pattern = "make", command = [[set tabstop=8 shiftwidth=8 softtabstop=0 noexpandtab]] }) | ||||
| vim.api.nvim_create_autocmd("FileType", { pattern = "vimwiki", command = [[setlocal shiftwidth=2 softtabstop=2 expandtab]] }) | ||||
| vim.api.nvim_create_autocmd("FileType", { pattern = "vimwiki", command = [[setlocal filetype=markdown]] }) | ||||
|  |  | |||
|  | @ -1,5 +1,8 @@ | |||
| local npairs = require "nvim-autopairs" | ||||
| npairs.setup { | ||||
|     check_ts = true, | ||||
| } | ||||
| npairs.add_rules(require "nvim-autopairs.rules.endwise-lua") | ||||
| local hasnpairs, npairs = pcall(require, "nvim-autopairs") | ||||
| 
 | ||||
| if hasnpairs then | ||||
|     npairs.setup { | ||||
|         check_ts = true, | ||||
|     } | ||||
|     npairs.add_rules(require "nvim-autopairs.rules.endwise-lua") | ||||
| end | ||||
|  |  | |||
|  | @ -1,5 +1,8 @@ | |||
| -- Setup nvim-cmp.lsp | ||||
| local cmp = require'cmp' | ||||
| local hascmp, cmp = pcall(require, "cmp") | ||||
| if not hascmp then | ||||
|     return | ||||
| end | ||||
| 
 | ||||
| local feedkey = function(key, mode) | ||||
|   vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true) | ||||
|  |  | |||
|  | @ -1,8 +1,13 @@ | |||
| local haslualine, lualine = pcall(require, "lualine") | ||||
| if not haslualine then | ||||
|     return | ||||
| end | ||||
| 
 | ||||
| local function getWords() | ||||
|   return tostring(vim.fn.wordcount().words) .. " Words" | ||||
| end | ||||
| 
 | ||||
| require('lualine').setup({ | ||||
| lualine.setup({ | ||||
|     options = { | ||||
|         theme = 'nightfly', | ||||
|     }, | ||||
|  |  | |||
|  | @ -0,0 +1,26 @@ | |||
| local hastree, tree = pcall(require, "nvim-tree") | ||||
| if not hastree then | ||||
|     return | ||||
| end | ||||
| 
 | ||||
| require("nvim-tree").setup({ | ||||
|     sort_by = "case_sensitive", | ||||
|     sync_root_with_cwd = true, | ||||
|     update_focused_file = { | ||||
|         update_root = true, | ||||
|     }, | ||||
|     view = { | ||||
|         adaptive_size = true, | ||||
|         mappings = { | ||||
|             list = { | ||||
|                 {key = "cd", action = "cd"} | ||||
|             } | ||||
|         }, | ||||
|     }, | ||||
|     renderer = { | ||||
|         group_empty = true, | ||||
|     }, | ||||
|     filters = { | ||||
|         dotfiles = true, | ||||
|     }, | ||||
| }) | ||||
|  | @ -31,11 +31,16 @@ require('packer').startup(function(use) | |||
|     use {'nvim-lualine/lualine.nvim', requires = { 'kyazdani42/nvim-web-devicons', opt = true }} | ||||
|     use {'nvim-telescope/telescope-fzf-native.nvim', run = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build'} | ||||
|     use {'nvim-telescope/telescope.nvim', requires = {{'nvim-lua/plenary.nvim'}}} | ||||
|     use {'nvim-treesitter/nvim-treesitter', run = ':TSUpdate'} | ||||
|     use { | ||||
|         'nvim-treesitter/nvim-treesitter', | ||||
|         run = function() | ||||
|             local ts_update = require('nvim-treesitter.install').update({ with_sync = true }) | ||||
|             ts_update() | ||||
|         end, | ||||
|     } | ||||
|     use { | ||||
|         "folke/trouble.nvim", | ||||
|         requires = "kyazdani42/nvim-web-devicons", | ||||
|         config = function() require("trouble").setup {} end | ||||
|         requires = "kyazdani42/nvim-web-devicons" | ||||
|     } | ||||
|     use { | ||||
|         'kyazdani42/nvim-tree.lua', | ||||
|  |  | |||
|  | @ -1,6 +1,10 @@ | |||
| local M = {} | ||||
| 
 | ||||
| local telescope = require("telescope") | ||||
| local hastelescope, telescope= pcall(require, "telescope") | ||||
| 
 | ||||
| if not hastelescope then | ||||
|     return M | ||||
| end | ||||
| 
 | ||||
| M.project_files = function() | ||||
|     local opts = require('telescope.themes').get_ivy({}) -- define here if you want to define something | ||||
|  |  | |||
|  | @ -0,0 +1,13 @@ | |||
| local hastrim, trim = pcall(require, "trim") | ||||
| if not hastrim then | ||||
|     return | ||||
| end | ||||
| 
 | ||||
| trim.setup({ | ||||
|     ft_blocklist= {"markdown", "vimwiki"}, | ||||
|     patterns = { | ||||
|         [[%s/\s\+$//e]],           -- remove unwanted spaces | ||||
|         [[%s/\($\n\s*\)\+\%$//]],  -- trim last line | ||||
|         [[%s/\%^\n\+//]],          -- trim first line | ||||
|     }, | ||||
| }) | ||||
		Loading…
	
		Reference in New Issue