2023-02-27 06:09:36 +00:00
|
|
|
local ensure_packer = function()
|
|
|
|
local fn = vim.fn
|
|
|
|
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
|
|
|
|
if fn.empty(fn.glob(install_path)) > 0 then
|
|
|
|
fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
|
|
|
|
vim.cmd [[packadd packer.nvim]]
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
|
|
|
local packer_bootstrap = ensure_packer()
|
|
|
|
|
2023-02-20 06:07:04 +00:00
|
|
|
return require('packer').startup({ function(use)
|
|
|
|
|
|
|
|
-- Packer can manage itself
|
|
|
|
use 'wbthomason/packer.nvim'
|
|
|
|
|
|
|
|
--vimp (in mappings.lua)
|
|
|
|
use 'svermeulen/vimpeccable'
|
|
|
|
|
|
|
|
--nim
|
|
|
|
use 'alaviss/nim.nvim'
|
|
|
|
|
|
|
|
-- golang
|
|
|
|
use 'fatih/vim-go'
|
|
|
|
|
|
|
|
-- obsession
|
|
|
|
use 'tpope/vim-obsession'
|
|
|
|
|
|
|
|
--rust
|
|
|
|
use {
|
|
|
|
'simrat39/rust-tools.nvim',
|
|
|
|
config = function()
|
|
|
|
local rt = require('rust-tools')
|
|
|
|
rt.setup({
|
|
|
|
server = {
|
|
|
|
on_attach = function(_, bufnr)
|
|
|
|
-- Hover actions
|
|
|
|
vim.keymap.set("n", "<C-space>", rt.hover_actions.hover_actions, { buffer = bufnr })
|
|
|
|
-- Code action groups
|
|
|
|
vim.keymap.set("n", "<Leader>a", rt.code_action_group.code_action_group, { buffer = bufnr })
|
|
|
|
end
|
|
|
|
}
|
|
|
|
})
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
--lsp (in lsp_settings.lua)
|
|
|
|
use 'neovim/nvim-lspconfig'
|
|
|
|
use 'williamboman/mason-lspconfig'
|
|
|
|
use 'williamboman/mason.nvim'
|
|
|
|
use 'mfussenegger/nvim-dap'
|
|
|
|
|
|
|
|
-- auto color hex/rgb
|
|
|
|
use {
|
|
|
|
'norcalli/nvim-colorizer.lua',
|
|
|
|
config = function() require('colorizer').setup() end,
|
|
|
|
}
|
|
|
|
|
|
|
|
use {
|
|
|
|
'mrshmllow/document-color.nvim',
|
|
|
|
config = function()
|
|
|
|
require('document-color').setup {
|
|
|
|
mode = "background",
|
|
|
|
}
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
-- Markdown preview
|
|
|
|
use {
|
|
|
|
"iamcco/markdown-preview.nvim",
|
|
|
|
run = "cd app && npm install",
|
|
|
|
setup = function()
|
|
|
|
vim.g.mkdp_filetypes = { "markdown" }
|
|
|
|
vim.g.mkdp_markdown_css = '/home/abs3nt/.config/nvim/static/custom.css'
|
|
|
|
vim.g.mkdp_highlight_css = '/home/abs3nt/.cache/wal/colors.css'
|
|
|
|
vim.g.mkdp_browser = 'surf'
|
|
|
|
vim.g.mkdp_echo_preview_url = 1
|
|
|
|
end,
|
|
|
|
ft = { "markdown" }
|
|
|
|
}
|
|
|
|
|
|
|
|
use {
|
|
|
|
"ellisonleao/glow.nvim",
|
|
|
|
config = function()
|
|
|
|
require('glow').setup({})
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
-- auto pairs
|
|
|
|
use {
|
|
|
|
'windwp/nvim-autopairs',
|
|
|
|
config = function()
|
|
|
|
require('nvim-autopairs').setup {}
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
-- show git diffs
|
|
|
|
use {
|
|
|
|
'lewis6991/gitsigns.nvim',
|
|
|
|
config = function() require('gitsigns').setup() end
|
|
|
|
}
|
|
|
|
|
|
|
|
-- fuzzy finder
|
|
|
|
use {
|
|
|
|
'nvim-telescope/telescope.nvim',
|
|
|
|
branch = '0.1.x',
|
|
|
|
requires = {
|
|
|
|
'nvim-lua/plenary.nvim',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
-- file explorer
|
|
|
|
use {
|
|
|
|
'kyazdani42/nvim-tree.lua',
|
|
|
|
config = function()
|
|
|
|
require('nvim-tree').setup {
|
|
|
|
sort_by = "case_sensitive",
|
|
|
|
view = {
|
|
|
|
adaptive_size = true,
|
|
|
|
mappings = {
|
|
|
|
list = {
|
|
|
|
{ key = "u", action = "dir_up" },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
renderer = {
|
|
|
|
group_empty = true,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
-- open file at last location
|
|
|
|
use {
|
|
|
|
'ethanholz/nvim-lastplace',
|
|
|
|
config = function()
|
|
|
|
require('nvim-lastplace').setup {
|
|
|
|
lastplace_open_folds = true
|
|
|
|
}
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
-- multiple cursors
|
|
|
|
use 'mg979/vim-visual-multi'
|
|
|
|
|
|
|
|
-- wrap things inside pairs
|
|
|
|
use 'FooSoft/vim-argwrap'
|
|
|
|
|
|
|
|
-- which key
|
|
|
|
use {
|
|
|
|
"folke/which-key.nvim",
|
|
|
|
config = function()
|
|
|
|
require("which-key").setup {}
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
-- pasting indents
|
|
|
|
use {
|
|
|
|
'hrsh7th/nvim-pasta',
|
|
|
|
config = function()
|
|
|
|
require('pasta').setup {
|
|
|
|
converters = {
|
|
|
|
require('pasta.converters').indentation,
|
|
|
|
},
|
|
|
|
paste_mode = true,
|
|
|
|
next_key = vim.api.nvim_replace_termcodes('<C-p>', true, true, true),
|
|
|
|
prev_key = vim.api.nvim_replace_termcodes('<C-n>', true, true, true),
|
|
|
|
}
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
use {
|
|
|
|
"hrsh7th/nvim-cmp",
|
|
|
|
requires = {
|
|
|
|
{ "hrsh7th/cmp-nvim-lsp" },
|
|
|
|
{ "hrsh7th/cmp-nvim-lua" },
|
|
|
|
{ "hrsh7th/cmp-buffer" },
|
|
|
|
{ "hrsh7th/cmp-path" },
|
|
|
|
{ "hrsh7th/cmp-cmdline" },
|
|
|
|
{ "L3MON4D3/LuaSnip" },
|
|
|
|
{ "saadparwaiz1/cmp_luasnip" },
|
|
|
|
{ "rafamadriz/friendly-snippets" },
|
|
|
|
{ "f3fora/cmp-spell", { "hrsh7th/cmp-calc" }, { "hrsh7th/cmp-emoji" } },
|
|
|
|
},
|
|
|
|
config = function()
|
|
|
|
require('luasnip.loaders.from_vscode').lazy_load()
|
|
|
|
local cmp = require 'cmp'
|
|
|
|
cmp.setup({
|
|
|
|
snippet = {
|
|
|
|
-- REQUIRED - you must specify a snippet engine
|
|
|
|
expand = function(args)
|
|
|
|
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
|
|
|
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 = 'luasnip' },
|
|
|
|
}, {
|
|
|
|
{ name = 'buffer' },
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
-- Set configuration for specific filetype.
|
|
|
|
cmp.setup.filetype('gitcommit', {
|
|
|
|
sources = cmp.config.sources({
|
|
|
|
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
|
|
|
|
}, {
|
|
|
|
{ name = 'buffer' },
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
|
|
|
cmp.setup.cmdline('/', {
|
|
|
|
mapping = cmp.mapping.preset.cmdline(),
|
|
|
|
sources = {
|
|
|
|
{ name = 'buffer' }
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
|
|
|
cmp.setup.cmdline(':', {
|
|
|
|
mapping = cmp.mapping.preset.cmdline(),
|
|
|
|
sources = cmp.config.sources({
|
|
|
|
{ name = 'path' }
|
|
|
|
}, {
|
|
|
|
{ name = 'cmdline' }
|
|
|
|
})
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
|
|
|
|
-- terminal toggler
|
|
|
|
use {
|
|
|
|
"NvChad/nvterm",
|
|
|
|
config = function()
|
|
|
|
require("nvterm").setup()
|
|
|
|
local toggle_modes = { 'n', 't' }
|
|
|
|
local mappings = {
|
|
|
|
{ toggle_modes, '<leader>th', function() require("nvterm.terminal").toggle('horizontal') end },
|
|
|
|
{ toggle_modes, '<leader>tv', function() require("nvterm.terminal").toggle('vertical') end },
|
|
|
|
{ toggle_modes, '<leader>tf', function() require("nvterm.terminal").toggle('float') end },
|
|
|
|
}
|
|
|
|
local opts = { noremap = true, silent = true }
|
|
|
|
for _, mapping in ipairs(mappings) do
|
|
|
|
vim.keymap.set(mapping[1], mapping[2], mapping[3], opts)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
--- THEME STUFF
|
|
|
|
-- colors
|
|
|
|
use {
|
|
|
|
'AlphaTechnolog/pywal.nvim',
|
|
|
|
as = 'pywal',
|
|
|
|
config = function()
|
|
|
|
local pywal = require('pywal')
|
|
|
|
pywal.setup()
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
-- better statusbar
|
|
|
|
use {
|
|
|
|
'hoob3rt/lualine.nvim',
|
|
|
|
requires = { { 'kyazdani42/nvim-web-devicons', opt = true } },
|
|
|
|
config = function()
|
|
|
|
require('lualine').setup({ options = { theme = 'pywal-nvim' } })
|
|
|
|
end,
|
|
|
|
after = 'pywal'
|
|
|
|
}
|
|
|
|
|
|
|
|
-- better tabs
|
|
|
|
use {
|
|
|
|
'kdheepak/tabline.nvim',
|
|
|
|
requires = { { 'kyazdani42/nvim-web-devicons', opt = true } },
|
|
|
|
config = function()
|
|
|
|
require('tabline').setup({ options = { theme = 'pywal-nvim' } })
|
|
|
|
end,
|
|
|
|
after = { 'pywal' }
|
|
|
|
}
|
|
|
|
|
|
|
|
-- fwatch updates colors automatically
|
|
|
|
use {
|
|
|
|
'rktjmp/fwatch.nvim',
|
|
|
|
config = function()
|
|
|
|
require('fwatch').watch("/home/abs3nt/.cache/wal/colors",
|
|
|
|
{ on_event = function()
|
|
|
|
vim.defer_fn(function()
|
|
|
|
vim.cmd('colorscheme pywal')
|
|
|
|
end, 100)
|
|
|
|
end })
|
|
|
|
end,
|
|
|
|
after = 'pywal'
|
|
|
|
}
|
|
|
|
|
|
|
|
-- greeter
|
|
|
|
use {
|
|
|
|
'goolord/alpha-nvim',
|
|
|
|
|
|
|
|
requires = { 'kyazdani42/nvim-web-devicons' },
|
|
|
|
config = function()
|
|
|
|
local alpha = require('alpha')
|
|
|
|
local dashboard = require('alpha.themes.dashboard')
|
|
|
|
dashboard.section.header.val = {
|
|
|
|
[[ ▄▄▄ ▄▄▄▄ ██████ ███▄ █ ▄▄▄█████▓]],
|
|
|
|
[[▒████▄ ▓█████▄ ▒██ ▒ ██ ▀█ █ ▓ ██▒ ▓▒]],
|
|
|
|
[[▒██ ▀█▄ ▒██▒ ▄██░ ▓██▄ ▓██ ▀█ ██▒▒ ▓██░ ▒░]],
|
|
|
|
[[░██▄▄▄▄██ ▒██░█▀ ▒ ██▒▓██▒ ▐▌██▒░ ▓██▓ ░ ]],
|
|
|
|
[[ ▓█ ▓██▒░▓█ ▀█▓▒██████▒▒▒██░ ▓██░ ▒██▒ ░ ]],
|
|
|
|
[[ ▒▒ ▓▒█░░▒▓███▀▒▒ ▒▓▒ ▒ ░░ ▒░ ▒ ▒ ▒ ░░ ]],
|
|
|
|
[[ ▒ ▒▒ ░▒░▒ ░ ░ ░▒ ░ ░░ ░░ ░ ▒░ ░ ]],
|
|
|
|
[[ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ░ ░ ]],
|
|
|
|
[[ ░ ░ ░ ░ ░ ]],
|
|
|
|
[[ ░ ]]
|
|
|
|
}
|
|
|
|
dashboard.section.buttons.val = {
|
|
|
|
dashboard.button("e", " New file", ":ene <BAR> startinsert <CR>"),
|
|
|
|
dashboard.button("r", " Recently used files", ":Telescope oldfiles<CR>"),
|
|
|
|
dashboard.button("f", " Find file", ":Telescope find_files<CR>"),
|
|
|
|
dashboard.button("t", " Find text", ":Telescope live_grep <CR>"),
|
|
|
|
dashboard.button("s", " Settings",
|
|
|
|
":e $HOME/.config/nvim/init.lua | :cd %:p:h | split . | wincmd k | pwd<CR>"),
|
|
|
|
dashboard.button("q", " Quit NVIM", ":qa<CR>"),
|
|
|
|
}
|
|
|
|
local handle = assert(io.popen('fortune -s'))
|
|
|
|
local fortune = handle:read("*all")
|
|
|
|
handle:close()
|
|
|
|
dashboard.section.footer.val = fortune
|
|
|
|
dashboard.section.header.opts.hl = "Title"
|
|
|
|
dashboard.section.buttons.opts.hl = "Debug"
|
|
|
|
dashboard.section.footer.opts.hl = "Conceal"
|
|
|
|
dashboard.config.opts.noautocmd = true
|
|
|
|
dashboard.config.opts.setup = function()
|
|
|
|
vim.b.lnstatus = "nonumber"
|
|
|
|
end
|
|
|
|
alpha.setup(dashboard.opts)
|
|
|
|
end
|
|
|
|
}
|
2023-02-27 06:09:36 +00:00
|
|
|
if packer_bootstrap then
|
|
|
|
require('packer').sync()
|
|
|
|
end
|
2023-02-20 06:07:04 +00:00
|
|
|
end,
|
|
|
|
config = {
|
|
|
|
display = {
|
|
|
|
open_fn = function()
|
|
|
|
return require('packer.util').float({ border = 'single' })
|
|
|
|
end
|
|
|
|
}
|
2023-02-27 06:09:36 +00:00
|
|
|
}
|
|
|
|
})
|