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('telescope_config')
|
||||||
require('lualine_config')
|
require('lualine_config')
|
||||||
require('mappings')
|
require('mappings')
|
||||||
|
require('trim_config')
|
||||||
|
require('nvim_tree_config')
|
||||||
|
|
||||||
require('trim').setup({
|
local hasleap, leap = pcall(require, 'leap')
|
||||||
ft_blocklist= {"markdown", "vimwiki"},
|
if hasleap then
|
||||||
patterns = {
|
leap.set_default_keymaps()
|
||||||
[[%s/\s\+$//e]], -- remove unwanted spaces
|
end
|
||||||
[[%s/\($\n\s*\)\+\%$//]], -- trim last line
|
|
||||||
[[%s/\%^\n\+//]], -- trim first line
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
require('leap').set_default_keymaps()
|
local hasComment, Comment = pcall(require, 'Comment')
|
||||||
require('Comment').setup()
|
if hasComment then
|
||||||
require("nvim-tree").setup({
|
Comment.setup()
|
||||||
sort_by = "case_sensitive",
|
end
|
||||||
sync_root_with_cwd = true,
|
|
||||||
update_focused_file = {
|
local hastrouble, trouble = pcall(require, 'trouble')
|
||||||
update_root = true,
|
if hastrouble then
|
||||||
},
|
trouble.setup()
|
||||||
view = {
|
end
|
||||||
adaptive_size = true,
|
|
||||||
mappings = {
|
pcall(function() vim.cmd("colorscheme material") end)
|
||||||
list = {
|
|
||||||
{key = "cd", action = "cd"}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
renderer = {
|
|
||||||
group_empty = true,
|
|
||||||
},
|
|
||||||
filters = {
|
|
||||||
dotfiles = true,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
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 = "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 shiftwidth=2 softtabstop=2 expandtab]] })
|
||||||
vim.api.nvim_create_autocmd("FileType", { pattern = "vimwiki", command = [[setlocal filetype=markdown]] })
|
vim.api.nvim_create_autocmd("FileType", { pattern = "vimwiki", command = [[setlocal filetype=markdown]] })
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
local npairs = require "nvim-autopairs"
|
local hasnpairs, npairs = pcall(require, "nvim-autopairs")
|
||||||
npairs.setup {
|
|
||||||
|
if hasnpairs then
|
||||||
|
npairs.setup {
|
||||||
check_ts = true,
|
check_ts = true,
|
||||||
}
|
}
|
||||||
npairs.add_rules(require "nvim-autopairs.rules.endwise-lua")
|
npairs.add_rules(require "nvim-autopairs.rules.endwise-lua")
|
||||||
|
end
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
-- Setup nvim-cmp.lsp
|
-- 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)
|
local feedkey = function(key, mode)
|
||||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
|
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()
|
local function getWords()
|
||||||
return tostring(vim.fn.wordcount().words) .. " Words"
|
return tostring(vim.fn.wordcount().words) .. " Words"
|
||||||
end
|
end
|
||||||
|
|
||||||
require('lualine').setup({
|
lualine.setup({
|
||||||
options = {
|
options = {
|
||||||
theme = 'nightfly',
|
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-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-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-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 {
|
use {
|
||||||
"folke/trouble.nvim",
|
"folke/trouble.nvim",
|
||||||
requires = "kyazdani42/nvim-web-devicons",
|
requires = "kyazdani42/nvim-web-devicons"
|
||||||
config = function() require("trouble").setup {} end
|
|
||||||
}
|
}
|
||||||
use {
|
use {
|
||||||
'kyazdani42/nvim-tree.lua',
|
'kyazdani42/nvim-tree.lua',
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
local telescope = require("telescope")
|
local hastelescope, telescope= pcall(require, "telescope")
|
||||||
|
|
||||||
|
if not hastelescope then
|
||||||
|
return M
|
||||||
|
end
|
||||||
|
|
||||||
M.project_files = function()
|
M.project_files = function()
|
||||||
local opts = require('telescope.themes').get_ivy({}) -- define here if you want to define something
|
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