summaryrefslogtreecommitdiff
path: root/scratch
diff options
context:
space:
mode:
authorTJ DeVries <devries.timothyj@gmail.com>2020-09-11 14:39:20 -0400
committerTJ DeVries <devries.timothyj@gmail.com>2020-09-11 14:39:20 -0400
commit3316dcd7a3f77d9b37d0fb8a3db283e0a551e8d9 (patch)
treec128bbda27324c353e6f5544d9736dca57c4ac71 /scratch
parentd96d89711ca4a9534a7edb53b29eff4fd4ab1861 (diff)
scratch: add thoughts
Diffstat (limited to 'scratch')
-rw-r--r--scratch/diag_test.lua10
-rw-r--r--scratch/piped_to_fzf.lua33
-rw-r--r--scratch/threaded_lua.lua15
3 files changed, 58 insertions, 0 deletions
diff --git a/scratch/diag_test.lua b/scratch/diag_test.lua
new file mode 100644
index 0000000..589b6c2
--- /dev/null
+++ b/scratch/diag_test.lua
@@ -0,0 +1,10 @@
+local y = function() end
+
+local x = function()
+ asdf
+ print(y)
+end
+
+x()
+
+y()
diff --git a/scratch/piped_to_fzf.lua b/scratch/piped_to_fzf.lua
new file mode 100644
index 0000000..98577bd
--- /dev/null
+++ b/scratch/piped_to_fzf.lua
@@ -0,0 +1,33 @@
+RELOAD('telescope')
+RELOAD('plenary')
+
+local finders = require('telescope.finders')
+local make_entry = require('telescope.make_entry')
+local pickers = require('telescope.pickers')
+local sorters = require('telescope.sorters')
+
+local Job = require('plenary.job')
+
+pickers.new {
+ prompt = "Piped FZF",
+
+ finder = finders._new {
+ fn_command = function(_, prompt)
+ return {
+ command = 'fzf',
+ args = {'--no-sort', '--filter', prompt or ''},
+
+ writer = Job:new {
+ command = 'rg',
+ args = {'--files'},
+ cwd = '/home/tj/',
+
+ enable_handlers = false,
+ },
+ }
+ end,
+
+ entry_maker = make_entry.gen_from_file(),
+ sorter = sorters.get_fuzzy_file(),
+ },
+}:find()
diff --git a/scratch/threaded_lua.lua b/scratch/threaded_lua.lua
new file mode 100644
index 0000000..68eddb0
--- /dev/null
+++ b/scratch/threaded_lua.lua
@@ -0,0 +1,15 @@
+local uv = require('luv')
+
+-- print(vim.inspect(uv))
+
+
+local my_table = {}
+local my_value = 1
+
+local table_adder = uv.new_thread(function(tbl)
+ table.insert(tbl, "HELLO")
+end, my_table)
+
+uv.thread_join(table_adder)
+-- print(vim.inspect(MY_TABLE))
+