Merge branch 'main' of github.com:RokasPuzonas/neovim-config into main
This commit is contained in:
commit
8cbd95bc39
@ -1,8 +1,10 @@
|
||||
# Neovim Config
|
||||
|
||||
To ignore changes to local plugins file. Used for keeping computer specific configs/plugins
|
||||
```shell
|
||||
git update-index --assume-unchanged lua/plugins-local.lua
|
||||
```
|
||||
|
||||
## Requirements
|
||||
* ripgrep - for telescope
|
||||
* [A patched font](https://www.nerdfonts.com/) - for icons
|
||||
|
||||
|
||||
|
8
after/plugin/lspsignature-theme.lua
Normal file
8
after/plugin/lspsignature-theme.lua
Normal file
@ -0,0 +1,8 @@
|
||||
if vim.g.colors_name == "srcery" then
|
||||
local hard_black = vim.api.nvim_get_hl_by_name("SrceryHardBlack", true).foreground
|
||||
local bright_white = vim.api.nvim_get_hl_by_name("SrceryBrightWhite", true).foreground
|
||||
|
||||
vim.api.nvim_set_hl(0, "FloatBorder", {bg=hard_black, fg=bright_white})
|
||||
vim.api.nvim_set_hl(0, "FloatNormal", {bg=hard_black, fg=bright_white})
|
||||
vim.api.nvim_set_hl(0, "Pmenu", {bg=hard_black, fg=bright_white})
|
||||
end
|
22
after/plugin/telescope-theme.lua
Normal file
22
after/plugin/telescope-theme.lua
Normal file
@ -0,0 +1,22 @@
|
||||
if vim.g.colors_name == "srcery" then
|
||||
local bright_white = vim.api.nvim_get_hl_by_name("SrceryBrightWhite", true).foreground
|
||||
local hard_black = vim.api.nvim_get_hl_by_name("SrceryHardBlack", true).foreground
|
||||
local red = vim.api.nvim_get_hl_by_name("SrceryRed", true).foreground
|
||||
local yellow = vim.api.nvim_get_hl_by_name("SrceryYellow", true).foreground
|
||||
local gray1 = vim.api.nvim_get_hl_by_name("SrceryXgray1", true).foreground
|
||||
|
||||
local TelescopePrompt = {
|
||||
TelescopeBorder = {bg = hard_black, fg = hard_black},
|
||||
TelescopePromptBorder = {bg = gray1, fg = gray1},
|
||||
TelescopePromptNormal = {bg = gray1},
|
||||
TelescopePromptTitle = {fg = hard_black, bg = red },
|
||||
TelescopePreviewTitle = {fg = hard_black, bg = yellow },
|
||||
TelescopeNormal = {bg = hard_black, fg = bright_white},
|
||||
TelescopeResultsNormal = {bg = hard_black, fg = bright_white},
|
||||
TelescopePreviewNormal = {bg = hard_black, fg = bright_white},
|
||||
TelescopeSelection = {bg = hard_black, fg = bright_white, underline = true},
|
||||
}
|
||||
for hl, col in pairs(TelescopePrompt) do
|
||||
vim.api.nvim_set_hl(0, hl, col)
|
||||
end
|
||||
end
|
41
init.lua
41
init.lua
@ -1,46 +1,21 @@
|
||||
local opt = require 'utils.opt'
|
||||
local g = vim.g
|
||||
local cmd = vim.cmd
|
||||
|
||||
-- Allow loading */init.lua files
|
||||
package.path = "./?/init.lua;"..package.path
|
||||
|
||||
-- Leader/local leader
|
||||
g.mapleader = [[ ]]
|
||||
g.maplocalleader = [[,]]
|
||||
vim.g.mapleader = [[ ]]
|
||||
vim.g.maplocalleader = [[,]]
|
||||
|
||||
-- Disable some built-in plugins we don't want
|
||||
local disabled_built_ins = {
|
||||
'matchit',
|
||||
'netrw',
|
||||
'netrwPlugin',
|
||||
'netrwSettings',
|
||||
'netrwFileHandlers',
|
||||
}
|
||||
|
||||
for _, name in ipairs(disabled_built_ins) do
|
||||
g['loaded_' .. name] = 1
|
||||
end
|
||||
|
||||
require("plugins")
|
||||
require("disable-builtin")
|
||||
require("highlight-yank")
|
||||
require("plugin-manager")
|
||||
require("options")
|
||||
require("bindings")
|
||||
require("pludin-dev")
|
||||
|
||||
require("add-guard")
|
||||
require("cmacro-align")
|
||||
|
||||
-- Misc features
|
||||
require("highlight-yank")
|
||||
|
||||
-- Background transparency
|
||||
-- cmd [[autocmd ColorScheme * highlight Normal ctermbg=none guibg=none]]
|
||||
-- cmd [[autocmd ColorScheme * highlight Folded ctermbg=none guibg=none]]
|
||||
-- cmd [[autocmd ColorScheme * highlight SignColumn ctermbg=none guibg=none]]
|
||||
-- cmd [[autocmd ColorScheme * highlight VertSplit ctermbg=none guibg=none]]
|
||||
-- cmd [[autocmd ColorScheme * highlight StatusLineNC ctermbg=none guibg=none]]
|
||||
-- cmd [[autocmd ColorScheme * highlight CursorLineNr ctermbg=none guibg=none]]
|
||||
require("personal.add-guard")
|
||||
require("personal.cmacro-align")
|
||||
|
||||
-- THEME_BEGIN
|
||||
cmd("colorscheme srcery")
|
||||
vim.cmd("colorscheme srcery")
|
||||
-- THEME_END
|
||||
|
@ -6,7 +6,7 @@ local silent = {silent = true}
|
||||
map('n', 'Q', '<nop>')
|
||||
|
||||
-- Save file
|
||||
map('n', '<C-s>', ':w<cr>')
|
||||
map('n', '<C-s>', ':w<cr>', silent)
|
||||
|
||||
-- Paste from register and not replace it
|
||||
-- map('x', '<leader>p', '"_dP')
|
||||
@ -31,13 +31,6 @@ map('v', '>', '>gv')
|
||||
map('n', '<C-Left>', ':tabprevious<cr>', silent)
|
||||
map('n', '<C-Right>', ':tabnext<cr>', silent)
|
||||
|
||||
-- Move lines up or down
|
||||
map('n', '<A-j>', ':m .+1<CR>==', silent)
|
||||
map('n', '<A-j>', ':m .+1<CR>==', silent)
|
||||
map('n', '<A-k>', ':m .-2<CR>==', silent)
|
||||
map('v', '<A-j>', ":m '>+1<CR>gv=gv", silent)
|
||||
map('v', '<A-k>', ":m '<-2<CR>gv=gv", silent)
|
||||
|
||||
-- Move between windows easier in terminal windows
|
||||
function _G.set_terminal_keymaps()
|
||||
local opts = {buffer = 0}
|
||||
|
@ -1,3 +1,7 @@
|
||||
local user = os.getenv("USER")
|
||||
vim.g.autosource_hashdir = '/home/'..user..'/.cache/vim-autosource/hashes'
|
||||
|
||||
return {
|
||||
'jenterkin/vim-autosource',
|
||||
config = function()
|
||||
local user = os.getenv("USER")
|
||||
vim.g.autosource_hashdir = '/home/'..user..'/.cache/vim-autosource/hashes'
|
||||
end
|
||||
}
|
||||
|
@ -1,4 +1,14 @@
|
||||
local baleia = require("baleia").setup()
|
||||
vim.api.nvim_create_user_command("BaleiaColorize", function()
|
||||
return {
|
||||
'm00qek/baleia.nvim',
|
||||
tag = 'v1.2.0',
|
||||
config = function()
|
||||
local baleia = require("baleia").setup()
|
||||
vim.api.nvim_create_user_command("BaleiaColorize", function()
|
||||
baleia.once(vim.api.nvim_get_current_buf())
|
||||
end, { })
|
||||
end, { })
|
||||
|
||||
require("legendary").command{
|
||||
":BaleiaColorize", description = "Colorize ANSI codes"
|
||||
}
|
||||
end
|
||||
}
|
||||
|
15
lua/config/based.lua
Normal file
15
lua/config/based.lua
Normal file
@ -0,0 +1,15 @@
|
||||
return {
|
||||
'trmckay/based.nvim',
|
||||
config = function ()
|
||||
local based = require("based")
|
||||
based.setup{}
|
||||
|
||||
vim.keymap.set({"n", "v"}, "<C-b>", based.convert)
|
||||
|
||||
require("legendary").keymap{
|
||||
"<C-b>",
|
||||
{ n = based.convert, v = based.convert },
|
||||
description = "Convert number to other base"
|
||||
}
|
||||
end
|
||||
}
|
@ -1,4 +1,7 @@
|
||||
require('colorizer').setup(
|
||||
return {
|
||||
'norcalli/nvim-colorizer.lua',
|
||||
config = function()
|
||||
require('colorizer').setup(
|
||||
nil,
|
||||
{
|
||||
RGB = true,
|
||||
@ -11,5 +14,6 @@ require('colorizer').setup(
|
||||
css_fn = false,
|
||||
mode = 'background'
|
||||
}
|
||||
)
|
||||
|
||||
)
|
||||
end
|
||||
}
|
||||
|
@ -1,11 +1,17 @@
|
||||
local config = {}
|
||||
return {
|
||||
'terrortylor/nvim-comment',
|
||||
requires = 'JoosepAlviste/nvim-ts-context-commentstring',
|
||||
config = function()
|
||||
local config = {}
|
||||
|
||||
if packer_plugins['nvim-ts-context-commentstring'] and packer_plugins['nvim-ts-context-commentstring'].loaded then
|
||||
if packer_plugins['nvim-ts-context-commentstring'] and packer_plugins['nvim-ts-context-commentstring'].loaded then
|
||||
config.hook = function()
|
||||
if vim.api.nvim_buf_get_option(0, "filetype") == "vue" then
|
||||
require("ts_context_commentstring.internal").update_commentstring()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
require("nvim_comment").setup(config)
|
||||
require("nvim_comment").setup(config)
|
||||
end
|
||||
}
|
||||
|
4
lua/config/devicons.lua
Normal file
4
lua/config/devicons.lua
Normal file
@ -0,0 +1,4 @@
|
||||
return {
|
||||
'kyazdani42/nvim-web-devicons',
|
||||
config = function() require('nvim-web-devicons').setup() end
|
||||
}
|
9
lua/config/diffview.lua
Normal file
9
lua/config/diffview.lua
Normal file
@ -0,0 +1,9 @@
|
||||
return {
|
||||
"sindrets/diffview.nvim",
|
||||
requires = 'nvim-lua/plenary.nvim',
|
||||
config = function()
|
||||
require("legendary").command{
|
||||
":DiffviewOpen", description = "Open diff view"
|
||||
}
|
||||
end
|
||||
}
|
27
lua/config/dressing.lua
Normal file
27
lua/config/dressing.lua
Normal file
@ -0,0 +1,27 @@
|
||||
return {
|
||||
"stevearc/dressing.nvim",
|
||||
requires = "nvim-telescope/telescope.nvim",
|
||||
config = function()
|
||||
require('dressing').setup({
|
||||
select = {
|
||||
get_config = function(opts)
|
||||
opts = opts or {}
|
||||
local cfg = {
|
||||
telescope = {
|
||||
layout_config = {
|
||||
-- width = 120,
|
||||
-- height = 60,
|
||||
width = 0.87,
|
||||
height = 0.80,
|
||||
},
|
||||
},
|
||||
}
|
||||
if opts.kind == 'legendary.nvim' then
|
||||
cfg.telescope.sorter = require('telescope.sorters').fuzzy_with_index_bias({})
|
||||
end
|
||||
return cfg
|
||||
end,
|
||||
},
|
||||
})
|
||||
end
|
||||
}
|
@ -1,3 +1,9 @@
|
||||
local map = require 'utils.map'
|
||||
|
||||
map('n', '<leader>gg', ':G<cr>', { silent = true })
|
||||
return {
|
||||
'tpope/vim-fugitive',
|
||||
config = function ()
|
||||
-- TODO: Add most commonly used fugitive bindings
|
||||
require("legendary").keymaps{
|
||||
{"<leader>gg", ":G<cr>", description = "Open fugitive", opts = {silent = true}}
|
||||
}
|
||||
end
|
||||
}
|
||||
|
@ -1,8 +1,22 @@
|
||||
local map = require 'utils.map'
|
||||
local silent = {silent = true}
|
||||
return {
|
||||
'f-person/git-blame.nvim',
|
||||
config = function ()
|
||||
local silent = {silent = true}
|
||||
|
||||
map('n', '<leader>gm', ":GitBlameCopySHA<CR>", silent)
|
||||
map('n', '<leader>gj', ":GitBlameOpenCommitURL<CR>", silent)
|
||||
map('n', '<leader>gu', ":GitBlameToggle<CR>", silent)
|
||||
require("legendary").keymaps{
|
||||
{
|
||||
itemgroup = "gitblame",
|
||||
description = "Git blame",
|
||||
icon = "",
|
||||
keymaps = {
|
||||
{"<leader>gm", ":GitBlameCopySHA<CR>", description = "Copy commit hash", opts = silent},
|
||||
{"<leader>gj", ":GitBlameOpenCommit<CR>", description = "Open commit", opts = silent},
|
||||
{"<leader>gu", ":GitBlameToggle<CR>", description = "Toggle git blame", opts = silent},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vim.g["gitblame_enabled"] = 0
|
||||
vim.g["gitblame_enabled"] = 0
|
||||
vim.g["gitblame_date_format"] = "%r"
|
||||
end
|
||||
}
|
||||
|
@ -1,33 +1,42 @@
|
||||
local gitsigns = require 'gitsigns'
|
||||
return {
|
||||
'lewis6991/gitsigns.nvim',
|
||||
requires = 'nvim-lua/plenary.nvim',
|
||||
config = function ()
|
||||
local gitsigns = require 'gitsigns'
|
||||
|
||||
gitsigns.setup{
|
||||
gitsigns.setup{
|
||||
on_attach = function(bufnr)
|
||||
local function map(mode, lhs, rhs, opts)
|
||||
opts = vim.tbl_extend('force', {noremap = true, silent = true}, opts or {})
|
||||
vim.api.nvim_buf_set_keymap(bufnr, mode, lhs, rhs, opts)
|
||||
local function keymap_n(key, command, description, opts)
|
||||
opts = vim.tbl_extend('force', {noremap = true, silent = true, buffer=bufnr}, opts or {})
|
||||
return {key, command, description=description, opts=opts}
|
||||
end
|
||||
local function keymap_vn(key, command, description, opts)
|
||||
opts = vim.tbl_extend('force', {noremap = true, silent = true, buffer=bufnr}, opts or {})
|
||||
return {key, command, mode={"v", "n"}, description=description, opts=opts}
|
||||
end
|
||||
|
||||
-- Navigation
|
||||
map('n', ']c', "&diff ? ']c' : '<cmd>Gitsigns next_hunk<CR>'", {expr=true})
|
||||
map('n', '[c', "&diff ? '[c' : '<cmd>Gitsigns prev_hunk<CR>'", {expr=true})
|
||||
require("legendary").keymaps{
|
||||
{
|
||||
itemgroup = "githunks",
|
||||
description = "Git hunks",
|
||||
icon = "",
|
||||
keymaps = {
|
||||
keymap_n(']c', "&diff ? ']c' : '<cmd>Gitsigns next_hunk<CR>'", "Jump to next hunk", {expr=true}),
|
||||
keymap_n('[c', "&diff ? '[c' : '<cmd>Gitsigns prev_hunk<CR>'", "Jump to prev hunk", {expr=true}),
|
||||
|
||||
-- Actions
|
||||
map('n', '<leader>hs', ':Gitsigns stage_hunk<CR>')
|
||||
map('v', '<leader>hs', ':Gitsigns stage_hunk<CR>')
|
||||
map('n', '<leader>hr', ':Gitsigns reset_hunk<CR>')
|
||||
map('v', '<leader>hr', ':Gitsigns reset_hunk<CR>')
|
||||
map('n', '<leader>hS', '<cmd>Gitsigns stage_buffer<CR>')
|
||||
map('n', '<leader>hu', '<cmd>Gitsigns undo_stage_hunk<CR>')
|
||||
map('n', '<leader>hR', '<cmd>Gitsigns reset_buffer<CR>')
|
||||
map('n', '<leader>hp', '<cmd>Gitsigns preview_hunk<CR>')
|
||||
map('n', '<leader>hb', '<cmd>lua require"gitsigns".blame_line{full=true}<CR>')
|
||||
map('n', '<leader>tb', '<cmd>Gitsigns toggle_current_line_blame<CR>')
|
||||
map('n', '<leader>hd', '<cmd>Gitsigns diffthis<CR>')
|
||||
map('n', '<leader>hD', '<cmd>lua require"gitsigns".diffthis("~")<CR>')
|
||||
map('n', '<leader>td', '<cmd>Gitsigns toggle_deleted<CR>')
|
||||
keymap_vn("<leader>hs", ":Gitsigns stage_hunk<CR>", "Stage hunk"),
|
||||
keymap_vn("<leader>hr", ":Gitsigns reset_hunk<CR>", "Reset hunk"),
|
||||
keymap_n("<leader>hS", "<cmd>Gitsigns stage_buffer<CR>", "Stage buffer"),
|
||||
keymap_n("<leader>hu", "<cmd>Gitsigns undo_stage_hunk<CR>", "Undo stage hunk"),
|
||||
keymap_n("<leader>hR", "<cmd>Gitsigns reset_buffer<CR>", "Reset buffer"),
|
||||
keymap_n("<leader>hp", "<cmd>Gitsigns preview_hunk<CR>", "Preview hunk"),
|
||||
keymap_n('<leader>td', '<cmd>Gitsigns toggle_deleted<CR>', "Toggle deleted"),
|
||||
|
||||
-- Text object
|
||||
map('o', 'ih', ':<C-U>Gitsigns select_hunk<CR>')
|
||||
map('x', 'ih', ':<C-U>Gitsigns select_hunk<CR>')
|
||||
{'ih', {o=':<C-U>Gitsigns select_hunk<CR>', x=':<C-U>Gitsigns select_hunk<CR>'}, description="Select hunk" }
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
}
|
||||
end
|
||||
}
|
||||
|
@ -1,3 +1,12 @@
|
||||
local silent = {silent=true}
|
||||
vim.keymap.set("n", "s", "<Plug>(leap-forward-to)", silent)
|
||||
vim.keymap.set("n", "S", "<Plug>(leap-backward-to)", silent)
|
||||
return {
|
||||
'ggandor/leap.nvim',
|
||||
config = function()
|
||||
local silent = {silent=true}
|
||||
|
||||
require("legendary").keymaps{
|
||||
{"s", "<Plug>(leap-forward-to)", description="Leap forward", opts=silent},
|
||||
{"S", "<Plug>(leap-backward-to)", description="Leap backward", opts=silent}
|
||||
}
|
||||
|
||||
end
|
||||
}
|
||||
|
12
lua/config/legendary.lua
Normal file
12
lua/config/legendary.lua
Normal file
@ -0,0 +1,12 @@
|
||||
return {
|
||||
'mrjones2014/legendary.nvim',
|
||||
requires = 'stevearc/dressing.nvim',
|
||||
config = function()
|
||||
require("legendary").setup{
|
||||
include_legendary_cmds = false,
|
||||
keymaps = {
|
||||
{"<leader>l", ":Legendary<cr>", description = "Open this help menu"}
|
||||
}
|
||||
}
|
||||
end
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
local opt = require 'utils.opt'
|
||||
|
||||
opt('showmode', false)
|
||||
|
||||
vim.cmd [[
|
||||
function! LightlineFilename()
|
||||
let filename = expand('%:t') !=# '' ? expand('%:t') : '[No Name]'
|
||||
let modified = &modified ? ' +' : ''
|
||||
return filename . modified
|
||||
endfunction
|
||||
]]
|
||||
|
||||
vim.g.lightline = {
|
||||
colorscheme = vim.g.colors_name,
|
||||
active = {
|
||||
left = { { 'mode', 'paste' }, { 'gitbranch', 'readonly', 'filename' } }
|
||||
},
|
||||
component_function = {
|
||||
gitbranch = 'FugitiveHead',
|
||||
filename = 'LightlineFilename'
|
||||
},
|
||||
tabline = {
|
||||
right = {}
|
||||
}
|
||||
}
|
||||
|
@ -87,20 +87,31 @@ end
|
||||
---@diagnostic disable-next-line: unused-local
|
||||
function M.on_attach(client, bufnr)
|
||||
-- Mappings.
|
||||
local opts = { noremap = true, silent = true }
|
||||
local opts = { noremap = true, silent = true, buffer = bufnr}
|
||||
|
||||
local function buf_set_keymap(mode, lhs, rhs) vim.api.nvim_buf_set_keymap(bufnr, mode, lhs, rhs, opts) end
|
||||
-- local function keymap(mode, lhs, rhs) vim.api.nvim_buf_set_keymap(bufnr, mode, lhs, rhs, opts) end
|
||||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||
|
||||
require("legendary").keymaps{
|
||||
{
|
||||
itemgroup = "lsp",
|
||||
description = "LSP",
|
||||
keymaps = {
|
||||
{'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', description = "Jump to definition", opts=opts},
|
||||
{'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', description = "Jump to declaration", opts=opts},
|
||||
{'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', description = "Jump to implementation", opts=opts},
|
||||
{'K', '<cmd>lua vim.lsp.buf.hover()<CR>', description = "Show info", opts=opts},
|
||||
{'<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', description = "Rename symbol"},
|
||||
{'<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', description = "Show code actions"},
|
||||
{'<space>d', '<cmd>lua vim.diagnostic.open_float()<CR>', description = "Open float"}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>')
|
||||
buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>')
|
||||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>')
|
||||
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>')
|
||||
buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>')
|
||||
|
||||
-- Conflicts with movement between panes
|
||||
-- buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>')
|
||||
@ -109,9 +120,6 @@ function M.on_attach(client, bufnr)
|
||||
-- buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>')
|
||||
-- buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>')
|
||||
-- buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>')
|
||||
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>')
|
||||
buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>')
|
||||
buf_set_keymap('n', '<space>d', '<cmd>lua vim.diagnostic.open_float()<CR>')
|
||||
-- buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>')
|
||||
-- buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>')
|
||||
-- buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>')
|
||||
|
@ -1,7 +1,6 @@
|
||||
local lspconfig_config = require 'config.lspconfig'
|
||||
local lsp_installer = require 'nvim-lsp-installer'
|
||||
local lsp_installer_servers = require'nvim-lsp-installer.servers'
|
||||
local M = {}
|
||||
local lspconfig_config = require('config.lspconfig')
|
||||
local lsp_installer = require('nvim-lsp-installer')
|
||||
local lsp_installer_servers = require('nvim-lsp-installer.servers')
|
||||
|
||||
-- local autoinstall_servers = {"sumneko_lua", "efm"}
|
||||
local autoinstall_servers = {"sumneko_lua"}
|
||||
@ -38,5 +37,3 @@ for _, server in ipairs(lsp_installer.get_installed_servers()) do
|
||||
server:setup(opts)
|
||||
::continue::
|
||||
end
|
||||
|
||||
return M
|
||||
|
@ -1,4 +1,18 @@
|
||||
require "lsp_signature".setup{
|
||||
return {
|
||||
"ray-x/lsp_signature.nvim",
|
||||
config = function()
|
||||
local lsp_signature = require("lsp_signature")
|
||||
|
||||
lsp_signature.setup{
|
||||
hint_enable = false,
|
||||
toggle_key = '<C-x>'
|
||||
toggle_key = nil,
|
||||
handler_opts = {
|
||||
border = { " ", " ", " ", " ", " ", " ", " ", " " }
|
||||
}
|
||||
}
|
||||
|
||||
require("legendary").keymap{
|
||||
"<C-x>", lsp_signature.toggle_float_win, description="Toggle signature float"
|
||||
}
|
||||
end
|
||||
}
|
||||
|
@ -1,4 +1,7 @@
|
||||
if vim.fn.has('nvim-0.5.1') == 1 then
|
||||
return {
|
||||
'RishabhRD/nvim-lsputils',
|
||||
requires = 'RishabhRD/popfix',
|
||||
config = function()
|
||||
vim.lsp.handlers['textDocument/codeAction'] = require'lsputil.codeAction'.code_action_handler
|
||||
vim.lsp.handlers['textDocument/references'] = require'lsputil.locations'.references_handler
|
||||
vim.lsp.handlers['textDocument/definition'] = require'lsputil.locations'.definition_handler
|
||||
@ -7,37 +10,5 @@ if vim.fn.has('nvim-0.5.1') == 1 then
|
||||
vim.lsp.handlers['textDocument/implementation'] = require'lsputil.locations'.implementation_handler
|
||||
vim.lsp.handlers['textDocument/documentSymbol'] = require'lsputil.symbols'.document_handler
|
||||
vim.lsp.handlers['workspace/symbol'] = require'lsputil.symbols'.workspace_handler
|
||||
else
|
||||
local bufnr = vim.api.nvim_buf_get_number(0)
|
||||
vim.lsp.handlers['textDocument/codeAction'] = function(_, _, actions)
|
||||
require('lsputil.codeAction').code_action_handler(nil, actions, nil, nil, nil)
|
||||
end
|
||||
|
||||
vim.lsp.handlers['textDocument/references'] = function(_, _, result)
|
||||
require('lsputil.locations').references_handler(nil, result, { bufnr = bufnr }, nil)
|
||||
end
|
||||
|
||||
vim.lsp.handlers['textDocument/definition'] = function(_, method, result)
|
||||
require('lsputil.locations').definition_handler(nil, result, { bufnr = bufnr, method = method }, nil)
|
||||
end
|
||||
|
||||
vim.lsp.handlers['textDocument/declaration'] = function(_, method, result)
|
||||
require('lsputil.locations').declaration_handler(nil, result, { bufnr = bufnr, method = method }, nil)
|
||||
end
|
||||
|
||||
vim.lsp.handlers['textDocument/typeDefinition'] = function(_, method, result)
|
||||
require('lsputil.locations').typeDefinition_handler(nil, result, { bufnr = bufnr, method = method }, nil)
|
||||
end
|
||||
|
||||
vim.lsp.handlers['textDocument/implementation'] = function(_, method, result)
|
||||
require('lsputil.locations').implementation_handler(nil, result, { bufnr = bufnr, method = method }, nil)
|
||||
end
|
||||
|
||||
vim.lsp.handlers['textDocument/documentSymbol'] = function(_, _, result, _, bufn)
|
||||
require('lsputil.symbols').document_handler(nil, result, { bufnr = bufn }, nil)
|
||||
end
|
||||
|
||||
vim.lsp.handlers['textDocument/symbol'] = function(_, _, result, _, bufn)
|
||||
require('lsputil.symbols').workspace_handler(nil, result, { bufnr = bufn }, nil)
|
||||
end
|
||||
end
|
||||
}
|
||||
|
161
lua/config/lualine.lua
Normal file
161
lua/config/lualine.lua
Normal file
@ -0,0 +1,161 @@
|
||||
local bg = vim.g.srcery_xgray1
|
||||
|
||||
local colors = {
|
||||
red = vim.g.srcery_red,
|
||||
grey = vim.g.srcery_black,
|
||||
black = vim.g.srcery_hard_black,
|
||||
white = vim.g.srcery_bright_white,
|
||||
light_green = vim.g.srcery_bright_green,
|
||||
orange = vim.g.srcery_orange,
|
||||
green = vim.g.srcery_green,
|
||||
}
|
||||
|
||||
local theme = {
|
||||
normal = {
|
||||
a = { fg = colors.white, bg = colors.black },
|
||||
b = { fg = colors.white, bg = colors.grey },
|
||||
c = { fg = colors.black, bg = bg },
|
||||
z = { fg = colors.white, bg = colors.black },
|
||||
},
|
||||
insert = { a = { fg = colors.black, bg = colors.light_green } },
|
||||
visual = { a = { fg = colors.black, bg = colors.orange } },
|
||||
replace = { a = { fg = colors.black, bg = colors.green } },
|
||||
}
|
||||
|
||||
local empty = require('lualine.component'):extend()
|
||||
function empty:draw(default_highlight)
|
||||
self.status = ''
|
||||
self.applied_separator = ''
|
||||
self:apply_highlights(default_highlight)
|
||||
self:apply_section_separators()
|
||||
return self.status
|
||||
end
|
||||
|
||||
-- Put proper separators and gaps between components in sections
|
||||
local function process_sections(sections)
|
||||
for name, section in pairs(sections) do
|
||||
local left = name:sub(9, 10) < 'x'
|
||||
for pos = 1, name ~= 'lualine_z' and #section or #section - 1 do
|
||||
table.insert(section, pos * 2, { empty, color = { fg = bg, bg = bg } })
|
||||
end
|
||||
for id, comp in ipairs(section) do
|
||||
if type(comp) ~= 'table' then
|
||||
comp = { comp }
|
||||
section[id] = comp
|
||||
end
|
||||
comp.separator = left and { right = '' } or { left = '' }
|
||||
end
|
||||
end
|
||||
return sections
|
||||
end
|
||||
|
||||
local function search_result()
|
||||
local last_search = vim.fn.getreg('/')
|
||||
if not last_search or last_search == '' then
|
||||
return ''
|
||||
end
|
||||
local searchcount = vim.fn.searchcount { maxcount = 9999 }
|
||||
if searchcount.total == 0 then
|
||||
return ''
|
||||
end
|
||||
return last_search .. '(' .. searchcount.current .. '/' .. searchcount.total .. ')'
|
||||
end
|
||||
|
||||
local function modified()
|
||||
if vim.bo.modified then
|
||||
return '+'
|
||||
elseif vim.bo.modifiable == false or vim.bo.readonly == true then
|
||||
return '-'
|
||||
end
|
||||
return ''
|
||||
end
|
||||
|
||||
local function recording_macro()
|
||||
local reg = vim.api.nvim_call_function("reg_recording", {})
|
||||
if reg ~= "" then
|
||||
return "@" .. reg
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end
|
||||
|
||||
local extensions = {"man", "quickfix"}
|
||||
if pcall(require, "nvim-tree") then
|
||||
table.insert(extensions, "nvim-tree")
|
||||
end
|
||||
if pcall(require, "toggleterm") then
|
||||
table.insert(extensions, "toggleterm")
|
||||
end
|
||||
if pcall(require, "luapad.statusline") then
|
||||
table.insert(extensions, {
|
||||
sections = process_sections {
|
||||
lualine_a = {'mode'},
|
||||
lualine_b = {
|
||||
{
|
||||
'diagnostics',
|
||||
source = { 'nvim' },
|
||||
sections = { 'error' },
|
||||
diagnostics_color = { error = { bg = colors.red, fg = colors.white } },
|
||||
},
|
||||
{
|
||||
'diagnostics',
|
||||
source = { 'nvim' },
|
||||
sections = { 'warn' },
|
||||
diagnostics_color = { warn = { bg = colors.orange, fg = colors.white } },
|
||||
},
|
||||
{ recording_macro, color = { bg = colors.orange } }
|
||||
},
|
||||
lualine_y = { search_result, 'filetype' },
|
||||
lualine_z = { '%l:%c', '%p%%/%L' },
|
||||
},
|
||||
filetypes = {'lua.luapad'}
|
||||
})
|
||||
end
|
||||
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
theme = theme,
|
||||
component_separators = '',
|
||||
section_separators = { left = '', right = '' },
|
||||
-- ignore_focus = {"NvimTree"},
|
||||
globalstatus = true
|
||||
},
|
||||
sections = process_sections {
|
||||
lualine_a = { 'mode' },
|
||||
lualine_b = {
|
||||
'branch',
|
||||
'diff',
|
||||
{
|
||||
'diagnostics',
|
||||
source = { 'nvim' },
|
||||
sections = { 'error' },
|
||||
diagnostics_color = { error = { bg = colors.red, fg = colors.white } },
|
||||
},
|
||||
{
|
||||
'diagnostics',
|
||||
source = { 'nvim' },
|
||||
sections = { 'warn' },
|
||||
diagnostics_color = { warn = { bg = colors.orange, fg = colors.white } },
|
||||
},
|
||||
{ 'filename', file_status = false, path = 1 },
|
||||
{ modified, color = { bg = colors.red } },
|
||||
{ '%w', cond = function() return vim.wo.previewwindow end },
|
||||
{ '%r', cond = function() return vim.bo.readonly end },
|
||||
{ '%q', cond = function() return vim.bo.buftype == 'quickfix' end },
|
||||
{ recording_macro, color = { bg = colors.orange } }
|
||||
},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
lualine_y = { search_result, 'filetype' },
|
||||
lualine_z = { '%l:%c', '%p%%/%L' },
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
extensions = extensions
|
||||
}
|
15
lua/config/luapad.lua
Normal file
15
lua/config/luapad.lua
Normal file
@ -0,0 +1,15 @@
|
||||
local pattern = "^/tmp/.*/%d+_Luapad%.lua$"
|
||||
local group = vim.api.nvim_create_augroup("LuaPadFiletype", {clear=true})
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
group = group,
|
||||
callback = function(data)
|
||||
if data.file:match(pattern) then
|
||||
vim.bo[data.buf].filetype = "lua.luapad"
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
require("legendary").commands{
|
||||
{ ":Luapad", description = "Open interactive lua" },
|
||||
{ ":LuaRun", description = "Run lua from current buffer" }
|
||||
}
|
@ -1,51 +1,52 @@
|
||||
local ls = require("luasnip")
|
||||
local capture = require("utils.capture")
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local c = ls.choice_node
|
||||
local d = ls.dynamic_node
|
||||
local function config()
|
||||
local ls = require("luasnip")
|
||||
local capture = require("utils.capture")
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local c = ls.choice_node
|
||||
local d = ls.dynamic_node
|
||||
|
||||
local function getCurrentYear()
|
||||
local function getCurrentYear()
|
||||
return os.date("%Y")
|
||||
end
|
||||
end
|
||||
|
||||
local function getGitUsername()
|
||||
local function getGitUsername()
|
||||
local stdout = capture("git config user.name")
|
||||
if stdout == "" then
|
||||
return nil
|
||||
end
|
||||
return stdout
|
||||
end
|
||||
end
|
||||
|
||||
ls.config.set_config {
|
||||
ls.config.set_config {
|
||||
history = true,
|
||||
updateevents = "TextChanged,TextChangedI",
|
||||
enable_autosnippets = true
|
||||
}
|
||||
}
|
||||
|
||||
vim.keymap.set({"i", "s"}, "<c-k>", function()
|
||||
vim.keymap.set({"i", "s"}, "<c-k>", function()
|
||||
if ls.expand_or_jumpable() then
|
||||
ls.expand_or_jump()
|
||||
end
|
||||
end, { silent = true })
|
||||
end, { silent = true })
|
||||
|
||||
vim.keymap.set({ "i", "s" }, "<c-j>", function()
|
||||
vim.keymap.set({ "i", "s" }, "<c-j>", function()
|
||||
if ls.jumpable(-1) then
|
||||
ls.jump(-1)
|
||||
end
|
||||
end, { silent = -1 })
|
||||
end, { silent = -1 })
|
||||
|
||||
vim.keymap.set({"i"}, "<c-l>", function()
|
||||
vim.keymap.set({"i"}, "<c-l>", function()
|
||||
if ls.choice_active() then
|
||||
ls.change_choice(1)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
ls.add_snippets("all", {
|
||||
ls.add_snippets("all", {
|
||||
s("MIT", {
|
||||
t({"The MIT License (MIT)", "Copyright © "}),
|
||||
f(getCurrentYear, {}),
|
||||
@ -77,9 +78,9 @@ ls.add_snippets("all", {
|
||||
"SOFTWARE.",
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
ls.add_snippets("lua", {
|
||||
ls.add_snippets("lua", {
|
||||
s("req",
|
||||
fmt([[local {} = require("{}")]], {
|
||||
f(function(module_name)
|
||||
@ -89,4 +90,10 @@ ls.add_snippets("lua", {
|
||||
i(1)
|
||||
})
|
||||
)
|
||||
})
|
||||
})
|
||||
end
|
||||
|
||||
return {
|
||||
'L3MON4D3/LuaSnip',
|
||||
config = config
|
||||
}
|
||||
|
11
lua/config/move.lua
Normal file
11
lua/config/move.lua
Normal file
@ -0,0 +1,11 @@
|
||||
return {
|
||||
'fedepujol/move.nvim',
|
||||
config = function()
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
require("legendary").keymaps{
|
||||
{mode='v', '<S-j>', ':MoveBlock(1)<CR>', description = "Move block up", opts=opts},
|
||||
{mode='v', '<S-k>', ':MoveBlock(-1)<CR>', description = "Move block down", opts=opts},
|
||||
}
|
||||
end
|
||||
}
|
@ -1,13 +1,19 @@
|
||||
local map = require("utils.map")
|
||||
|
||||
require("nvim-tree").setup{
|
||||
return {
|
||||
'kyazdani42/nvim-tree.lua',
|
||||
requires = 'kyazdani42/nvim-web-devicons',
|
||||
config = function ()
|
||||
require("nvim-tree").setup{
|
||||
git = {
|
||||
enable = false
|
||||
},
|
||||
renderer = {
|
||||
group_empty = true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
map("n", "<leader>e", ":NvimTreeToggle<CR>", {silent = true})
|
||||
map("n", "<leader>f", ":NvimTreeFindFileToggle<CR>", {silent = true})
|
||||
require("legendary").keymaps{
|
||||
{"<leader>e", ":NvimTreeToggle<CR>", description = "Toggle file tree", {silent = true}},
|
||||
{"<leader>f", ":NvimTreeFindFileToggle<CR>", description = "Show file in tree", {silent = true}}
|
||||
}
|
||||
end
|
||||
}
|
||||
|
@ -1,8 +1,9 @@
|
||||
local g = vim.g
|
||||
local cmd = vim.cmd
|
||||
|
||||
-- Trigger a highlight in the appropriate direction when pressing these keys:
|
||||
g['qs_highlight_on_keys'] = {'f', 'F', 't', 'T'}
|
||||
|
||||
g['qs_max_chars'] = 150
|
||||
return {
|
||||
'unblevable/quick-scope',
|
||||
config = function ()
|
||||
-- Trigger a highlight in the appropriate direction when pressing these keys:
|
||||
vim.g['qs_highlight_on_keys'] = {'f', 'F', 't', 'T'}
|
||||
|
||||
vim.g['qs_max_chars'] = 150
|
||||
end
|
||||
}
|
||||
|
@ -1,39 +0,0 @@
|
||||
local refactoring = require("refactoring")
|
||||
refactoring.setup()
|
||||
|
||||
-- telescope refactoring helper
|
||||
local function refactor(prompt_bufnr)
|
||||
local content = require("telescope.actions.state").get_selected_entry(
|
||||
prompt_bufnr
|
||||
)
|
||||
require("telescope.actions").close(prompt_bufnr)
|
||||
require("refactoring").refactor(content.value)
|
||||
end
|
||||
|
||||
-- NOTE: M is a global object
|
||||
-- for the sake of simplicity in this example
|
||||
-- you can extract this function and the helper above
|
||||
-- and then require the file and call the extracted function
|
||||
-- in the mappings below
|
||||
M = {}
|
||||
M.refactors = function()
|
||||
local opts = require("telescope.themes").get_cursor() -- set personal telescope options
|
||||
require("telescope.pickers").new(opts, {
|
||||
prompt_title = "refactors",
|
||||
finder = require("telescope.finders").new_table({
|
||||
results = require("refactoring").get_refactors(),
|
||||
}),
|
||||
sorter = require("telescope.config").values.generic_sorter(opts),
|
||||
attach_mappings = function(_, map)
|
||||
map("i", "<CR>", refactor)
|
||||
map("n", "<CR>", refactor)
|
||||
return true
|
||||
end
|
||||
}):find()
|
||||
end
|
||||
|
||||
vim.api.nvim_set_keymap("v", "<Leader>re", [[ <Esc><Cmd>lua require('refactoring').refactor('Extract Function')<CR>]], {noremap = true, silent = true, expr = false})
|
||||
vim.api.nvim_set_keymap("v", "<Leader>rf", [[ <Esc><Cmd>lua require('refactoring').refactor('Extract Function To File')<CR>]], {noremap = true, silent = true, expr = false})
|
||||
vim.api.nvim_set_keymap("v", "<Leader>rt", [[ <Esc><Cmd>lua M.refactors()<CR>]], {noremap = true, silent = true, expr = false})
|
||||
|
||||
return M
|
@ -1,6 +0,0 @@
|
||||
local map = require 'utils.map'
|
||||
|
||||
map('n', '<leader>rc', ':Restart<cr>', {silent = true})
|
||||
|
||||
vim.cmd [[command! PackerRestart exe 'Restart' | exe 'PackerCompile' | exe 'PackerSync']]
|
||||
|
@ -1,23 +0,0 @@
|
||||
local map = require 'utils.map'
|
||||
local g = vim.g
|
||||
|
||||
g['sneak#label'] = 1
|
||||
|
||||
-- case insensitive sneak
|
||||
g['sneak#use_ic_scs'] = 1
|
||||
|
||||
-- immediately move to the next instance of search, if you move the cursor sneak is back to default behavior
|
||||
g['sneak#s_next'] = 1
|
||||
|
||||
-- remap so I can use , and ; with f and t
|
||||
map({'n', 'v'}, 'gS', '<plug>Sneak_;')
|
||||
map({'n', 'v'}, 'gs', '<plug>Sneak_;')
|
||||
-- map gS <Plug>Sneak_,
|
||||
-- map gs <Plug>Sneak_;
|
||||
|
||||
-- highlight Sneak guifg=black guibg=#00C7DF ctermfg=black ctermbg=cyan
|
||||
-- highlight SneakScope guifg=red guibg=yellow ctermfg=red ctermbg=yellow
|
||||
|
||||
-- Emoji prompt
|
||||
g['sneak#prompt'] = '🔎'
|
||||
|
@ -1,99 +1,115 @@
|
||||
local telescope = require('telescope')
|
||||
local map = require('utils.map')
|
||||
local actions = require('telescope.actions')
|
||||
local builtin = require('telescope.builtin')
|
||||
local previewers = require('telescope.previewers')
|
||||
local M = {}
|
||||
|
||||
local function sizelimit_maker(filepath, bufnr, opts)
|
||||
opts = opts or {}
|
||||
local size_limit = 100 * 1024 -- 100KiB
|
||||
|
||||
filepath = vim.fn.expand(filepath)
|
||||
vim.loop.fs_stat(filepath, function(_, stat)
|
||||
if not stat then return end
|
||||
if stat.size > size_limit then
|
||||
return
|
||||
else
|
||||
previewers.buffer_previewer_maker(filepath, bufnr, opts)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- Falling back to find_files if git_files can't find a .git directory
|
||||
function M.project_files(opts)
|
||||
local function project_files()
|
||||
local opts = { prompt_title = 'Project files' }
|
||||
local ok = pcall(builtin.git_files, opts)
|
||||
if not ok then builtin.find_files(opts) end
|
||||
end
|
||||
|
||||
function M.edit_config(_opts)
|
||||
local function edit_config()
|
||||
return M.project_files{
|
||||
cwd = "~/.config/nvim",
|
||||
prompt_title = "Neovim config"
|
||||
}
|
||||
end
|
||||
|
||||
local silent = {silent = true}
|
||||
|
||||
-- Search project files
|
||||
map('n', '<C-p>', [[:lua require('config.telescope').project_files{ prompt_title = 'Project files' }<cr>]], silent)
|
||||
|
||||
-- Search files from current working directory
|
||||
map('n', '<leader>p', [[:lua require('telescope.builtin').find_files()<cr>]], silent)
|
||||
|
||||
-- Edit neovim config
|
||||
map('n', '<leader>ce', [[:lua require('config.telescope').edit_config()<cr>]], silent)
|
||||
|
||||
-- Find string
|
||||
map('n', '<leader>fw', [[:lua require('telescope.builtin').live_grep()<cr>]], silent)
|
||||
|
||||
-- Change colorscheme
|
||||
map('n', '<leader>cs', [[:lua require('telescope.builtin').colorscheme()<cr>]], silent)
|
||||
|
||||
-- See help tags
|
||||
map('n', '<leader>fh', [[:lua require('telescope.builtin').help_tags()<cr>]], silent)
|
||||
|
||||
telescope.setup{
|
||||
defaults = {
|
||||
buffer_previewer_maker = sizelimit_maker,
|
||||
path_display = { "shorten" },
|
||||
vimgrep_arguments = {
|
||||
"rg",
|
||||
"-L",
|
||||
"--color=never",
|
||||
"--no-heading",
|
||||
"--with-filename",
|
||||
"--line-number",
|
||||
"--column",
|
||||
"--smart-case",
|
||||
},
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
entry_prefix = " ",
|
||||
initial_mode = "insert",
|
||||
selection_strategy = "reset",
|
||||
sorting_strategy = "ascending",
|
||||
layout_strategy = "horizontal",
|
||||
layout_config = {
|
||||
horizontal = {
|
||||
prompt_position = "top",
|
||||
preview_width = 0.55,
|
||||
results_width = 0.8,
|
||||
},
|
||||
vertical = { mirror = false },
|
||||
width = 0.87,
|
||||
height = 0.80,
|
||||
preview_cutoff = 120,
|
||||
},
|
||||
file_sorter = require("telescope.sorters").get_fuzzy_file,
|
||||
file_ignore_patterns = { "node_modules" },
|
||||
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
|
||||
path_display = { "truncate" },
|
||||
color_devicons = true,
|
||||
winblend = 0,
|
||||
border = {},
|
||||
borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
|
||||
set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
|
||||
file_previewer = require("telescope.previewers").vim_buffer_cat.new,
|
||||
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
|
||||
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
|
||||
-- Developer configurations: Not meant for general override
|
||||
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
|
||||
mappings = {
|
||||
i = {
|
||||
["<esc>"] = actions.close
|
||||
}
|
||||
}
|
||||
i = { ["<esc>"] = actions.close }
|
||||
},
|
||||
},
|
||||
pickers = {
|
||||
find_files = {
|
||||
theme = "dropdown",
|
||||
},
|
||||
marks = {
|
||||
theme = "dropdown",
|
||||
},
|
||||
help_tags = {
|
||||
theme = "dropdown",
|
||||
},
|
||||
oldfiles = {
|
||||
theme = "dropdown",
|
||||
},
|
||||
git_files = {
|
||||
theme = "dropdown",
|
||||
},
|
||||
live_grep = {
|
||||
theme = "dropdown",
|
||||
disable_coordinates = true
|
||||
},
|
||||
colorscheme = {
|
||||
theme = "dropdown",
|
||||
enable_preview = true
|
||||
}
|
||||
},
|
||||
extensions = {
|
||||
["ui-select"] = {
|
||||
require("telescope.themes").get_dropdown {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
telescope.load_extension("ui-select")
|
||||
|
||||
local fzfPlugin = packer_plugins["telescope-fzf-native.nvim"]
|
||||
if fzfPlugin and fzfPlugin.loaded then
|
||||
telescope.load_extension('fzf')
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
local keymaps = {
|
||||
-- Search project files
|
||||
{ "<C-p>", project_files, description = "Open git files" },
|
||||
|
||||
-- Search files from current working directory
|
||||
{ "<leader>p", function() builtin.find_files() end, description = "Open files" },
|
||||
|
||||
-- Edit neovim config
|
||||
{"<leader>ce", edit_config, description = "Edit neovim config" },
|
||||
|
||||
-- Grep string
|
||||
{ "<leader>fw", function() builtin.live_grep() end, description = "Grep" },
|
||||
|
||||
-- Change colorscheme
|
||||
{ "<leader>cs", function() builtin.colorscheme() end, description = "Change colorscheme" },
|
||||
|
||||
-- See help tags
|
||||
{ "<leader>fh", function() builtin.help_tags() end, description = "Search help tags" }
|
||||
}
|
||||
|
||||
local silent = {silent = true}
|
||||
for _, keymap in ipairs(keymaps) do
|
||||
keymap.opts = silent
|
||||
end
|
||||
|
||||
require("legendary").keymaps(keymaps)
|
||||
|
4
lua/config/tidy.lua
Normal file
4
lua/config/tidy.lua
Normal file
@ -0,0 +1,4 @@
|
||||
return {
|
||||
"mcauley-penney/tidy.nvim",
|
||||
config = function() require("tidy").setup() end
|
||||
}
|
11
lua/config/todo-comments.lua
Normal file
11
lua/config/todo-comments.lua
Normal file
@ -0,0 +1,11 @@
|
||||
return {
|
||||
"folke/todo-comments.nvim",
|
||||
requires = "nvim-lua/plenary.nvim",
|
||||
config = function()
|
||||
require("todo-comments").setup { signs = false }
|
||||
|
||||
require("legendary").command{
|
||||
":TodoTelescope", description = "Show TODO's in telescope"
|
||||
}
|
||||
end
|
||||
}
|
@ -1,3 +1,11 @@
|
||||
require('toggleterm').setup()
|
||||
return {
|
||||
'akinsho/toggleterm.nvim',
|
||||
tag = '*',
|
||||
config = function()
|
||||
require('toggleterm').setup()
|
||||
|
||||
vim.keymap.set("n", "<leader>t", ":ToggleTerm<CR>")
|
||||
require("legendary").keymap{
|
||||
"<leader>t", ":ToggleTerm<CR>", description = "Toggle terminal", opts = { silent = true }
|
||||
}
|
||||
end
|
||||
}
|
||||
|
@ -1,6 +1,12 @@
|
||||
local treesitter = require("nvim-treesitter.configs")
|
||||
return {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
run = function() require('nvim-treesitter.install').update{ with_sync = true } end,
|
||||
config = function ()
|
||||
local treesitter = require("nvim-treesitter.configs")
|
||||
|
||||
treesitter.setup{
|
||||
treesitter.setup{
|
||||
highlight = { enable = true },
|
||||
auto_install = true
|
||||
}
|
||||
end
|
||||
}
|
||||
|
@ -1,9 +1,15 @@
|
||||
local map = require 'utils.map'
|
||||
return {
|
||||
'folke/trouble.nvim',
|
||||
requires = 'kyazdani42/nvim-web-devicons',
|
||||
config = function ()
|
||||
require('trouble').setup()
|
||||
|
||||
require('trouble').setup()
|
||||
local silent = {silent = true}
|
||||
|
||||
local silent = {silent = true}
|
||||
|
||||
map('n', '<leader>qq', ':TroubleToggle document_diagnostics<cr>', silent)
|
||||
map('n', '<leader>qf', ':TroubleToggle workspace_diagnostics<cr>', silent)
|
||||
map('n', '<leader>rf', ':TroubleToggle lsp_references<cr>', silent)
|
||||
require("legendary").keymaps{
|
||||
{'<leader>qq', ':TroubleToggle document_diagnostics<cr>', description="Toggle file diagnostics", opts=silent},
|
||||
{'<leader>qf', ':TroubleToggle workspace_diagnostics<cr>', description="Toggle workspace diagnostics", opts=silent},
|
||||
{'gr', ':TroubleToggle lsp_references<cr>', description="Show references in trouble", opts=silent},
|
||||
}
|
||||
end
|
||||
}
|
||||
|
5
lua/config/ts-playground.lua
Normal file
5
lua/config/ts-playground.lua
Normal file
@ -0,0 +1,5 @@
|
||||
return {
|
||||
'nvim-treesitter/playground',
|
||||
requires = 'nvim-treesitter/nvim-treesitter',
|
||||
cmd = "TSPlaygroundToggle"
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
require("twilight").setup{
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
local g = vim.g
|
||||
g['vimspector_enable_mappings']="HUMAN"
|
@ -1,13 +0,0 @@
|
||||
local map = require 'utils.map'
|
||||
|
||||
require("zen-mode").setup{
|
||||
window = {
|
||||
options = {
|
||||
number = false,
|
||||
relativenumber = false,
|
||||
cursorline = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
map('n', '<leader>z', ':ZenMode<cr>')
|
11
lua/disable-builtin.lua
Normal file
11
lua/disable-builtin.lua
Normal file
@ -0,0 +1,11 @@
|
||||
local disabled_built_ins = {
|
||||
'matchit',
|
||||
'netrw',
|
||||
'netrwPlugin',
|
||||
'netrwSettings',
|
||||
'netrwFileHandlers',
|
||||
}
|
||||
|
||||
for _, name in ipairs(disabled_built_ins) do
|
||||
vim.g['loaded_' .. name] = 1
|
||||
end
|
@ -117,3 +117,12 @@ if vim.g.neovide then
|
||||
vim.g.neovide_scale_factor = 0.75
|
||||
vim.g.neovide_hide_mouse_when_typing = true
|
||||
end
|
||||
|
||||
-- Change c file comment string
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
group = vim.api.nvim_create_augroup("set-c-commentstring", { clear = true }),
|
||||
pattern = {"c", "cc", "cpp", "h", "hpp"},
|
||||
callback = function(data)
|
||||
vim.api.nvim_buf_set_option(data.buf, "commentstring", "// %s")
|
||||
end
|
||||
})
|
||||
|
@ -1,5 +1,8 @@
|
||||
local ts = vim.treesitter
|
||||
local query = ts.parse_query("c", "(preproc_function_def value: (preproc_arg) @macro_def)")
|
||||
local query = ts.parse_query("c", [[
|
||||
(preproc_function_def value: (preproc_arg) @macro_def)
|
||||
(preproc_def value: (preproc_arg) @macro_def)
|
||||
]])
|
||||
|
||||
local function get_ast_root(bufnr)
|
||||
local tree = ts.get_parser(bufnr, "c"):parse()
|
@ -1,6 +1,5 @@
|
||||
local map = require 'utils.map'
|
||||
|
||||
map("n", "<leader><leader>x", ":w<cr>:source %<cr>")
|
||||
vim.keymap.set("n", "<leader><leader>x", ":w<cr>:source %<cr>", { silent = true })
|
||||
|
||||
function P(...)
|
||||
print(vim.inspect(...))
|
||||
|
88
lua/plugin-manager.lua
Normal file
88
lua/plugin-manager.lua
Normal file
@ -0,0 +1,88 @@
|
||||
-- Register custom commands for plugin manager
|
||||
vim.cmd [[command! -bang -nargs=+ -complete=customlist,v:lua.require'plugin-manager'.loader_complete PackerLoad lua require('plugin-manager').loader(<f-args>, '<bang>' == '!')]]
|
||||
vim.cmd [[command! PackerInstall packadd packer.nvim | lua require('plugin-manager').install()]]
|
||||
vim.cmd [[command! PackerUpdate packadd packer.nvim | lua require('plugin-manager').update()]]
|
||||
vim.cmd [[command! PackerSync packadd packer.nvim | lua require('plugin-manager').sync()]]
|
||||
vim.cmd [[command! PackerClean packadd packer.nvim | lua require('plugin-manager').clean()]]
|
||||
vim.cmd [[command! PackerCompile source lua/plugin-manager.lua | packadd packer.nvim | lua require('plugin-manager').compile()]]
|
||||
|
||||
-- Bootstrap packer.nvim. If packer.nvim is not installed, install it.
|
||||
local function bootstrap()
|
||||
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
|
||||
return fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
|
||||
end
|
||||
end
|
||||
|
||||
local function create_custom_use(use)
|
||||
return function (opts)
|
||||
if type(opts) == "string" then
|
||||
use(opts)
|
||||
return opts
|
||||
elseif type(opts) == "table" then
|
||||
if opts.load_config then
|
||||
local name = vim.split(opts[1], "/")[2]
|
||||
if name:match("%.nvim$") then
|
||||
name = name:sub(1, -6)
|
||||
end
|
||||
opts.config_name = name
|
||||
end
|
||||
if opts.config_name then
|
||||
opts.config = ("require('config.%s')"):format(opts.config_name)
|
||||
end
|
||||
use(opts)
|
||||
|
||||
return opts[1]
|
||||
else
|
||||
error("What are you doing???")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local packer = nil
|
||||
local function init()
|
||||
-- Perform bootstrap
|
||||
local packer_bootstrap = bootstrap()
|
||||
|
||||
-- Initialize packer
|
||||
if packer == nil then
|
||||
packer = require 'packer'
|
||||
local util = require 'packer.util'
|
||||
packer.init {
|
||||
compile_path = util.join_paths(vim.fn.stdpath('config'), 'plugin', 'packer-compiled.lua'),
|
||||
disable_commands = true
|
||||
}
|
||||
end
|
||||
|
||||
-- Reset plugins if already loaded
|
||||
packer.reset()
|
||||
|
||||
-- Packer can manage itself
|
||||
packer.use 'wbthomason/packer.nvim'
|
||||
|
||||
-- Use plugins
|
||||
local use = create_custom_use(packer.use)
|
||||
for _, module_name in ipairs{"plugins", "plugins-local"} do
|
||||
local ok, use_plugins = pcall(require, module_name)
|
||||
if ok then
|
||||
assert(type(use_plugins) == "function")
|
||||
use_plugins(use)
|
||||
end
|
||||
end
|
||||
|
||||
-- Automatically set up your configuration after cloning packer.nvim
|
||||
-- Put this at the end after all plugins
|
||||
if packer_bootstrap then
|
||||
require('packer').sync()
|
||||
end
|
||||
end
|
||||
|
||||
local plugins = setmetatable({}, {
|
||||
__index = function(_, key)
|
||||
init()
|
||||
return packer[key]
|
||||
end
|
||||
})
|
||||
|
||||
return plugins
|
2
lua/plugins-local.lua
Normal file
2
lua/plugins-local.lua
Normal file
@ -0,0 +1,2 @@
|
||||
return function(use)
|
||||
end
|
316
lua/plugins.lua
316
lua/plugins.lua
@ -1,16 +1,87 @@
|
||||
-- TODO: Add minimal plugin mode. Disables all plugins which are not super
|
||||
-- important, to get better performance.
|
||||
|
||||
---@diagnostic disable-next-line: unused-local
|
||||
local function usePlugins(use, use_rocks)
|
||||
-- Toggle terminal
|
||||
use {'akinsho/toggleterm.nvim', tag = '*', config=[[require('config.toggleterm')]]}
|
||||
return function(use)
|
||||
local function use_config(name)
|
||||
use(require(("config.%s"):format(name)))
|
||||
end
|
||||
|
||||
-- Colorize ANSI codes
|
||||
use { 'm00qek/baleia.nvim', tag = 'v1.2.0', config=[[require('config.baleia')]] }
|
||||
use_config "toggleterm"
|
||||
use_config "baleia"
|
||||
use_config "todo-comments"
|
||||
use_config "dressing"
|
||||
use_config "legendary"
|
||||
use_config "move"
|
||||
use_config "gitblame"
|
||||
use_config "based"
|
||||
use_config "lspsignature"
|
||||
use_config "lsputils"
|
||||
use_config "luasnip"
|
||||
use_config "trouble"
|
||||
use_config "fugitive"
|
||||
use_config "gitsigns"
|
||||
use_config "nvim-tree"
|
||||
use_config "autosource"
|
||||
use_config "tidy"
|
||||
use_config "quickscope"
|
||||
use_config "leap"
|
||||
use_config "comment"
|
||||
use_config "colorizer"
|
||||
use_config "devicons"
|
||||
use_config "treesitter"
|
||||
use_config "ts-playground"
|
||||
use_config "diffview"
|
||||
|
||||
use {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
requires = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"kyazdani42/nvim-web-devicons",
|
||||
"nvim-telescope/telescope-ui-select.nvim",
|
||||
{"nvim-telescope/telescope-fzf-native.nvim", run = "make"}
|
||||
},
|
||||
load_config = true
|
||||
}
|
||||
|
||||
use {
|
||||
"neovim/nvim-lspconfig",
|
||||
config_name = "lspconfig"
|
||||
}
|
||||
|
||||
use {
|
||||
'williamboman/nvim-lsp-installer',
|
||||
requires = 'neovim/nvim-lspconfig',
|
||||
config_name = "lspinstaller"
|
||||
}
|
||||
|
||||
use {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
requires = "kyazdani42/nvim-web-devicons",
|
||||
load_config = true
|
||||
}
|
||||
|
||||
use {
|
||||
'rafcamlet/nvim-luapad',
|
||||
config_name = "luapad"
|
||||
}
|
||||
|
||||
use "tpope/vim-eunuch"
|
||||
use "christoomey/vim-tmux-navigator"
|
||||
use "eandrju/cellular-automaton.nvim"
|
||||
use "tweekmonster/startuptime.vim"
|
||||
use "tpope/vim-unimpaired"
|
||||
use "wellle/targets.vim"
|
||||
use "michaeljsmith/vim-indent-object"
|
||||
use "psliwka/vim-smoothie"
|
||||
use "godlygeek/tabular"
|
||||
use "editorconfig/editorconfig-vim"
|
||||
use "tpope/vim-surround"
|
||||
use "tpope/vim-repeat"
|
||||
use "tikhomirov/vim-glsl"
|
||||
|
||||
-- Debugger
|
||||
use { 'mfussenegger/nvim-dap', config=[[require('config.dap')]]}
|
||||
use { "mfussenegger/nvim-dap", config_name="dap" }
|
||||
use { "rcarriga/nvim-dap-ui", requires = "mfussenegger/nvim-dap", config=[[require('dapui').setup()]] }
|
||||
use 'simrat39/rust-tools.nvim'
|
||||
use {
|
||||
@ -19,40 +90,6 @@ local function usePlugins(use, use_rocks)
|
||||
config=[[require('nvim-dap-virtual-text')]]
|
||||
}
|
||||
|
||||
-- Git blame
|
||||
use { 'f-person/git-blame.nvim', config=[[require("config.gitblame")]] }
|
||||
|
||||
-- Seemless pane switching betwen tmux and vim
|
||||
use 'christoomey/vim-tmux-navigator'
|
||||
|
||||
-- UNIX commands
|
||||
use 'tpope/vim-eunuch'
|
||||
|
||||
-- Movement utilities
|
||||
use 'tpope/vim-unimpaired'
|
||||
|
||||
-- LSP
|
||||
use {
|
||||
'neovim/nvim-lspconfig',
|
||||
config = [[require 'config.lspconfig']],
|
||||
}
|
||||
use {
|
||||
'williamboman/nvim-lsp-installer',
|
||||
requires = 'neovim/nvim-lspconfig',
|
||||
config = [[require 'config.lspinstaller']]
|
||||
}
|
||||
|
||||
-- LSP utils
|
||||
use {"ray-x/lsp_signature.nvim", config = [[require 'config.lspsignature']]}
|
||||
use {
|
||||
'RishabhRD/nvim-lsputils',
|
||||
config = [[require 'config.lsputils']],
|
||||
requires = 'RishabhRD/popfix'
|
||||
}
|
||||
|
||||
-- Snippets
|
||||
use { 'L3MON4D3/LuaSnip', config = [[require 'config.luasnip']] }
|
||||
|
||||
-- Completion
|
||||
use { 'onsails/lspkind-nvim' }
|
||||
use {
|
||||
@ -60,9 +97,9 @@ local function usePlugins(use, use_rocks)
|
||||
-- requires = 'onsails/lspkind-nvim', -- For some reason breaks with this line
|
||||
requires = {'saadparwaiz1/cmp_luasnip'},
|
||||
after = 'lspkind-nvim',
|
||||
config = [[require 'config.cmp']]
|
||||
config_name = "cmp"
|
||||
}
|
||||
use {'tzachar/cmp-tabnine', after = 'nvim-cmp', run='./install.sh', requires = 'hrsh7th/nvim-cmp', config = [[require 'config.tabnine']]}
|
||||
use {'tzachar/cmp-tabnine', after = 'nvim-cmp', run='./install.sh', requires = 'hrsh7th/nvim-cmp', config_name = "tabnine"}
|
||||
use {'hrsh7th/cmp-nvim-lsp', requires = {'hrsh7th/nvim-cmp', 'nvim-lspconfig'}}
|
||||
use {'hrsh7th/cmp-nvim-lua', after = 'nvim-cmp', requires = 'hrsh7th/nvim-cmp'}
|
||||
use {'hrsh7th/cmp-buffer', after = 'nvim-cmp', requires = 'hrsh7th/nvim-cmp'}
|
||||
@ -70,14 +107,7 @@ local function usePlugins(use, use_rocks)
|
||||
use {'hrsh7th/cmp-cmdline', after = 'nvim-cmp', requires = 'hrsh7th/nvim-cmp'}
|
||||
use {'saadparwaiz1/cmp_luasnip', after = 'nvim-cmp', requires = {'L3MON4D3/LuaSnip', 'nvim-cmp'}}
|
||||
|
||||
-- Better diagnostics viewer
|
||||
use {
|
||||
'folke/trouble.nvim',
|
||||
requires = 'kyazdani42/nvim-web-devicons',
|
||||
config = [[require 'config.trouble']]
|
||||
}
|
||||
|
||||
-- Color themes
|
||||
do -- Color themes
|
||||
use 'srcery-colors/srcery-vim'
|
||||
-- use 'morhetz/gruvbox'
|
||||
-- use 'tomasr/molokai'
|
||||
@ -88,191 +118,9 @@ local function usePlugins(use, use_rocks)
|
||||
-- use 'mswift42/vim-themes'
|
||||
-- use 'squarefrog/tomorrow-night.vim'
|
||||
-- use 'fnune/base16-vim'
|
||||
|
||||
-- Text object target
|
||||
use 'wellle/targets.vim'
|
||||
|
||||
-- Git integration
|
||||
use { 'tpope/vim-fugitive', config = [[require 'config.fugitive']] }
|
||||
use {
|
||||
'lewis6991/gitsigns.nvim',
|
||||
requires = 'nvim-lua/plenary.nvim',
|
||||
config = [[require 'config.gitsigns']]
|
||||
-- tag = 'release' -- To use the latest release
|
||||
}
|
||||
|
||||
-- Refactoring
|
||||
-- use {
|
||||
-- "ThePrimeagen/refactoring.nvim",
|
||||
-- requires = {
|
||||
-- "nvim-lua/plenary.nvim",
|
||||
-- "nvim-treesitter/nvim-treesitter"
|
||||
-- },
|
||||
-- disable = true,
|
||||
-- config = [[require 'config.refactoring']]
|
||||
-- }
|
||||
|
||||
-- Analyze startup time
|
||||
use 'tweekmonster/startuptime.vim'
|
||||
|
||||
-- Status line and tab line
|
||||
use { 'itchyny/lightline.vim', config = [[require 'config.lightline']]}
|
||||
|
||||
-- Load project specific settings from exrc
|
||||
use { 'jenterkin/vim-autosource', config = [[require 'config.autosource']] }
|
||||
|
||||
-- Remove spaces at end of lines
|
||||
use{ "mcauley-penney/tidy.nvim", config = [[require("tidy").setup()]] }
|
||||
end
|
||||
|
||||
-- Training plugins
|
||||
-- use 'tjdevries/train.nvim'
|
||||
-- use 'ThePrimeagen/vim-be-good'
|
||||
|
||||
-- Quick movement
|
||||
-- use { 'justinmk/vim-sneak', config = [[require 'config.sneak']] }
|
||||
use { 'unblevable/quick-scope', config = [[require 'config.quickscope']] }
|
||||
use 'michaeljsmith/vim-indent-object'
|
||||
use { 'ggandor/leap.nvim', config=[[require 'config.leap']]}
|
||||
|
||||
-- Smooth smooth scrolling
|
||||
-- use { 'karb94/neoscroll.nvim', config = [[require('neoscroll').setup()]] }
|
||||
use 'psliwka/vim-smoothie'
|
||||
|
||||
-- Commenting
|
||||
use {
|
||||
'terrortylor/nvim-comment',
|
||||
config = [[require 'config.comment']],
|
||||
requires = 'JoosepAlviste/nvim-ts-context-commentstring'
|
||||
}
|
||||
|
||||
-- Color code colorizer
|
||||
use { 'norcalli/nvim-colorizer.lua', config = [[require 'config.colorizer']] }
|
||||
|
||||
-- Fuzzy file finder
|
||||
use {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
config = [[require 'config.telescope']],
|
||||
requires = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
'kyazdani42/nvim-web-devicons',
|
||||
{'nvim-telescope/telescope-fzf-native.nvim', run = 'make'}
|
||||
}
|
||||
}
|
||||
|
||||
-- Align characters vertically
|
||||
use 'godlygeek/tabular'
|
||||
|
||||
-- Used for loading project specific code styles
|
||||
use 'editorconfig/editorconfig-vim'
|
||||
|
||||
-- Provides mappings for working with symbols like (), {}, [], etc.
|
||||
use 'tpope/vim-surround'
|
||||
|
||||
-- Allow repeating
|
||||
use 'tpope/vim-repeat'
|
||||
|
||||
-- GLSL language support
|
||||
use 'tikhomirov/vim-glsl'
|
||||
|
||||
-- Treesitter
|
||||
use {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
config = [[require 'config.treesitter']],
|
||||
run = function() require('nvim-treesitter.install').update{ with_sync = true } end
|
||||
}
|
||||
use {
|
||||
'nvim-treesitter/playground',
|
||||
requires = 'nvim-treesitter/nvim-treesitter',
|
||||
cmd = "TSPlaygroundToggle"
|
||||
}
|
||||
|
||||
-- Dev icons
|
||||
use {'kyazdani42/nvim-web-devicons', config = [[require('nvim-web-devicons').setup()]]}
|
||||
|
||||
-- Zen mode
|
||||
use { 'folke/zen-mode.nvim', config = [[require 'config.zen-mode']] }
|
||||
use {
|
||||
'folke/twilight.nvim',
|
||||
requires = 'folke/zen-mode.nvim',
|
||||
config = [[require 'config.twilight']]
|
||||
}
|
||||
|
||||
-- File browser
|
||||
use {
|
||||
'kyazdani42/nvim-tree.lua',
|
||||
requires = 'kyazdani42/nvim-web-devicons',
|
||||
config = [[require 'config.nvim-tree']]
|
||||
}
|
||||
-- use {
|
||||
-- 'lambdalisue/fern.vim',
|
||||
-- config = [[require 'config.fern']],
|
||||
-- requires = {
|
||||
-- 'antoinemadec/FixCursorHold.nvim',
|
||||
-- 'lambdalisue/fern-hijack.vim',
|
||||
-- {'lambdalisue/fern-renderer-nerdfont.vim', config = [[vim.g["fern#renderer"] = "nerdfont"]]},
|
||||
-- 'lambdalisue/nerdfont.vim'
|
||||
-- }
|
||||
-- }
|
||||
-- alternatives:
|
||||
-- use 'kyazdani42/nvim-tree.lua'
|
||||
-- use 'zgpio/tree.nvim'
|
||||
-- use 'tpope/vim-vinegar'
|
||||
end
|
||||
|
||||
-- Register custom commands for plugin manager
|
||||
vim.cmd [[command! -bang -nargs=+ -complete=customlist,v:lua.require'plugins'.loader_complete PackerLoad lua require('plugins').loader(<f-args>, '<bang>' == '!')]]
|
||||
vim.cmd [[command! PackerInstall packadd packer.nvim | lua require('plugins').install()]]
|
||||
vim.cmd [[command! PackerUpdate packadd packer.nvim | lua require('plugins').update()]]
|
||||
vim.cmd [[command! PackerSync packadd packer.nvim | lua require('plugins').sync()]]
|
||||
vim.cmd [[command! PackerClean packadd packer.nvim | lua require('plugins').clean()]]
|
||||
vim.cmd [[command! PackerCompile source lua/plugins.lua | packadd packer.nvim | lua require('plugins').compile()]]
|
||||
|
||||
-- Bootstrap packer.nvim. If packer.nvim is not installed, install it.
|
||||
local function bootstrap()
|
||||
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
|
||||
return fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
|
||||
end
|
||||
end
|
||||
|
||||
local packer = nil
|
||||
local function init()
|
||||
-- Perform bootstrap
|
||||
local packer_bootstrap = bootstrap()
|
||||
|
||||
-- Initialize packer
|
||||
if packer == nil then
|
||||
packer = require 'packer'
|
||||
local util = require 'packer.util'
|
||||
packer.init {
|
||||
compile_path = util.join_paths(vim.fn.stdpath('config'), 'plugin', 'packer-compiled.lua'),
|
||||
disable_commands = true
|
||||
}
|
||||
end
|
||||
|
||||
-- Reset plugins if already loaded
|
||||
packer.reset()
|
||||
|
||||
-- Packer can manage itself
|
||||
packer.use 'wbthomason/packer.nvim'
|
||||
|
||||
-- Use plugins
|
||||
usePlugins(packer.use, packer.use_rocks)
|
||||
|
||||
-- Automatically set up your configuration after cloning packer.nvim
|
||||
-- Put this at the end after all plugins
|
||||
if packer_bootstrap then
|
||||
require('packer').sync()
|
||||
end
|
||||
end
|
||||
|
||||
local plugins = setmetatable({}, {
|
||||
__index = function(_, key)
|
||||
init()
|
||||
return packer[key]
|
||||
end,
|
||||
})
|
||||
|
||||
return plugins
|
||||
|
Loading…
Reference in New Issue
Block a user