Merge branch 'master' of git.blakenorth.net/home/git/dotfiles

This commit is contained in:
PowerUser64 2022-08-21 20:57:40 -07:00
commit 0b203775dd
5 changed files with 53 additions and 38 deletions

View file

@ -30,9 +30,3 @@ require('blake.settings')
-- Downsides: -- Downsides:
-- - Hardest (requires me to make a for loop, and I don't know lua) -- - Hardest (requires me to make a for loop, and I don't know lua)
-- - Doesn't take advantage of advanced plugin manager features (ex: dependencies) -- - Doesn't take advantage of advanced plugin manager features (ex: dependencies)
-- Plugins to install:
-- lightspeed.nvim
-- lightbulb?
-- telescope
-- - trouble.nvim

View file

@ -150,34 +150,32 @@ M.cmp = function()
{ name = 'path' }, { name = 'path' },
}, },
formatting = { formatting = {
fields = { "abbr", "kind", "menu" },
format = function(entry, vim_item) format = function(entry, vim_item)
-- fancy icons and a name of kind -- fancy icons and a name of kind
require('lspkind').cmp_format({ local kind = require("lspkind").cmp_format({ mode = "symbol", maxwidth = 50 })(entry, vim_item)
mode = 'symbol', -- show only symbol annotations -- local strings = vim.split(kind.kind, "%s", { trimempty = true })
maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
-- The function below will be called before any actual modifications from lspkind
-- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30))
-- before = function (entry, vim_item)
-- ...
-- return vim_item
-- end
})
-- set a name for each source -- set a name for each source
vim_item.kind = " " .. kind.kind
vim_item.menu = ({ vim_item.menu = ({
path = "[Path]", path = "[path]",
nvim_lua = "[Lua]", emoji = "[emoji]",
nvim_lsp = "[LSP]", nvim_lua = "[lua]",
treesitter = "[TS]", nvim_lsp = "[lsp]",
calc = "[Calc]", treesitter = "[ts]",
spell = "[Spell]", calc = "[calc]",
cmdline = "[cmdline]", spell = "[spell]",
buffer = "[Buffer]", cmdline = "[cmd]",
})[entry.source.name] buffer = "[buf]",
luasnip = "[snip]",
})[entry.source.name] or "unknown type"
return vim_item return vim_item
end, end,
}, },
window = { window = {
completion = {
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None",
},
documentation = { documentation = {
border = { "", "", "", "", "", "", "", "" }, border = { "", "", "", "", "", "", "", "" },
}, },
@ -186,7 +184,6 @@ M.cmp = function()
ghost_text = true, ghost_text = true,
} }
} }
-- Thanks to iwataka on github for this bit -- Thanks to iwataka on github for this bit
local search_config = { local search_config = {
mapping = cmp.mapping.preset.cmdline(), mapping = cmp.mapping.preset.cmdline(),
@ -194,11 +191,9 @@ M.cmp = function()
{ name = 'buffer' }, { name = 'buffer' },
} }
} }
-- Use buffer source for `/` and `?` -- Use buffer source for `/` and `?`
cmp.setup.cmdline('/', search_config) cmp.setup.cmdline('/', search_config)
cmp.setup.cmdline('?', search_config) cmp.setup.cmdline('?', search_config)
-- `:` cmdline setup. -- `:` cmdline setup.
cmp.setup.cmdline(':', { cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(), mapping = cmp.mapping.preset.cmdline(),
@ -246,7 +241,7 @@ M.lspconfig = function()
buffmap(bufnr, 'n', '<leader>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts) buffmap(bufnr, 'n', '<leader>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
buffmap(bufnr, 'n', '<leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts) buffmap(bufnr, 'n', '<leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
buffmap(bufnr, 'n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts) buffmap(bufnr, 'n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
buffmap(bufnr, 'n', '<leader>a', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts) buffmap(bufnr, 'n', '<leader>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
buffmap(bufnr, 'n', 'gr', '<cmd>lua require("telescope.builtin").lsp_references()<CR>', opts) -- Telescope buffmap(bufnr, 'n', 'gr', '<cmd>lua require("telescope.builtin").lsp_references()<CR>', opts) -- Telescope
buffmap(bufnr, 'n', '<leader>f', '<cmd>lua vim.lsp.buf.format { async = true }<CR>', opts) buffmap(bufnr, 'n', '<leader>f', '<cmd>lua vim.lsp.buf.format { async = true }<CR>', opts)
buffmap(bufnr, 'n', '<leader>so', '<cmd>lua require("telescope.builtin").lsp_document_symbols()<CR>', opts) buffmap(bufnr, 'n', '<leader>so', '<cmd>lua require("telescope.builtin").lsp_document_symbols()<CR>', opts)

View file

@ -22,7 +22,6 @@ return require('packer').startup({function()
} }
-- Packer -- Packer
-- use 'wbthomason/packer.nvim',
use { -- packer: plugin manager use { -- packer: plugin manager
'wbthomason/packer.nvim', 'wbthomason/packer.nvim',
config = function() config = function()
@ -90,6 +89,9 @@ return require('packer').startup({function()
use { -- ifdef-highlighting: highlight c/c++ ifdef's - :Define :Undefine use { -- ifdef-highlighting: highlight c/c++ ifdef's - :Define :Undefine
'vim-scripts/ifdef-highlighting' 'vim-scripts/ifdef-highlighting'
} }
use { -- lumen: make vim respect the system light/dark theme setting (linux + macos)
'vimpostor/vim-lumen',
}
-- IDE features -- IDE features
---- LSP ---- LSP
@ -219,6 +221,7 @@ return require('packer').startup({function()
) )
end, end,
} }
---- DAP (Debug Adapter Protocol) ---- DAP (Debug Adapter Protocol)
use { -- nvim-dap: DAP support use { -- nvim-dap: DAP support
'mfussenegger/nvim-dap', 'mfussenegger/nvim-dap',
@ -318,9 +321,6 @@ return require('packer').startup({function()
use { -- matchup: Use the percent (%) key for more things use { -- matchup: Use the percent (%) key for more things
'andymass/vim-matchup', 'andymass/vim-matchup',
} }
-- use { -- lightspeed: Jump around in files quickly
-- 'ggandor/lightspeed.nvim',
-- }
use { -- indentline: Line indent indicators use { -- indentline: Line indent indicators
'lukas-reineke/indent-blankline.nvim', 'lukas-reineke/indent-blankline.nvim',
config = function() config = function()
@ -340,6 +340,23 @@ return require('packer').startup({function()
}) })
end end
} }
use { -- neogen: annotation generator for neovim
'danymat/neogen',
requires = "nvim-treesitter/nvim-treesitter",
config = function()
require('neogen').setup({
snippet_engine = "luasnip",
})
local opts = { noremap = true, silent = true }
vim.api.nvim_set_keymap("n", "<Leader>af", ":lua require('neogen').generate('func')<CR>", opts)
end
}
use { -- hop.nvim: Jump around files quickly
'phaazon/hop.nvim',
config = function()
require('hop').setup { keys = 'etovxqpdygfblzhckisuran' }
end
}
-- Conveniences -- Conveniences
use { -- sort motion: (gs) use { -- sort motion: (gs)
@ -455,6 +472,16 @@ return require('packer').startup({function()
require('marks').setup() require('marks').setup()
end end
} }
use { -- oscyank: copy text to system clipboard over ssh
'ojroques/vim-oscyank',
config = function()
-- Yanking to "+ will yank to system board
vim.cmd [[ autocmd TextYankPost * if v:event.operator is 'y' && v:event.regname is '+' | execute 'OSCYankReg +' | endif ]]
end
}
use { -- fixcursorhold: fix neovim bug #12587 - https://github.com/neovim/neovim/issues/12587
'antoinemadec/FixCursorHold.nvim',
}
use { -- rhysd: clever-split: split calculation based on pane dimensions - CS or CleverSplit use { -- rhysd: clever-split: split calculation based on pane dimensions - CS or CleverSplit
'rhysd/clever-split.vim', 'rhysd/clever-split.vim',
config = function() config = function()
@ -522,7 +549,6 @@ return require('packer').startup({function()
'tpope/vim-sleuth', 'tpope/vim-sleuth',
} }
-- Bootstrap packer if needed { -- Bootstrap packer if needed {
if (packer_bootstrap) then if (packer_bootstrap) then
print('Please wait for packer to install plugins') print('Please wait for packer to install plugins')

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# Purpose: edit nvim configuration while being cd'd into the directory that # Purpose: edit nvim configuration while being cd'd into the directory that
# most of the files live so they can easily be :e'd # most of the files live so they can easily be :e'd
# Usage: nvc # Usage: nvc [$EDITOR options]
cd ~/.config/nvim/lua/blake \ cd ~/.config/nvim/lua/blake \
&& nvim ../../init.lua && $EDITOR "$@" ../../init.lua

2
.zshrc
View file

@ -15,7 +15,7 @@ ${SKIP_PLUGINS:-false} || {
print -P "%F{33}▓▒░ %F{220}Installing %F{33}DHARMA%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f" print -P "%F{33}▓▒░ %F{220}Installing %F{33}DHARMA%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f"
command mkdir -p "$ZINIT_HOME_DIR" && command chmod g-rwX "$ZINIT_HOME_DIR" command mkdir -p "$ZINIT_HOME_DIR" && command chmod g-rwX "$ZINIT_HOME_DIR"
command git clone https://github.com/zdharma-continuum/zinit "$ZINIT_HOME_DIR/bin" && \ command git clone https://github.com/zdharma-continuum/zinit "$ZINIT_HOME_DIR/bin" && \
print -P "%F{33}▓▒░ %F{34}Installation successful.%f%b\nPlease wait while plugins install." || \ print -P "%F{33}▓▒░ %F{34}Installation successful.%f%b\n\nPlease wait while plugins install." || \
print -P "%F{160}▓▒░ The clone has failed.%f%b" print -P "%F{160}▓▒░ The clone has failed.%f%b"
elif [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then elif [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"