This commit is contained in:
abs3nt 2023-07-10 20:43:47 -07:00
parent bc5f8b84fc
commit 1951664755
Signed by: abs3nt
GPG Key ID: FDC6662313FA9386
6 changed files with 729 additions and 743 deletions

View File

@ -11,8 +11,8 @@ if not vim.loop.fs_stat(lazypath) then
end end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
require('options') require("options")
require('lazy').setup('plugins') require("lazy").setup("plugins")
require('mappings') require("mappings")
require('lsp_settings') require("lsp_settings")
require('autocmds') require("autocmds")

View File

@ -54,22 +54,29 @@ autocmd("CursorMoved", {
group = _group, group = _group,
}) })
local nvim_tree_events = require('nvim-tree.events') vim.cmd([[
local bufferline_api = require('bufferline.api') :augroup fmt
: autocmd!
: autocmd BufWritePre * silent! undojoin | silent! Neoformat
:augroup END
]])
local nvim_tree_events = require("nvim-tree.events")
local bufferline_api = require("bufferline.api")
local function get_tree_size() local function get_tree_size()
return require 'nvim-tree.view'.View.width return require("nvim-tree.view").View.width
end end
nvim_tree_events.subscribe('TreeOpen', function() nvim_tree_events.subscribe("TreeOpen", function()
bufferline_api.set_offset(get_tree_size()) bufferline_api.set_offset(get_tree_size())
end) end)
nvim_tree_events.subscribe('Resize', function() nvim_tree_events.subscribe("Resize", function()
bufferline_api.set_offset(get_tree_size()) bufferline_api.set_offset(get_tree_size())
end) end)
nvim_tree_events.subscribe('TreeClose', function() nvim_tree_events.subscribe("TreeClose", function()
bufferline_api.set_offset(0) bufferline_api.set_offset(0)
end) end)
@ -109,34 +116,32 @@ autocmd("BufEnter", {
}) })
-- auto close nvimtree -- auto close nvimtree
autocmd('BufEnter', { autocmd("BufEnter", {
command = "if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif", command = "if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif",
nested = true, nested = true,
}) })
-- dont show line numbers for nvimtree buffers -- dont show line numbers for nvimtree buffers
autocmd("BufEnter", autocmd("BufEnter", {
{
pattern = { "NvimTree*" }, pattern = { "NvimTree*" },
callback = function() callback = function()
vim.b.lnstatus = "nonumber" vim.b.lnstatus = "nonumber"
end end,
}) })
-- Disable the statusline, tabline and cmdline while the alpha dashboard is open -- Disable the statusline, tabline and cmdline while the alpha dashboard is open
autocmd('User', { autocmd("User", {
pattern = 'AlphaReady', pattern = "AlphaReady",
desc = 'disable status, tabline and cmdline for alpha', desc = "disable status, tabline and cmdline for alpha",
callback = function() callback = function()
vim.go.laststatus = 1 vim.go.laststatus = 1
vim.opt.showtabline = 1 vim.opt.showtabline = 1
vim.opt.cmdheight = 1 vim.opt.cmdheight = 1
end, end,
}) })
autocmd('BufUnload', { autocmd("BufUnload", {
buffer = 0, buffer = 0,
desc = 'enable status, tabline and cmdline after alpha', desc = "enable status, tabline and cmdline after alpha",
callback = function() callback = function()
vim.go.laststatus = 2 vim.go.laststatus = 2
vim.opt.showtabline = 2 vim.opt.showtabline = 2

View File

@ -1,17 +1,17 @@
require("mason").setup { require("mason").setup({
automatic_installation = true automatic_installation = true,
} })
-- Setup lspconfig. -- Setup lspconfig.
local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()) local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
local navic = require("nvim-navic") local navic = require("nvim-navic")
-- LSP hotkey config -- LSP hotkey config
local opts = { noremap = true, silent = true } local opts = { noremap = true, silent = true }
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts) vim.keymap.set("n", "<space>e", vim.diagnostic.open_float, opts)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts) vim.keymap.set("n", "<space>q", vim.diagnostic.setloclist, opts)
-- Use an on_attach function to only map the following keys -- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer -- after the language server attaches to the current buffer
@ -19,28 +19,28 @@ local on_attach = function(client, bufnr)
if client.server_capabilities.documentSymbolProvider then if client.server_capabilities.documentSymbolProvider then
navic.attach(client, bufnr) navic.attach(client, bufnr)
end end
vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]] -- vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]]
-- Enable completion triggered by <c-x><c-o> -- Enable completion triggered by <c-x><c-o>
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
-- Mappings. -- Mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions -- See `:help vim.lsp.*` for documentation on any of the below functions
local bufopts = { noremap = true, silent = true, buffer = bufnr } local bufopts = { noremap = true, silent = true, buffer = bufnr }
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) vim.keymap.set("n", "gD", vim.lsp.buf.declaration, bufopts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) vim.keymap.set("n", "gd", vim.lsp.buf.definition, bufopts)
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts) vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) vim.keymap.set("n", "gi", vim.lsp.buf.implementation, bufopts)
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts) vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, bufopts)
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts) vim.keymap.set("n", "<space>wa", vim.lsp.buf.add_workspace_folder, bufopts)
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts) vim.keymap.set("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, bufopts)
vim.keymap.set('n', '<space>wl', function() vim.keymap.set("n", "<space>wl", function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders())) print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, bufopts) end, bufopts)
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts) vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, bufopts)
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts) vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, bufopts)
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts) vim.keymap.set("n", "<space>ca", vim.lsp.buf.code_action, bufopts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) vim.keymap.set("n", "gr", vim.lsp.buf.references, bufopts)
vim.keymap.set('n', '<space>f', vim.lsp.buf.formatting, bufopts) vim.keymap.set("n", "<space>f", vim.lsp.buf.formatting, bufopts)
end end
local lsp_flags = { local lsp_flags = {
@ -49,25 +49,25 @@ local lsp_flags = {
} }
--- initialize language servers --- initialize language servers
require('mason-lspconfig').setup() require("mason-lspconfig").setup()
require('mason-lspconfig').setup_handlers { require("mason-lspconfig").setup_handlers({
function(server_name) function(server_name)
require("lspconfig")[server_name].setup { require("lspconfig")[server_name].setup({
on_attach = on_attach, on_attach = on_attach,
flags = lsp_flags, flags = lsp_flags,
capabilities = capabilities, capabilities = capabilities,
settings = { settings = {
Lua = { Lua = {
completion = { completion = {
callSnippet = 'Replace', callSnippet = "Replace",
}, },
diagnostics = { diagnostics = {
globals = { 'vim' } globals = { "vim" },
}
}, },
} },
} },
require("lspconfig")['tsserver'].setup { })
require("lspconfig")["tsserver"].setup({
on_attach = on_attach, on_attach = on_attach,
flags = lsp_flags, flags = lsp_flags,
capabilities = capabilities, capabilities = capabilities,
@ -76,12 +76,12 @@ require('mason-lspconfig').setup_handlers {
format = { format = {
insertSpaceAfterOpeningAndBeforeClosingEmptyBraces = false, insertSpaceAfterOpeningAndBeforeClosingEmptyBraces = false,
insertSpaceAfterFunctionKeywordForAnonymousFunctions = true, insertSpaceAfterFunctionKeywordForAnonymousFunctions = true,
semicolons = 'remove', semicolons = "remove",
}, },
}, },
}, },
} })
require("lspconfig")['pylsp'].setup { require("lspconfig")["pylsp"].setup({
on_attach = on_attach, on_attach = on_attach,
flags = lsp_flags, flags = lsp_flags,
capabilities = capabilities, capabilities = capabilities,
@ -89,13 +89,13 @@ require('mason-lspconfig').setup_handlers {
pylsp = { pylsp = {
plugins = { plugins = {
pycodestyle = { pycodestyle = {
maxLineLength = 120 maxLineLength = 120,
} },
} },
} },
} },
} })
require("lspconfig")['gopls'].setup { require("lspconfig")["gopls"].setup({
on_attach = on_attach, on_attach = on_attach,
flags = lsp_flags, flags = lsp_flags,
capabilities = capabilities, capabilities = capabilities,
@ -109,8 +109,8 @@ require('mason-lspconfig').setup_handlers {
unusedvariable = true, unusedvariable = true,
}, },
staticcheck = true, staticcheck = true,
}
}, },
} },
end })
} end,
})

View File

@ -1,4 +1,4 @@
local vimp = require('vimp') local vimp = require("vimp")
-- tabs and stuff -- tabs and stuff
vimp.vnoremap("<C-b>", [[<C-a>]]) vimp.vnoremap("<C-b>", [[<C-a>]])
@ -13,7 +13,7 @@ vimp.xnoremap("<", [[<gv]])
vimp.xnoremap(">", [[>gv]]) vimp.xnoremap(">", [[>gv]])
-- Toggle Lines -- Toggle Lines
vimp.nnoremap({ 'silent' }, '<leader>l', function() vimp.nnoremap({ "silent" }, "<leader>l", function()
if vim.b.lnstatus == nil then if vim.b.lnstatus == nil then
vim.b.lnstatus = "number" vim.b.lnstatus = "number"
end end
@ -29,18 +29,18 @@ vimp.nnoremap({ 'silent' }, '<leader>l', function()
end) end)
-- plugins -- plugins
vimp.noremap('<leader>md', [[:MarkdownPreviewToggle<CR>]]) vimp.noremap("<leader>md", [[:MarkdownPreviewToggle<CR>]])
vimp.nnoremap({ 'silent' }, '<A-Right>', [[:BufferNext<CR>]]) vimp.nnoremap({ "silent" }, "<A-Right>", [[:BufferNext<CR>]])
vimp.nnoremap({ 'silent' }, '<A-Left>', [[:BufferPrevious<CR>]]) vimp.nnoremap({ "silent" }, "<A-Left>", [[:BufferPrevious<CR>]])
vimp.nnoremap({ "silent" }, "<leader>a", [[:ArgWrap<CR>]])
vimp.nnoremap({ 'silent' }, '<leader>a', [[:ArgWrap<CR>]]) vimp.noremap({ "silent" }, "<leader>n", [[:NvimTreeToggle<CR>]])
vimp.noremap({ "silent" }, "<leader>ff", [[:Telescope find_files<CR>]])
vimp.noremap({ 'silent' }, '<leader>n', [[:NvimTreeToggle<CR>]]) vimp.noremap({ "silent" }, "<leader>fg", [[:Telescope live_grep<CR>]])
vimp.noremap({ "silent" }, "<leader>fb", [[:Telescope buffers<CR>]])
vimp.noremap({ 'silent' }, '<leader>ff', [[:Telescope find_files<CR>]]) vimp.noremap({ "silent" }, "<leader>fp", function()
vimp.noremap({ 'silent' }, '<leader>fg', [[:Telescope live_grep<CR>]]) require("telescope").extensions.projects.projects({})
vimp.noremap({ 'silent' }, '<leader>fb', [[:Telescope buffers<CR>]]) end)
vimp.noremap({ 'silent' }, '<leader>fp', function() require 'telescope'.extensions.projects.projects {} end)

View File

@ -13,11 +13,11 @@ vim.o.mmp = 5000
-- don't give |ins-completion-menu| messages. -- don't give |ins-completion-menu| messages.
vim.o.hidden = true vim.o.hidden = true
vim.o.signcolumn = 'yes' vim.o.signcolumn = "yes"
vim.o.encoding = 'utf-8' vim.o.encoding = "utf-8"
vim.o.shortmess = 'c' vim.o.shortmess = "c"
vim.o.autoread = true vim.o.autoread = true
vim.o.backspace = 'indent,eol,start' vim.o.backspace = "indent,eol,start"
vim.o.ruler = true vim.o.ruler = true
vim.o.showmode = true vim.o.showmode = true
vim.o.history = 1000 vim.o.history = 1000
@ -35,24 +35,24 @@ vim.o.softtabstop = 2
vim.o.tabstop = 2 vim.o.tabstop = 2
vim.o.expandtab = true vim.o.expandtab = true
vim.o.scrolloff = 5 vim.o.scrolloff = 5
vim.o.foldmethod = 'indent' vim.o.foldmethod = "indent"
vim.o.foldlevel = 99 vim.o.foldlevel = 99
vim.wo.wrap = false vim.wo.wrap = false
vim.o.showcmd = true vim.o.showcmd = true
vim.o.number = true vim.o.number = true
vim.o.relativenumber = true vim.o.relativenumber = true
vim.o.mouse = 'a' vim.o.mouse = "a"
vim.o.redrawtime = 10000 vim.o.redrawtime = 10000
vim.o.inccommand = 'split' vim.o.inccommand = "split"
---- Sync " and + registers ---- Sync " and + registers
vim.o.clipboard = 'unnamedplus' vim.o.clipboard = "unnamedplus"
-- show completion options on <TAB> -- show completion options on <TAB>
vim.o.wildmenu = true vim.o.wildmenu = true
-- complete only up to the point of ambiguity -- complete only up to the point of ambiguity
vim.o.wildmode = 'list:longest' vim.o.wildmode = "list:longest"
vim.opt.backupdir = os.getenv("XDG_CACHE_HOME") .. '/nvim/backup//' vim.opt.backupdir = os.getenv("XDG_CACHE_HOME") .. "/nvim/backup//"
vim.o.directory = os.getenv("XDG_CACHE_HOME") .. '/nvim/swap//' vim.o.directory = os.getenv("XDG_CACHE_HOME") .. "/nvim/swap//"
vim.o.undodir = os.getenv("XDG_CACHE_HOME") .. '/nvim/undo//' vim.o.undodir = os.getenv("XDG_CACHE_HOME") .. "/nvim/undo//"
vim.o.undofile = true vim.o.undofile = true

View File

@ -1,16 +1,16 @@
return { return {
-- https://github.com/tpope/vim-obsession -- https://github.com/tpope/vim-obsession
'tpope/vim-obsession', "tpope/vim-obsession",
-- https://github.com/svermeulen/vimpeccable -- https://github.com/svermeulen/vimpeccable
'svermeulen/vimpeccable', "svermeulen/vimpeccable",
-- https://github.com/kien/ctrlp.vim -- https://github.com/kien/ctrlp.vim
'ctrlpvim/ctrlp.vim', "ctrlpvim/ctrlp.vim",
-- https://github.com/lervag/vimtex#installation -- https://github.com/lervag/vimtex#installation
'lervag/vimtex', "lervag/vimtex",
-- https://github.com/iamcco/markdown-preview.nvim -- https://github.com/iamcco/markdown-preview.nvim
{ {
@ -20,46 +20,25 @@ return {
end, end,
config = function() config = function()
vim.g.mkdp_filetypes = { "markdown" } vim.g.mkdp_filetypes = { "markdown" }
vim.g.mkdp_markdown_css = os.getenv("XDG_CONFIG_HOME") .. '/nvim/static/custom.css' vim.g.mkdp_markdown_css = os.getenv("XDG_CONFIG_HOME") .. "/nvim/static/custom.css"
vim.g.mkdp_highlight_css = os.getenv("XDG_CACHE_HOME") .. '/wal/colors.css' vim.g.mkdp_highlight_css = os.getenv("XDG_CACHE_HOME") .. "/wal/colors.css"
vim.g.mkdp_browser = 'rose' vim.g.mkdp_browser = "rose"
vim.g.mkdp_echo_preview_url = 1 vim.g.mkdp_echo_preview_url = 1
end, end,
ft = { "markdown" } ft = { "markdown" },
}, },
{ {
'windwp/nvim-spectre', "windwp/nvim-spectre",
dependencies = { 'nvim-lua/plenary.nvim' }, dependencies = { "nvim-lua/plenary.nvim" },
}, },
{ {
'MunifTanjim/prettier.nvim', "sbdchd/neoformat",
config = function()
local prettier = require("prettier")
prettier.setup({
bin = 'prettierd', -- or `'prettierd'` (v0.23.3+)
filetypes = {
"css",
"graphql",
"html",
"javascript",
"javascriptreact",
"json",
"less",
"markdown",
"scss",
"typescript",
"typescriptreact",
"yaml",
},
})
end
}, },
{ {
'simrat39/rust-tools.nvim', "simrat39/rust-tools.nvim",
config = function() config = function()
local rt = require("rust-tools") local rt = require("rust-tools")
rt.setup({ rt.setup({
@ -72,16 +51,16 @@ return {
end, end,
}, },
}) })
end end,
}, },
{ {
'ray-x/web-tools.nvim', "ray-x/web-tools.nvim",
config = function() config = function()
require 'web-tools'.setup({ require("web-tools").setup({
keymaps = { keymaps = {
rename = nil, -- by default use same setup of lspconfig rename = nil, -- by default use same setup of lspconfig
repeat_rename = '.', -- . to repeat repeat_rename = ".", -- . to repeat
}, },
hurl = { hurl = {
-- hurl default -- hurl default
@ -89,17 +68,17 @@ return {
floating = false, -- use floating windows (need guihua.lua) floating = false, -- use floating windows (need guihua.lua)
formatters = { formatters = {
-- format the result by filetype -- format the result by filetype
json = { 'jq' }, json = { "jq" },
html = { 'prettier', '--parser', 'html' }, html = { "prettier", "--parser", "html" },
}, },
}, },
}) })
end end,
}, },
-- https://github.com/fatih/vim-go -- https://github.com/fatih/vim-go
{ {
'fatih/vim-go', "fatih/vim-go",
config = function() config = function()
vim.g.go_fmt_command = "gofumpt" vim.g.go_fmt_command = "gofumpt"
vim.g.go_fmt_fail_silently = 1 vim.g.go_fmt_fail_silently = 1
@ -110,85 +89,84 @@ return {
vim.g.go_highlight_operators = 1 vim.g.go_highlight_operators = 1
vim.g.go_highlight_extra_types = 1 vim.g.go_highlight_extra_types = 1
vim.g.go_highlight_build_constraints = 1 vim.g.go_highlight_build_constraints = 1
vim.g.go_metalinter_command = 'golangci-lint' vim.g.go_metalinter_command = "golangci-lint"
end end,
}, },
-- https://github.com/norcalli/nvim-colorizer.lua -- https://github.com/norcalli/nvim-colorizer.lua
{ {
'norcalli/nvim-colorizer.lua', "norcalli/nvim-colorizer.lua",
config = function() config = function()
require('colorizer').setup() require("colorizer").setup()
end, end,
}, },
-- https://github.com/numToStr/Comment.nvim -- https://github.com/numToStr/Comment.nvim
{ {
'numToStr/Comment.nvim', "numToStr/Comment.nvim",
config = function() config = function()
require('Comment').setup() require("Comment").setup()
end end,
}, },
{ {
"ahmedkhalf/project.nvim", "ahmedkhalf/project.nvim",
config = function() config = function()
require("project_nvim").setup {} require("project_nvim").setup({})
end end,
}, },
-- https://github.com/ellisonleao/glow.nvim -- https://github.com/ellisonleao/glow.nvim
{ {
"ellisonleao/glow.nvim", "ellisonleao/glow.nvim",
cmd = "Glow", cmd = "Glow",
config = function() config = function()
require('glow').setup({}) require("glow").setup({})
end, end,
ft = { "markdown" } ft = { "markdown" },
}, },
-- https://github.com/windwp/nvim-autopairs -- https://github.com/windwp/nvim-autopairs
{ {
'windwp/nvim-autopairs', "windwp/nvim-autopairs",
config = function() config = function()
require('nvim-autopairs').setup {} require("nvim-autopairs").setup({})
end, end,
}, },
-- https://github.com/lewis6991/gitsigns.nvim -- https://github.com/lewis6991/gitsigns.nvim
{ {
'lewis6991/gitsigns.nvim', "lewis6991/gitsigns.nvim",
config = function() config = function()
require('gitsigns').setup({ require("gitsigns").setup({
current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame` current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = { current_line_blame_opts = {
virt_text = true, virt_text = true,
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align'
delay = 100, delay = 100,
ignore_whitespace = false, ignore_whitespace = false,
}, },
yadm = { yadm = {
enable = true enable = true,
}, },
}) })
end end,
}, },
-- https://github.com/nvim-telescope/telescope.nvim -- https://github.com/nvim-telescope/telescope.nvim
{ {
'nvim-telescope/telescope.nvim', "nvim-telescope/telescope.nvim",
cmd = "Telescope", cmd = "Telescope",
branch = '0.1.x', branch = "0.1.x",
dependencies = { dependencies = {
{ {
'nvim-lua/plenary.nvim', "nvim-lua/plenary.nvim",
lazy = true lazy = true,
}, },
}, },
config = function() config = function()
require('telescope').load_extension('projects') require("telescope").load_extension("projects")
end end,
}, },
-- https://github.com/SmiteshP/nvim-navic -- https://github.com/SmiteshP/nvim-navic
@ -196,7 +174,7 @@ return {
"SmiteshP/nvim-navic", "SmiteshP/nvim-navic",
dependencies = "neovim/nvim-lspconfig", dependencies = "neovim/nvim-lspconfig",
config = function() config = function()
require('nvim-navic').setup({ require("nvim-navic").setup({
icons = { icons = {
File = "", File = "",
Module = "", Module = "",
@ -229,24 +207,24 @@ return {
separator = " > ", separator = " > ",
depth_limit = 0, depth_limit = 0,
depth_limit_indicator = "..", depth_limit_indicator = "..",
safe_output = true safe_output = true,
}) })
end end,
}, },
-- https://github.com/nvim-tree/nvim-tree.lua -- https://github.com/nvim-tree/nvim-tree.lua
{ {
'nvim-tree/nvim-tree.lua', "nvim-tree/nvim-tree.lua",
dependencies = { dependencies = {
'nvim-tree/nvim-web-devicons' "nvim-tree/nvim-web-devicons",
}, },
config = function() config = function()
require('nvim-tree').setup { require("nvim-tree").setup({
sync_root_with_cwd = true, sync_root_with_cwd = true,
respect_buf_cwd = true, respect_buf_cwd = true,
update_focused_file = { update_focused_file = {
enable = true, enable = true,
update_root = true update_root = true,
}, },
sort_by = "case_sensitive", sort_by = "case_sensitive",
view = { view = {
@ -261,8 +239,8 @@ return {
live_filter = { live_filter = {
always_show_folders = false, always_show_folders = false,
}, },
} })
end end,
}, },
-- https://github.com/kylechui/nvim-surround -- https://github.com/kylechui/nvim-surround
@ -272,25 +250,25 @@ return {
require("nvim-surround").setup({ require("nvim-surround").setup({
-- Configuration here, or leave empty to use defaults -- Configuration here, or leave empty to use defaults
}) })
end end,
}, },
-- https://github.com/ethanholz/nvim-lastplace -- https://github.com/ethanholz/nvim-lastplace
{ {
'ethanholz/nvim-lastplace', "ethanholz/nvim-lastplace",
config = function() config = function()
require('nvim-lastplace').setup { require("nvim-lastplace").setup({
lastplace_open_folds = true lastplace_open_folds = true,
} })
end end,
}, },
-- https://github.com/mg979/vim-visual-multi -- https://github.com/mg979/vim-visual-multi
'mg979/vim-visual-multi', "mg979/vim-visual-multi",
-- https://github.com/FooSoft/vim-argwrap -- https://github.com/FooSoft/vim-argwrap
{ {
'FooSoft/vim-argwrap', "FooSoft/vim-argwrap",
}, },
-- https://github.com/kylechui/nvim-surround -- https://github.com/kylechui/nvim-surround
@ -298,17 +276,17 @@ return {
"kylechui/nvim-surround", "kylechui/nvim-surround",
config = function() config = function()
require("nvim-surround").setup() require("nvim-surround").setup()
end end,
}, },
-- https://github.com/neovim/nvim-lspconfig -- https://github.com/neovim/nvim-lspconfig
'neovim/nvim-lspconfig', "neovim/nvim-lspconfig",
-- https://github.com/williamboman/mason-lspconfig.nvim -- https://github.com/williamboman/mason-lspconfig.nvim
'williamboman/mason-lspconfig', "williamboman/mason-lspconfig",
-- https://github.com/williamboman/mason.nvim -- https://github.com/williamboman/mason.nvim
'williamboman/mason.nvim', "williamboman/mason.nvim",
-- https://github.com/hrsh7th/nvim-cmp -- https://github.com/hrsh7th/nvim-cmp
{ {
@ -325,17 +303,18 @@ return {
{ "onsails/lspkind.nvim" }, { "onsails/lspkind.nvim" },
}, },
config = function() config = function()
local lspkind = require('lspkind') local lspkind = require("lspkind")
local has_words_before = function() local has_words_before = function()
unpack = unpack or table.unpack unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0)) local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil return col ~= 0
and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end end
local cmp = require 'cmp' local cmp = require("cmp")
local luasnip = require("luasnip") local luasnip = require("luasnip")
cmp.setup({ cmp.setup({
experimental = { experimental = {
ghost_text = true ghost_text = true,
}, },
snippet = { snippet = {
expand = function(args) expand = function(args)
@ -344,24 +323,24 @@ return {
}, },
formatting = { formatting = {
format = lspkind.cmp_format({ format = lspkind.cmp_format({
mode = 'symbol', mode = "symbol",
maxwidth = 50, maxwidth = 50,
ellipsis_char = '...', ellipsis_char = "...",
before = function(entry, vim_item) before = function(entry, vim_item)
return vim_item return vim_item
end end,
}) }),
}, },
window = { window = {
completion = cmp.config.window.bordered(), completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(), documentation = cmp.config.window.bordered(),
}, },
mapping = cmp.mapping.preset.insert({ mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4), ["<C-b>"] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4), ["<C-f>"] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(), ["<C-Space>"] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(), ["<C-e>"] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = false }), ["<CR>"] = cmp.mapping.confirm({ select = false }),
["<Tab>"] = cmp.mapping(function(fallback) ["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_next_item() cmp.select_next_item()
@ -386,118 +365,117 @@ return {
end, { "i", "s" }), end, { "i", "s" }),
}), }),
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = 'nvim_lsp' }, { name = "nvim_lsp" },
{ name = 'nvim_lua' }, { name = "nvim_lua" },
{ name = 'path' }, { name = "path" },
{ name = 'luasnip' }, { name = "luasnip" },
{ name = 'neorg' }, { name = "neorg" },
}, { }, {
{ name = 'buffer' }, { name = "buffer" },
}) }),
}) })
cmp.setup.filetype('gitcommit', { cmp.setup.filetype("gitcommit", {
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = 'cmp_git' }, { name = "cmp_git" },
}, { }, {
{ name = 'buffer' }, { name = "buffer" },
}) }),
}) })
cmp.setup.cmdline('/', { cmp.setup.cmdline("/", {
mapping = cmp.mapping.preset.cmdline(), mapping = cmp.mapping.preset.cmdline(),
sources = { sources = {
{ name = 'buffer' } { name = "buffer" },
} },
}) })
cmp.setup.cmdline(':', { cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(), mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = 'path' } { name = "path" },
}, { }, {
{ name = 'cmdline' } { name = "cmdline" },
}),
}) })
}) require("luasnip.loaders.from_vscode").lazy_load()
require('luasnip.loaders.from_vscode').lazy_load()
end, end,
}, },
-- https://github.com/AlphaTechnolog/pywal.nvim -- https://github.com/AlphaTechnolog/pywal.nvim
{ {
'AlphaTechnolog/pywal.nvim', "AlphaTechnolog/pywal.nvim",
priority = 1000, priority = 1000,
name = 'pywal', name = "pywal",
config = function() config = function()
local pywal = require('pywal') local pywal = require("pywal")
pywal.setup() pywal.setup()
end end,
}, },
-- https://github.com/nvim-lualine/lualine.nvim -- https://github.com/nvim-lualine/lualine.nvim
{ {
'hoob3rt/lualine.nvim', "hoob3rt/lualine.nvim",
dependencies = { { 'nvim-tree/nvim-web-devicons' } }, dependencies = { { "nvim-tree/nvim-web-devicons" } },
config = function() config = function()
local navic = require("nvim-navic") local navic = require("nvim-navic")
require('lualine').setup({ require("lualine").setup({
sections = { sections = {
lualine_c = { lualine_c = {
{ navic.get_location, cond = navic.is_available }, { navic.get_location, cond = navic.is_available },
} },
}, },
options = { options = {
theme = 'pywal-nvim' theme = "pywal-nvim",
} },
}) })
end, end,
}, },
-- https://github.com/romgrk/barbar.nvim -- https://github.com/romgrk/barbar.nvim
{ {
'romgrk/barbar.nvim', "romgrk/barbar.nvim",
dependencies = 'nvim-tree/nvim-web-devicons', dependencies = "nvim-tree/nvim-web-devicons",
config = function() config = function()
require 'bufferline'.setup { require("bufferline").setup({
animation = true, animation = true,
closable = true, closable = true,
clickable = true, clickable = true,
icons = { icons = {
seperator = { seperator = {
left = ' ', left = " ",
}, },
incactive = { incactive = {
seperator = { seperator = {
left = ' ', left = " ",
}, },
}, },
} },
} })
end end,
}, },
-- https://github.com/rktjmp/fwatch.nvim -- https://github.com/rktjmp/fwatch.nvim
{ {
'rktjmp/fwatch.nvim', "rktjmp/fwatch.nvim",
config = function() config = function()
require('fwatch').watch(os.getenv("XDG_CACHE_HOME") .. "/wal/colors", require("fwatch").watch(os.getenv("XDG_CACHE_HOME") .. "/wal/colors", {
{
on_event = function() on_event = function()
vim.defer_fn(function() vim.defer_fn(function()
vim.cmd('colorscheme pywal') vim.cmd("colorscheme pywal")
end, 100) end, 100)
end end,
}) })
end, end,
}, },
-- https://github.com/goolord/alpha-nvim -- https://github.com/goolord/alpha-nvim
{ {
'goolord/alpha-nvim', "goolord/alpha-nvim",
dependencies = { 'nvim-tree/nvim-web-devicons' }, dependencies = { "nvim-tree/nvim-web-devicons" },
config = function() config = function()
local alpha = require('alpha') local alpha = require("alpha")
local dashboard = require('alpha.themes.dashboard') local dashboard = require("alpha.themes.dashboard")
dashboard.section.header.val = { dashboard.section.header.val = {
[[ ▄▄▄ ▄▄▄▄ ██████ ███▄ █ ▄▄▄█████▓]], [[ ▄▄▄ ▄▄▄▄ ██████ ███▄ █ ▄▄▄█████▓]],
[[▒████▄ ▓█████▄ ▒██ ▒ ██ ▀█ █ ▓ ██▒ ▓▒]], [[▒████▄ ▓█████▄ ▒██ ▒ ██ ▀█ █ ▓ ██▒ ▓▒]],
@ -508,7 +486,7 @@ return {
[[ ▒ ▒▒ ░▒░▒ ░ ░ ░▒ ░ ░░ ░░ ░ ▒░ ░ ]], [[ ▒ ▒▒ ░▒░▒ ░ ░ ░▒ ░ ░░ ░░ ░ ▒░ ░ ]],
[[ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ░ ░ ]], [[ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ░ ░ ]],
[[ ░ ░ ░ ░ ░ ]], [[ ░ ░ ░ ░ ░ ]],
[[ ░ ]] [[ ░ ]],
} }
dashboard.section.buttons.val = { dashboard.section.buttons.val = {
dashboard.button("e", " New file", ":ene <BAR> startinsert <CR>"), dashboard.button("e", " New file", ":ene <BAR> startinsert <CR>"),
@ -516,11 +494,14 @@ return {
dashboard.button("p", " Find project", ":Telescope projects<CR>"), dashboard.button("p", " Find project", ":Telescope projects<CR>"),
dashboard.button("f", " Find file", ":Telescope find_files<CR>"), dashboard.button("f", " Find file", ":Telescope find_files<CR>"),
dashboard.button("t", " Find text", ":Telescope live_grep <CR>"), dashboard.button("t", " Find text", ":Telescope live_grep <CR>"),
dashboard.button("s", " Settings", dashboard.button(
":e $HOME/.config/nvim/init.lua | :cd %:p:h | split . | wincmd k | pwd<CR>"), "s",
" Settings",
":e $HOME/.config/nvim/init.lua | :cd %:p:h | split . | wincmd k | pwd<CR>"
),
dashboard.button("q", " Quit NVIM", ":qa<CR>"), dashboard.button("q", " Quit NVIM", ":qa<CR>"),
} }
dashboard.section.footer.val = require 'alpha.fortune' dashboard.section.footer.val = require("alpha.fortune")
dashboard.section.header.opts.hl = "Title" dashboard.section.header.opts.hl = "Title"
dashboard.section.buttons.opts.hl = "Debug" dashboard.section.buttons.opts.hl = "Debug"
dashboard.section.footer.opts.hl = "Conceal" dashboard.section.footer.opts.hl = "Conceal"
@ -529,6 +510,6 @@ return {
vim.b.lnstatus = "nonumber" vim.b.lnstatus = "nonumber"
end end
alpha.setup(dashboard.opts) alpha.setup(dashboard.opts)
end end,
}, },
} }