telescope git files with fallback to local files

master
Jordan Orelli 4 months ago
parent cdbfe35a6f
commit 0eb58f5f40

@ -65,7 +65,6 @@ files:
# This needs to be run, but it's really annoying when you run the installer
# from within Vim because it tries to do this recursive Vim thing that does not
# work, so I'd rather just run it by hand.
#
[run vim-plugins]
when: host.has('vim')
cmd: vim +PlugInstall +qall
@ -119,10 +118,6 @@ files: .screenrc
when: host.has('tmux')
files: .tmux.conf
# [home posix-nvim]
# when: host.has('nvim') and not host.is_windows
# files: nvim/init.vim > .config/nvim/init.vim
[home wsl]
when: host.is_wsl
files: scripts/winmode > bin/winmode

@ -1,15 +1,17 @@
print("Setting up colors")
rose_pine = packer_plugins["rose-pine"]
if rose_pine then
print("Rose Pine is known")
if rose_pine.loaded then
print("Using Rose Pine colorscheme")
vim.cmd.colorscheme("rose-pine")
-- vim.cmd("colorscheme rose-pine")
else
print("Rose Pine is not loaded")
end
else
print("Rose Pine is not known")
end
vim.cmd.colorscheme("jellybeans")
-- rose_pine = packer_plugins["rose-pine"]
-- if rose_pine then
-- print("Rose Pine is known")
-- if rose_pine.loaded then
-- print("Using Rose Pine colorscheme")
-- vim.cmd.colorscheme("rose-pine")
-- -- vim.cmd("colorscheme rose-pine")
-- else
-- print("Rose Pine is not loaded")
-- end
-- else
-- print("Rose Pine is not known")
-- end

@ -1,2 +1,19 @@
print("After Telescope")
local telescope = require('telescope')
local builtin = require('telescope.builtin')
telescope.setup({
defaults = {
file_ignore_patterns = {
"__pycache__",
},
preview = {
treesitter = {
enable = {
'python',
}
}
}
},
})

@ -0,0 +1,29 @@
print("Loading up etc definitions")
local M = {}
local telescope = require("telescope.builtin")
-- cache directory checks for great speed
local is_inside_work_tree = {}
M.project_files = function()
local opts = {}
local cwd = vim.fn.getcwd()
if is_inside_work_tree[cwd] == nil then
-- The directory has not been checked
vim.fn.system("git rev-parse --is-inside-work-tree")
-- Add the result to our cache
is_inside_work_tree[cwd] = vim.v.shell_error == 0
end
if is_inside_work_tree[cwd] then
telescope.git_files(opts)
else
telescope.find_files(opts)
end
end
return M

@ -1,7 +1,8 @@
print("Loading key mappings")
local telescope = require('telescope.builtin')
vim.keymap.set('n', '<C-p>', telescope.find_files, {})
local etc = require("etc")
vim.keymap.set('n', '<C-p>', etc.project_files, {})
-- vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
-- vim.keymap.set("v", "K", ":m '>-2<CR>gv=gv")

@ -24,8 +24,9 @@ return require('packer').startup(function(use)
-- lets you look at parse trees
use { 'nvim-treesitter/playground' }
-- it's a colorscheme
-- colorschemes
use { "rose-pine/neovim", as = "rose-pine" }
use { "nanotech/jellybeans.vim", as = "jellybeans" }
-- hmmmm try this?
-- https://github.com/ThePrimeagen/harpoon/tree/harpoon2

Loading…
Cancel
Save