yay
This commit is contained in:
commit
9d3d05066f
80 changed files with 7776 additions and 0 deletions
69
lua/config/commands.lua
Normal file
69
lua/config/commands.lua
Normal file
|
@ -0,0 +1,69 @@
|
|||
local pickers = require "telescope.pickers"
|
||||
local finders = require "telescope.finders"
|
||||
local conf = require("telescope.config").values
|
||||
local actions = require "telescope.actions"
|
||||
local action_state = require "telescope.actions.state"
|
||||
|
||||
vim.api.nvim_create_user_command("OP", function ()
|
||||
local folders = vim.fn.systemlist("\\ls -d $HOME/projects/*/")
|
||||
for i, folder in ipairs(folders) do
|
||||
folders[i] = string.match(string.match(folder, "[^/]*/$"), "^[^/]*")
|
||||
end
|
||||
pickers.new({}, {
|
||||
prompt_title = "Open project",
|
||||
finder = finders.new_table {
|
||||
results = folders
|
||||
},
|
||||
sorter = conf.generic_sorter({}),
|
||||
attach_mappings = function (prompt_bufnr, map)
|
||||
actions.select_default:replace(function ()
|
||||
actions.close(prompt_bufnr)
|
||||
local selection = action_state.get_selected_entry()
|
||||
selection = selection[1]
|
||||
vim.cmd("cd $HOME/projects/" .. selection)
|
||||
vim.cmd("Alpha")
|
||||
vim.cmd("BWipeout other")
|
||||
end)
|
||||
return true
|
||||
end
|
||||
}):find()
|
||||
end, {})
|
||||
|
||||
vim.api.nvim_create_user_command("OD", function ()
|
||||
local folders = vim.fn.systemlist("\\ls -d */")
|
||||
for i, folder in ipairs(folders) do
|
||||
folders[i] = string.match(string.match(folder, "[^/]*/$"), "^[^/]*")
|
||||
end
|
||||
pickers.new({}, {
|
||||
prompt_title = "Open directory",
|
||||
finder = finders.new_table {
|
||||
results = folders
|
||||
},
|
||||
sorter = conf.generic_sorter({}),
|
||||
attach_mappings = function (prompt_bufnr, map)
|
||||
actions.select_default:replace(function ()
|
||||
actions.close(prompt_bufnr)
|
||||
local selection = action_state.get_selected_entry()
|
||||
selection = selection[1]
|
||||
vim.cmd("cd " .. selection)
|
||||
vim.cmd("Alpha")
|
||||
vim.cmd("BWipeout other")
|
||||
end)
|
||||
return true
|
||||
end
|
||||
}):find()
|
||||
end, {})
|
||||
|
||||
vim.api.nvim_create_user_command("Config", function ()
|
||||
vim.cmd("cd $HOME/.config/nvim")
|
||||
vim.cmd("Alpha")
|
||||
vim.cmd("BWipeout other")
|
||||
end, {})
|
||||
|
||||
vim.api.nvim_create_user_command("O", function ()
|
||||
require("oil").open_float(vim.fn.getcwd())
|
||||
end, {})
|
||||
|
||||
vim.api.nvim_create_user_command("RetabFile", function ()
|
||||
vim.cmd(":set ts=2 sts=2 noet | retab! | set ts=4 sts=4 et | retab!")
|
||||
end, {})
|
Loading…
Add table
Add a link
Reference in a new issue