feat(nvim): add a bunch of plugins

This commit is contained in:
matt1432 2023-07-20 23:00:57 -04:00
parent 41decfabb4
commit 2c42189b1c
3 changed files with 161 additions and 11 deletions

View file

@ -1,2 +1,52 @@
vim.opt.fillchars = {eob = " "}
vim.cmd[[colorscheme dracula]]
-- Set up nvim-cmp.
local cmp = require'cmp'
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
cmp.setup({
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
window = {
-- completion = cmp.config.window.bordered(),
-- documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vsnip' }, -- For vsnip users.
-- { name = 'luasnip' }, -- For luasnip users.
-- { name = 'ultisnips' }, -- For ultisnips users.
-- { name = 'snippy' }, -- For snippy users.
}, {
{ name = 'buffer' },
})
})
cmp.event:on(
'confirm_done',
cmp_autopairs.on_confirm_done()
)
-- https://github.com/AstroNvim/AstroNvim/issues/648#issuecomment-1511728897
vim.api.nvim_create_augroup("neotree_autoopen", { clear = true })
vim.api.nvim_create_autocmd("BufReadPre", {
desc = "Open neo-tree on enter",
group = "neotree_autoopen",
callback = function()
if not vim.g.neotree_opened then
vim.cmd "Neotree show"
vim.g.neotree_opened = true
end
end,
})

View file

@ -1,3 +1,81 @@
local capabilities = require('cmp_nvim_lsp').default_capabilities()
local lspconfig = require('lspconfig')
lspconfig.bashls.setup {}
lspconfig.nixd.setup {}
lspconfig.bashls.setup { capabilities = capabilities }
lspconfig.nixd.setup { capabilities = capabilities }
lspconfig.html.setup { capabilities = capabilities }
lspconfig.cssls.setup { capabilities = capabilities }
lspconfig.lua_ls.setup {
settings = {
capabilities = capabilities,
Lua = {
runtime = {
version = 'LuaJIT',
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = {'vim'},
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true),
},
telemetry = {
enable = false,
},
},
},
}
require("formatter").setup {
filetype = {
["*"] = {
-- "formatter.filetypes.any" defines default configurations for any
-- filetype
require("formatter.filetypes.any").remove_trailing_whitespace
}
}
}
require'nvim-treesitter.configs'.setup {
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,
},
}
require('gitsigns').setup()
require('lualine').setup {
options = {
theme = 'dracula',
globalstatus = true
}
}
require("neo-tree").setup({
close_if_last_window = true,
window = {
width = 30,
},
filesystem = {
filtered_items = {
visible = false, -- when true, they will just be displayed differently than normal items
hide_dotfiles = false,
hide_gitignored = true,
hide_by_name = {},
hide_by_pattern = {},
always_show = {},
never_show = {},
never_show_by_pattern = {},
},
},
follow_current_file = {
enabled = true,
leave_dirs_open = true,
}
})
require('nvim-autopairs').setup()
require('todo-comments').setup()
require("scrollbar").setup()

View file

@ -33,30 +33,52 @@ in {
];
extraPackages = with pkgs; [
# used to compile tree-sitter grammar
tree-sitter
# https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
nodePackages.bash-language-server
shellcheck
nixd
sumneko-lua-language-server
vscode-langservers-extracted
];
plugins = with pkgs.vimPlugins; [
# you can use plugins from the pkgs
vim-which-key
clangd_extensions-nvim
nvim-treesitter.withAllGrammars
nvim-treesitter
# or you can use our function to directly fetch plugins from git
(plugin "hrsh7th/nvim-cmp") # completion
(plugin "neovim/nvim-lspconfig")
#telescope-nvim
#telescope-fzf-native-nvim
(plugin "Mofiqul/dracula.nvim")
(plugin "nvim-neo-tree/neo-tree.nvim")
# this installs the plugin from 'lua' branch
(plugin "neovim/nvim-lspconfig")
(plugin "lukas-reineke/indent-blankline.nvim")
(plugin "lewis6991/gitsigns.nvim")
(plugin "nvim-lualine/lualine.nvim")
# plugins for completion
(plugin "hrsh7th/nvim-cmp")
(plugin "hrsh7th/cmp-nvim-lsp")
(plugin "hrsh7th/cmp-buffer")
(plugin "hrsh7th/cmp-path")
(plugin "hrsh7th/cmp-cmdline")
(plugin "hrsh7th/cmp-vsnip")
(plugin "hrsh7th/vim-vsnip")
# neo-tree and deps
(plugin "nvim-neo-tree/neo-tree.nvim")
(plugin "nvim-lua/plenary.nvim")
(plugin "nvim-tree/nvim-web-devicons")
(plugin "MunifTanjim/nui.nvim")
# to explore more
(plugin "iamcco/markdown-preview.nvim")
(plugin "sindrets/diffview.nvim")
(plugin "windwp/nvim-autopairs")
(plugin "mhartington/formatter.nvim")
(plugin "folke/todo-comments.nvim")
(plugin "petertriho/nvim-scrollbar")
];
};
}