minor changes

This commit is contained in:
Solomon Laing 2023-01-16 10:58:35 +10:30
parent 57a601b462
commit 7f61e85622
5 changed files with 226 additions and 178 deletions

View File

@ -176,7 +176,7 @@ map me mkfile_and_edit
map gh cd
map gd cd ~/Downloads
map gr cd ~/repos
map gz cd ~/work
map gz cd ~/notes
map gn cd ~/nextcloud
map gH cd ~/nextcloud/university/Honours
map gcc cd ~/.config
@ -187,6 +187,7 @@ map gcxm cd ~/.xmonad
map gcs cd ~/.config/shell
map gcz cd ~/.config/zsh
map gcx1 cd ~/.config/x11
map gw cd ~/work
map A rename # at the very end
map c push A<c-u> # new rename

View File

@ -24,23 +24,23 @@ local function contains(t, value)
return false
end
local compare = require "cmp.config.compare"
local compare = require("cmp.config.compare")
require("luasnip/loaders/from_vscode").lazy_load()
local check_backspace = function()
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
local icons = require "chris.icons"
local icons = require("chris.icons")
local kind_icons = icons.kind
-- I don't have most of the following but they can serve as future examples
vim.g.cmp_active = true
cmp.setup {
cmp.setup({
enabled = function()
local buftype = vim.api.nvim_buf_get_option(0, "buftype")
if buftype == "prompt" then
@ -54,37 +54,37 @@ cmp.setup {
luasnip.lsp_expand(args.body) -- For `luasnip` users.
end,
},
mapping = cmp.mapping.preset.insert {
mapping = cmp.mapping.preset.insert({
["<C-k>"] = cmp.mapping(cmp.mapping.select_prev_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-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "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-c>"] = cmp.mapping {
["<C-c>"] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
},
["<m-j>"] = cmp.mapping {
}),
["<m-j>"] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
},
["<m-k>"] = cmp.mapping {
}),
["<m-k>"] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
},
["<m-c>"] = cmp.mapping {
}),
["<m-c>"] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
},
["<S-CR>"] = cmp.mapping {
}),
["<S-CR>"] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
},
}),
-- Accept currently selected item. If none selected, `select` first item.
-- Set `select` to `false` to only confirm explicitly selected items.
["<CR>"] = cmp.mapping.confirm { select = false },
["<Right>"] = cmp.mapping.confirm { select = true },
["<CR>"] = cmp.mapping.confirm({ select = false }),
["<Right>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
@ -116,7 +116,7 @@ cmp.setup {
"i",
"s",
}),
},
}),
formatting = {
fields = { "kind", "abbr", "menu" },
format = function(entry, vim_item)
@ -197,4 +197,4 @@ cmp.setup {
experimental = {
ghost_text = true,
},
}
})

View File

@ -13,11 +13,13 @@ end
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
require("lazy").setup({
if not vim.g.vscode then
require("lazy").setup({
spec = "lazyvim.plugins",
defaults = { lazy = true, version = "*" },
checker = { enabled = true },
})
})
end
-- map leader and register keymap for Lazy.
vim.g.mapleader = " "

View File

@ -70,11 +70,18 @@ return {
t = { name = "+todo" },
N = { name = "+noice" },
n = { "<cmd>NvimTreeToggle<cr>", "Explorer" },
e = { "<cmd>NvimTreeToggle<cr>", "Explorer" },
z = { "<cmd>ZenMode<cr>", "Zen" },
u = { "<cmd>UndotreeToggle<cr>", "Undo Tree" },
["'"] = { "<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 = {
name = "+file",
n = { "<cmd>enew<cr>", "New File" },

View 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)