minor changes
This commit is contained in:
parent
57a601b462
commit
7f61e85622
@ -176,7 +176,7 @@ map me mkfile_and_edit
|
|||||||
map gh cd
|
map gh cd
|
||||||
map gd cd ~/Downloads
|
map gd cd ~/Downloads
|
||||||
map gr cd ~/repos
|
map gr cd ~/repos
|
||||||
map gz cd ~/work
|
map gz cd ~/notes
|
||||||
map gn cd ~/nextcloud
|
map gn cd ~/nextcloud
|
||||||
map gH cd ~/nextcloud/university/Honours
|
map gH cd ~/nextcloud/university/Honours
|
||||||
map gcc cd ~/.config
|
map gcc cd ~/.config
|
||||||
@ -187,6 +187,7 @@ map gcxm cd ~/.xmonad
|
|||||||
map gcs cd ~/.config/shell
|
map gcs cd ~/.config/shell
|
||||||
map gcz cd ~/.config/zsh
|
map gcz cd ~/.config/zsh
|
||||||
map gcx1 cd ~/.config/x11
|
map gcx1 cd ~/.config/x11
|
||||||
|
map gw cd ~/work
|
||||||
|
|
||||||
map A rename # at the very end
|
map A rename # at the very end
|
||||||
map c push A<c-u> # new rename
|
map c push A<c-u> # new rename
|
||||||
|
|||||||
@ -1,200 +1,200 @@
|
|||||||
local cmp_status_ok, cmp = pcall(require, "cmp")
|
local cmp_status_ok, cmp = pcall(require, "cmp")
|
||||||
if not cmp_status_ok then
|
if not cmp_status_ok then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local snip_status_ok, luasnip = pcall(require, "luasnip")
|
local snip_status_ok, luasnip = pcall(require, "luasnip")
|
||||||
if not snip_status_ok then
|
if not snip_status_ok then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local buffer_fts = {
|
local buffer_fts = {
|
||||||
"markdown",
|
"markdown",
|
||||||
"toml",
|
"toml",
|
||||||
"yaml",
|
"yaml",
|
||||||
"json",
|
"json",
|
||||||
}
|
}
|
||||||
|
|
||||||
local function contains(t, value)
|
local function contains(t, value)
|
||||||
for _, v in pairs(t) do
|
for _, v in pairs(t) do
|
||||||
if v == value then
|
if v == value then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
local compare = require "cmp.config.compare"
|
local compare = require("cmp.config.compare")
|
||||||
|
|
||||||
require("luasnip/loaders/from_vscode").lazy_load()
|
require("luasnip/loaders/from_vscode").lazy_load()
|
||||||
|
|
||||||
local check_backspace = function()
|
local check_backspace = function()
|
||||||
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 icons = require "chris.icons"
|
local icons = require("chris.icons")
|
||||||
|
|
||||||
local kind_icons = icons.kind
|
local kind_icons = icons.kind
|
||||||
|
|
||||||
-- I don't have most of the following but they can serve as future examples
|
-- I don't have most of the following but they can serve as future examples
|
||||||
vim.g.cmp_active = true
|
vim.g.cmp_active = true
|
||||||
|
|
||||||
cmp.setup {
|
cmp.setup({
|
||||||
enabled = function()
|
enabled = function()
|
||||||
local buftype = vim.api.nvim_buf_get_option(0, "buftype")
|
local buftype = vim.api.nvim_buf_get_option(0, "buftype")
|
||||||
if buftype == "prompt" then
|
if buftype == "prompt" then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return vim.g.cmp_active
|
return vim.g.cmp_active
|
||||||
end,
|
end,
|
||||||
preselect = cmp.PreselectMode.None,
|
preselect = cmp.PreselectMode.None,
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = function(args)
|
expand = function(args)
|
||||||
luasnip.lsp_expand(args.body) -- For `luasnip` users.
|
luasnip.lsp_expand(args.body) -- For `luasnip` users.
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
mapping = cmp.mapping.preset.insert {
|
mapping = cmp.mapping.preset.insert({
|
||||||
["<C-k>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }),
|
["<C-k>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }),
|
||||||
["<C-j>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }),
|
["<C-j>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }),
|
||||||
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }),
|
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }),
|
||||||
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }),
|
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }),
|
||||||
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
||||||
-- ["<C-y>"] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
|
-- ["<C-y>"] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
|
||||||
["<C-c>"] = cmp.mapping {
|
["<C-c>"] = cmp.mapping({
|
||||||
i = cmp.mapping.abort(),
|
i = cmp.mapping.abort(),
|
||||||
c = cmp.mapping.close(),
|
c = cmp.mapping.close(),
|
||||||
},
|
}),
|
||||||
["<m-j>"] = cmp.mapping {
|
["<m-j>"] = cmp.mapping({
|
||||||
i = cmp.mapping.abort(),
|
i = cmp.mapping.abort(),
|
||||||
c = cmp.mapping.close(),
|
c = cmp.mapping.close(),
|
||||||
},
|
}),
|
||||||
["<m-k>"] = cmp.mapping {
|
["<m-k>"] = cmp.mapping({
|
||||||
i = cmp.mapping.abort(),
|
i = cmp.mapping.abort(),
|
||||||
c = cmp.mapping.close(),
|
c = cmp.mapping.close(),
|
||||||
},
|
}),
|
||||||
["<m-c>"] = cmp.mapping {
|
["<m-c>"] = cmp.mapping({
|
||||||
i = cmp.mapping.abort(),
|
i = cmp.mapping.abort(),
|
||||||
c = cmp.mapping.close(),
|
c = cmp.mapping.close(),
|
||||||
},
|
}),
|
||||||
["<S-CR>"] = cmp.mapping {
|
["<S-CR>"] = cmp.mapping({
|
||||||
i = cmp.mapping.abort(),
|
i = cmp.mapping.abort(),
|
||||||
c = cmp.mapping.close(),
|
c = cmp.mapping.close(),
|
||||||
},
|
}),
|
||||||
-- Accept currently selected item. If none selected, `select` first item.
|
-- Accept currently selected item. If none selected, `select` first item.
|
||||||
-- Set `select` to `false` to only confirm explicitly selected items.
|
-- Set `select` to `false` to only confirm explicitly selected items.
|
||||||
["<CR>"] = cmp.mapping.confirm { select = false },
|
["<CR>"] = cmp.mapping.confirm({ select = false }),
|
||||||
["<Right>"] = cmp.mapping.confirm { select = true },
|
["<Right>"] = cmp.mapping.confirm({ select = true }),
|
||||||
["<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()
|
||||||
elseif luasnip.jumpable(1) then
|
elseif luasnip.jumpable(1) then
|
||||||
luasnip.jump(1)
|
luasnip.jump(1)
|
||||||
elseif luasnip.expand_or_jumpable() then
|
elseif luasnip.expand_or_jumpable() then
|
||||||
luasnip.expand_or_jump()
|
luasnip.expand_or_jump()
|
||||||
elseif luasnip.expandable() then
|
elseif luasnip.expandable() then
|
||||||
luasnip.expand()
|
luasnip.expand()
|
||||||
elseif check_backspace() then
|
elseif check_backspace() then
|
||||||
-- cmp.complete()
|
-- cmp.complete()
|
||||||
fallback()
|
fallback()
|
||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
end
|
end
|
||||||
end, {
|
end, {
|
||||||
"i",
|
"i",
|
||||||
"s",
|
"s",
|
||||||
}),
|
}),
|
||||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_prev_item()
|
cmp.select_prev_item()
|
||||||
elseif luasnip.jumpable(-1) then
|
elseif luasnip.jumpable(-1) then
|
||||||
luasnip.jump(-1)
|
luasnip.jump(-1)
|
||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
end
|
end
|
||||||
end, {
|
end, {
|
||||||
"i",
|
"i",
|
||||||
"s",
|
"s",
|
||||||
}),
|
}),
|
||||||
},
|
}),
|
||||||
formatting = {
|
formatting = {
|
||||||
fields = { "kind", "abbr", "menu" },
|
fields = { "kind", "abbr", "menu" },
|
||||||
format = function(entry, vim_item)
|
format = function(entry, vim_item)
|
||||||
-- Kind icons
|
-- Kind icons
|
||||||
vim_item.kind = kind_icons[vim_item.kind]
|
vim_item.kind = kind_icons[vim_item.kind]
|
||||||
|
|
||||||
if entry.source.name == "lab.quick_data" then
|
if entry.source.name == "lab.quick_data" then
|
||||||
vim_item.kind = icons.misc.CircuitBoard
|
vim_item.kind = icons.misc.CircuitBoard
|
||||||
vim_item.kind_hl_group = "CmpItemKindConstant"
|
vim_item.kind_hl_group = "CmpItemKindConstant"
|
||||||
end
|
end
|
||||||
|
|
||||||
-- NOTE: order matters
|
-- NOTE: order matters
|
||||||
vim_item.menu = ({
|
vim_item.menu = ({
|
||||||
nvim_lsp = "[LSP]",
|
nvim_lsp = "[LSP]",
|
||||||
nvim_lua = "[LUA]",
|
nvim_lua = "[LUA]",
|
||||||
luasnip = "[SNP]",
|
luasnip = "[SNP]",
|
||||||
buffer = "[BUF]",
|
buffer = "[BUF]",
|
||||||
path = "[PTH]",
|
path = "[PTH]",
|
||||||
})[entry.source.name]
|
})[entry.source.name]
|
||||||
return vim_item
|
return vim_item
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
sources = {
|
sources = {
|
||||||
{
|
{
|
||||||
name = "nvim_lsp",
|
name = "nvim_lsp",
|
||||||
filter = function(entry, ctx)
|
filter = function(entry, ctx)
|
||||||
local kind = require("cmp.types.lsp").CompletionItemKind[entry:get_kind()]
|
local kind = require("cmp.types.lsp").CompletionItemKind[entry:get_kind()]
|
||||||
if kind == "Snippet" and ctx.prev_context.filetype == "java" then
|
if kind == "Snippet" and ctx.prev_context.filetype == "java" then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
if kind == "Text" then
|
if kind == "Text" then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
group_index = 2,
|
group_index = 2,
|
||||||
},
|
},
|
||||||
{ name = "nvim_lua", group_index = 2 },
|
{ name = "nvim_lua", group_index = 2 },
|
||||||
{ name = "luasnip", group_index = 2 },
|
{ name = "luasnip", group_index = 2 },
|
||||||
{
|
{
|
||||||
name = "buffer",
|
name = "buffer",
|
||||||
group_index = 2,
|
group_index = 2,
|
||||||
filter = function(entry, ctx)
|
filter = function(entry, ctx)
|
||||||
if not contains(buffer_fts, ctx.prev_context.filetype) then
|
if not contains(buffer_fts, ctx.prev_context.filetype) then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{ name = "path", group_index = 2 },
|
{ name = "path", group_index = 2 },
|
||||||
{ name = "lab.quick_data", keyword_length = 4, group_index = 2 },
|
{ name = "lab.quick_data", keyword_length = 4, group_index = 2 },
|
||||||
},
|
},
|
||||||
sorting = {
|
sorting = {
|
||||||
priority_weight = 2,
|
priority_weight = 2,
|
||||||
comparators = {
|
comparators = {
|
||||||
compare.offset,
|
compare.offset,
|
||||||
compare.exact,
|
compare.exact,
|
||||||
-- compare.scopes,
|
-- compare.scopes,
|
||||||
compare.score,
|
compare.score,
|
||||||
compare.recently_used,
|
compare.recently_used,
|
||||||
compare.locality,
|
compare.locality,
|
||||||
-- compare.kind,
|
-- compare.kind,
|
||||||
compare.sort_text,
|
compare.sort_text,
|
||||||
compare.length,
|
compare.length,
|
||||||
compare.order,
|
compare.order,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
confirm_opts = {
|
confirm_opts = {
|
||||||
behavior = cmp.ConfirmBehavior.Replace,
|
behavior = cmp.ConfirmBehavior.Replace,
|
||||||
select = false,
|
select = false,
|
||||||
},
|
},
|
||||||
window = {
|
window = {
|
||||||
documentation = false,
|
documentation = false,
|
||||||
completion = {
|
completion = {
|
||||||
border = "rounded",
|
border = "rounded",
|
||||||
winhighlight = "NormalFloat:Pmenu,NormalFloat:Pmenu,CursorLine:PmenuSel,Search:None",
|
winhighlight = "NormalFloat:Pmenu,NormalFloat:Pmenu,CursorLine:PmenuSel,Search:None",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
experimental = {
|
experimental = {
|
||||||
ghost_text = true,
|
ghost_text = true,
|
||||||
},
|
},
|
||||||
}
|
})
|
||||||
|
|||||||
@ -13,11 +13,13 @@ end
|
|||||||
|
|
||||||
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
|
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
|
||||||
|
|
||||||
require("lazy").setup({
|
if not vim.g.vscode then
|
||||||
spec = "lazyvim.plugins",
|
require("lazy").setup({
|
||||||
defaults = { lazy = true, version = "*" },
|
spec = "lazyvim.plugins",
|
||||||
checker = { enabled = true },
|
defaults = { lazy = true, version = "*" },
|
||||||
})
|
checker = { enabled = true },
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
-- map leader and register keymap for Lazy.
|
-- map leader and register keymap for Lazy.
|
||||||
vim.g.mapleader = " "
|
vim.g.mapleader = " "
|
||||||
|
|||||||
@ -70,11 +70,18 @@ return {
|
|||||||
t = { name = "+todo" },
|
t = { name = "+todo" },
|
||||||
N = { name = "+noice" },
|
N = { name = "+noice" },
|
||||||
|
|
||||||
n = { "<cmd>NvimTreeToggle<cr>", "Explorer" },
|
e = { "<cmd>NvimTreeToggle<cr>", "Explorer" },
|
||||||
z = { "<cmd>ZenMode<cr>", "Zen" },
|
z = { "<cmd>ZenMode<cr>", "Zen" },
|
||||||
u = { "<cmd>UndotreeToggle<cr>", "Undo Tree" },
|
u = { "<cmd>UndotreeToggle<cr>", "Undo Tree" },
|
||||||
["'"] = { "<cmd>close<CR>", "Close split" },
|
["'"] = { "<cmd>close<CR>", "Close split" },
|
||||||
|
|
||||||
|
n = {
|
||||||
|
name = "+neorg",
|
||||||
|
n = { "<cmd>Neorg<cr>", "Open Neorg" },
|
||||||
|
j = { "<cmd>Neorg journal<cr>", "Open Neorg Journal" },
|
||||||
|
w = { "<cmd>Neorg workspace<cr>", "Open Neorg Workspace" },
|
||||||
|
},
|
||||||
|
|
||||||
f = {
|
f = {
|
||||||
name = "+file",
|
name = "+file",
|
||||||
n = { "<cmd>enew<cr>", "New File" },
|
n = { "<cmd>enew<cr>", "New File" },
|
||||||
|
|||||||
38
.config/nvim/lua/lazyvim/teletest.lua
Normal file
38
.config/nvim/lua/lazyvim/teletest.lua
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
local pickers = require("telescope.pickers")
|
||||||
|
local finders = require("telescope.finders")
|
||||||
|
local actions = require("telescope.actions")
|
||||||
|
local action_state = require("telescope.actions.state")
|
||||||
|
local conf = require("telescope.config").values
|
||||||
|
|
||||||
|
local prompt = function(opts, prompt, options, callback)
|
||||||
|
opts = opts or {}
|
||||||
|
pickers
|
||||||
|
.new(opts, {
|
||||||
|
prompt_title = prompt,
|
||||||
|
finder = finders.new_table({
|
||||||
|
results = options,
|
||||||
|
entry_marker = function(entry)
|
||||||
|
return {
|
||||||
|
value = entry,
|
||||||
|
display = entry[1],
|
||||||
|
ordinal = entry[1],
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}),
|
||||||
|
sorter = conf.generic_sorter(opts),
|
||||||
|
attach_mappings = function(promnt_bufnr, map)
|
||||||
|
actions.select_default:replace(function()
|
||||||
|
actions.close(promnt_bufnr)
|
||||||
|
local selection = action_state.get_selected_entry()
|
||||||
|
vim.notify(selection[1])
|
||||||
|
end)
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
:find()
|
||||||
|
end
|
||||||
|
|
||||||
|
prompt(require("telescope.themes").get_dropdown({}), "test", {
|
||||||
|
{ "one", "1" },
|
||||||
|
{ "two", "2" },
|
||||||
|
}, nil)
|
||||||
Loading…
Reference in New Issue
Block a user