Compare commits
2 Commits
b6c4df13e0
...
15e21f333f
| Author | SHA1 | Date | |
|---|---|---|---|
| 15e21f333f | |||
| 1cb0d8ab2a |
@@ -83,6 +83,7 @@ dashboard.section.header.val = vim.split(adjustedLogo, '\n')
|
|||||||
|
|
||||||
dashboard.section.buttons.val = {
|
dashboard.section.buttons.val = {
|
||||||
dashboard.button('o', ' AI Chat', '<cmd>OGPT<CR>'),
|
dashboard.button('o', ' AI Chat', '<cmd>OGPT<CR>'),
|
||||||
|
dashboard.button('d', ' Diary Entry', '<cmd>Diary<CR>'),
|
||||||
dashboard.button('n', ' New file', ':ene <BAR> startinsert <CR>'),
|
dashboard.button('n', ' New file', ':ene <BAR> startinsert <CR>'),
|
||||||
dashboard.button('s', ' Settings', '<cmd>WorkspacesOpen config-nvim<CR>'),
|
dashboard.button('s', ' Settings', '<cmd>WorkspacesOpen config-nvim<CR>'),
|
||||||
dashboard.button('u', ' Update plugins', '<cmd>Lazy update<CR>'),
|
dashboard.button('u', ' Update plugins', '<cmd>Lazy update<CR>'),
|
||||||
|
|||||||
@@ -1,95 +0,0 @@
|
|||||||
local has_words_before = function()
|
|
||||||
unpack = unpack or table.unpack
|
|
||||||
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
|
|
||||||
end
|
|
||||||
|
|
||||||
local luasnip = require("luasnip")
|
|
||||||
local cmp = require("cmp")
|
|
||||||
|
|
||||||
cmp.setup({
|
|
||||||
snippet = {
|
|
||||||
-- REQUIRED - you must specify a snippet engine
|
|
||||||
expand = function(args)
|
|
||||||
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
window = {
|
|
||||||
-- completion = cmp.config.window.bordered(),
|
|
||||||
-- documentation = cmp.config.window.bordered(),
|
|
||||||
},
|
|
||||||
|
|
||||||
mapping = cmp.mapping.preset.insert({
|
|
||||||
-- Use <C-b/f> to scroll the docs
|
|
||||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
|
||||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
|
||||||
-- also scroll docs with page up / down
|
|
||||||
['<PageUp>'] = cmp.mapping.scroll_docs(-4),
|
|
||||||
['<PageDown>'] = cmp.mapping.scroll_docs(4),
|
|
||||||
|
|
||||||
-- ESC messes with standard ESC mapping, don't use
|
|
||||||
-- ['<Esc>'] = cmp.mapping.abort(),
|
|
||||||
['<C-e>'] = cmp.mapping.abort(),
|
|
||||||
|
|
||||||
-- Use <CR>(Enter) to confirm selection
|
|
||||||
-- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
|
||||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
|
||||||
|
|
||||||
-- A super tab
|
|
||||||
-- sourc: https://github.com/hrsh7th/nvim-cmp/wiki/Example-mappings#luasnip
|
|
||||||
["<Tab>"] = cmp.mapping(function(fallback)
|
|
||||||
-- Hint: if the completion menu is visible select next one
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_next_item()
|
|
||||||
elseif luasnip.jumpable(1) then
|
|
||||||
luasnip.jump(1)
|
|
||||||
elseif has_words_before() then
|
|
||||||
cmp.complete()
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, { "i", "s" }), -- i - insert mode; s - select mode
|
|
||||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_prev_item()
|
|
||||||
elseif luasnip.jumpable(-1) then
|
|
||||||
luasnip.jump(-1)
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, { "i", "s" }),
|
|
||||||
}),
|
|
||||||
|
|
||||||
-- Let's configure the item's appearance
|
|
||||||
-- source: https://github.com/hrsh7th/nvim-cmp/wiki/Menu-Appearance
|
|
||||||
formatting = {
|
|
||||||
-- Set order from left to right
|
|
||||||
-- kind: single letter indicating the type of completion
|
|
||||||
-- abbr: abbreviation of "word"; when not empty it is used in the menu instead of "word"
|
|
||||||
-- menu: extra text for the popup menu, displayed after "word" or "abbr"
|
|
||||||
fields = { 'abbr', 'menu' },
|
|
||||||
|
|
||||||
-- customize the appearance of the completion menu
|
|
||||||
format = function(entry, vim_item)
|
|
||||||
vim_item.menu = ({
|
|
||||||
nvim_lsp = '[Lsp]',
|
|
||||||
luasnip = '[Luasnip]',
|
|
||||||
buffer = '[File]',
|
|
||||||
path = '[Path]',
|
|
||||||
})[entry.source.name]
|
|
||||||
return vim_item
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Set source precedence
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'nvim_lsp' }, -- For nvim-lsp
|
|
||||||
{ name = 'luasnip' }, -- For luasnip user
|
|
||||||
{ name = 'buffer' }, -- For buffer word completion
|
|
||||||
{ name = 'path' }, -- For path completion
|
|
||||||
{ name = 'orgmode' }, -- for nvim-orgmode
|
|
||||||
{ name = 'sonicpi' }, -- for sonic-pi integration
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -14,8 +14,9 @@ local diary_open = function(opts)
|
|||||||
snips.snip_expand(asnippets[1])
|
snips.snip_expand(asnippets[1])
|
||||||
vim.cmd('normal! G')
|
vim.cmd('normal! G')
|
||||||
end
|
end
|
||||||
snips.snip_expand(asnippets[2])
|
|
||||||
|
|
||||||
|
vim.cmd('normal! 3o') -- insert some newlines before new entry
|
||||||
|
snips.snip_expand(asnippets[2])
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.api.nvim_create_user_command("Diary", diary_open, { nargs = '?' })
|
vim.api.nvim_create_user_command("Diary", diary_open, { nargs = '?' })
|
||||||
|
|||||||
@@ -14,19 +14,81 @@ vim.opt.rtp:prepend(lazypath)
|
|||||||
require("lazy").setup({
|
require("lazy").setup({
|
||||||
-- Auto-completion engine
|
-- Auto-completion engine
|
||||||
{
|
{
|
||||||
"hrsh7th/nvim-cmp",
|
'saghen/blink.cmp',
|
||||||
dependencies = {
|
-- optional: provides snippets for the snippet source
|
||||||
"hrsh7th/cmp-nvim-lsp", -- lsp auto-completion
|
dependencies = { 'rafamadriz/friendly-snippets',
|
||||||
"hrsh7th/cmp-buffer", -- buffer auto-completion
|
{
|
||||||
"hrsh7th/cmp-path", -- path auto-completion
|
"L3MON4D3/LuaSnip",
|
||||||
"hrsh7th/cmp-cmdline", -- cmdline auto-completion
|
version = "v2.*"
|
||||||
"saadparwaiz1/cmp_luasnip", -- luasnip auto-completion
|
}
|
||||||
},
|
},
|
||||||
config = function()
|
|
||||||
require("config.nvim-cmp")
|
-- use a release tag to download pre-built binaries
|
||||||
end,
|
version = '1.*',
|
||||||
|
-- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust
|
||||||
|
-- build = 'cargo build --release',
|
||||||
|
-- If you use nix, you can build from source using latest nightly rust with:
|
||||||
|
-- build = 'nix run .#build-plugin',
|
||||||
|
|
||||||
|
---@module 'blink.cmp'
|
||||||
|
---@type blink.cmp.Config
|
||||||
|
opts = {
|
||||||
|
-- 'default' (recommended) for mappings similar to built-in completions (C-y to accept)
|
||||||
|
-- 'super-tab' for mappings similar to vscode (tab to accept)
|
||||||
|
-- 'enter' for enter to accept
|
||||||
|
-- 'none' for no mappings
|
||||||
|
--
|
||||||
|
-- All presets have the following mappings:
|
||||||
|
-- C-space: Open menu or open docs if already open
|
||||||
|
-- C-n/C-p or Up/Down: Select next/previous item
|
||||||
|
-- C-e: Hide menu
|
||||||
|
-- C-k: Toggle signature help (if signature.enabled = true)
|
||||||
|
--
|
||||||
|
-- See :h blink-cmp-config-keymap for defining your own keymap
|
||||||
|
keymap = { preset = 'enter' },
|
||||||
|
signature = { enabled = true },
|
||||||
|
|
||||||
|
appearance = {
|
||||||
|
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
|
||||||
|
-- Adjusts spacing to ensure icons are aligned
|
||||||
|
nerd_font_variant = 'mono'
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- (Default) Only show the documentation popup when manually triggered
|
||||||
|
completion = {
|
||||||
|
documentation = { auto_show = true },
|
||||||
|
menu = {
|
||||||
|
-- show more things in the menu
|
||||||
|
draw = {
|
||||||
|
columns = {
|
||||||
|
{ "label", "label_description", gap = 1 },
|
||||||
|
{ "kind_icon", "kind", gap = 1 },
|
||||||
|
{ "source_name" },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Default list of enabled providers defined so that you can extend it
|
||||||
|
-- elsewhere in your config, without redefining it, due to `opts_extend`
|
||||||
|
sources = {
|
||||||
|
default = { 'lsp', 'path', 'snippets', 'buffer' },
|
||||||
|
},
|
||||||
|
|
||||||
|
snippets = { preset = 'luasnip' },
|
||||||
|
|
||||||
|
|
||||||
|
-- (Default) Rust fuzzy matcher for typo resistance and significantly better performance
|
||||||
|
-- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation,
|
||||||
|
-- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"`
|
||||||
|
--
|
||||||
|
-- See the fuzzy documentation for more information
|
||||||
|
fuzzy = { implementation = "prefer_rust_with_warning" }
|
||||||
|
},
|
||||||
|
opts_extend = { "sources.default" }
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
-- Code snippet engine
|
-- Code snippet engine
|
||||||
{
|
{
|
||||||
"L3MON4D3/LuaSnip",
|
"L3MON4D3/LuaSnip",
|
||||||
|
|||||||
Reference in New Issue
Block a user