Skip to content

Commit 36fa424

Browse files
committed
feat: changes needed for my setup
1 parent 4cae028 commit 36fa424

File tree

10 files changed

+182
-14
lines changed

10 files changed

+182
-14
lines changed

after/plugin/cloak.lua

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
require("cloak").setup({
2+
enabled = true,
3+
cloak_character = "*",
4+
-- The applied highlight group (colors) on the cloaking, see `:h highlight`.
5+
highlight_group = "Comment",
6+
patterns = {
7+
{
8+
-- Match any file starting with ".env".
9+
-- This can be a table to match multiple file patterns.
10+
file_pattern = {
11+
".env*",
12+
"wrangler.toml",
13+
".dev.vars",
14+
},
15+
-- Match an equals sign and any character after it.
16+
-- This can also be a table of patterns to cloak,
17+
-- example: cloak_pattern = { ":.+", "-.+" } for yaml files.
18+
cloak_pattern = "=.+"
19+
},
20+
},
21+
})
22+

after/plugin/refactoring.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
require('refactoring').setup({})
2+
3+
vim.api.nvim_set_keymap("v", "<leader>ri", [[ <Esc><Cmd>lua require('refactoring').refactor('Inline Variable')<CR>]], {noremap = true, silent = true, expr = false})
4+
5+

after/plugin/telescope.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ vim.keymap.set('n', '<C-p>', builtin.git_files, {})
44
vim.keymap.set('n', '<leader>ps', function()
55
builtin.grep_string({ search = vim.fn.input("Grep > ") })
66
end)
7+
vim.keymap.set('n', '<leader>vh', builtin.help_tags, {})
78

after/plugin/zenmode.lua

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
1-
require("zen-mode").setup {
2-
window = {
3-
width = 90,
4-
options = {
5-
number = true,
6-
relativenumber = true,
7-
}
8-
},
9-
}
101

112
vim.keymap.set("n", "<leader>zz", function()
3+
require("zen-mode").setup {
4+
window = {
5+
width = 90,
6+
options = { }
7+
},
8+
}
129
require("zen-mode").toggle()
1310
vim.wo.wrap = false
11+
vim.wo.number = true
12+
vim.wo.rnu = true
13+
ColorMyPencils()
14+
end)
15+
16+
17+
vim.keymap.set("n", "<leader>zZ", function()
18+
require("zen-mode").setup {
19+
window = {
20+
width = 80,
21+
options = { }
22+
},
23+
}
24+
require("zen-mode").toggle()
25+
vim.wo.wrap = false
26+
vim.wo.number = false
27+
vim.wo.rnu = false
28+
vim.opt.colorcolumn = "0"
1429
ColorMyPencils()
1530
end)

lua/theprimeagen/init.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
require("theprimeagen.set")
22
require("theprimeagen.remap")
33

4+
-- DO NOT INCLUDE THIS
5+
vim.opt.rtp:append("~/.dotfiles/nvim/.config/nvim/lua/theprimeagen/streamer-tools")
6+
-- DO NOT INCLUDE THIS
7+
48
local augroup = vim.api.nvim_create_augroup
59
local ThePrimeagenGroup = augroup('ThePrimeagen', {})
610

lua/theprimeagen/packer.lua

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ return require('packer').startup(function(use)
2121
end
2222
})
2323

24-
use({'nvim-treesitter/nvim-treesitter', run = ':TSUpdate'})
25-
use('nvim-treesitter/playground')
26-
use('theprimeagen/harpoon')
27-
use('mbbill/undotree')
28-
use('tpope/vim-fugitive')
24+
use({"nvim-treesitter/nvim-treesitter", run = ":TSUpdate"})
25+
use("nvim-treesitter/playground")
26+
use("theprimeagen/harpoon")
27+
use("theprimeagen/refactoring.nvim")
28+
use("mbbill/undotree")
29+
use("tpope/vim-fugitive")
30+
use("nvim-treesitter/nvim-treesitter-context");
2931

3032
use {
3133
'VonHeikemen/lsp-zero.nvim',
@@ -53,6 +55,7 @@ return require('packer').startup(function(use)
5355
use("folke/zen-mode.nvim")
5456
use("github/copilot.vim")
5557
use("eandrju/cellular-automaton.nvim")
58+
use("laytan/cloak.nvim")
5659

5760
end)
5861

lua/theprimeagen/remap.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,8 @@ vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
4444

4545
vim.keymap.set("n", "<leader>vpp", "<cmd>e ~/.dotfiles/nvim/.config/nvim/lua/theprimeagen/packer.lua<CR>");
4646
vim.keymap.set("n", "<leader>mr", "<cmd>CellularAutomaton make_it_rain<CR>");
47+
48+
vim.keymap.set("n", "<leader>tt", function()
49+
require("theprimeagen.typist").next(16)
50+
end)
51+

lua/theprimeagen/streamer-tools

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 3c92b690e82a40e8e7625cd22d89e74a8d35a5a0

lua/theprimeagen/typist.lua

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
local M = {}
2+
3+
local current_selection = {}
4+
local current_idx = 0
5+
local current_style = "normal";
6+
local typist_namespace = vim.api.nvim_create_namespace("theprimeagen_typist")
7+
local current_extmark = nil
8+
9+
function M.pluck()
10+
local start_pos = vim.fn.getpos("'<")
11+
local end_pos = vim.fn.getpos("'>")
12+
13+
current_selection = vim.api.nvim_buf_get_lines(0, start_pos[2] - 1, end_pos[2], false)
14+
current_idx = 0
15+
end
16+
17+
function M.set_lines(lines)
18+
current_selection = lines
19+
current_idx = 0
20+
end
21+
22+
local running = false
23+
function M.next(speed, cb)
24+
speed = speed or 16
25+
cb = cb or function() end
26+
current_idx = current_idx + 1
27+
28+
if current_idx > #current_selection or running then
29+
return false
30+
end
31+
running = true
32+
33+
local starting_pos = vim.fn.getpos(".")[2]
34+
35+
local current = current_selection[current_idx]
36+
local idx = 1
37+
local current_line = ""
38+
local function print_line_normal()
39+
if idx > #current then
40+
running = false
41+
if current_style == "normal" then
42+
vim.api.nvim_win_set_cursor(0, {starting_pos + 1, 0})
43+
end
44+
cb()
45+
return
46+
end
47+
48+
current_line = current_line .. current:sub(idx, idx)
49+
50+
if current_style == "normal" then
51+
vim.api.nvim_buf_set_lines(0, starting_pos - 1, starting_pos, false, {current_line})
52+
vim.api.nvim_win_set_cursor(0, {starting_pos, #current_line})
53+
else
54+
--local current_line = vim.api.nvim_buf_get_lines(0, starting_pos - 1, starting_pos, false)[1]
55+
vim.api.nvim_buf_del_extmark(0, typist_namespace, current_extmark or 0)
56+
current_extmark = vim.api.nvim_buf_set_extmark(0, typist_namespace, starting_pos - 1, 0, {
57+
virt_text = {
58+
{"", "Comment"},
59+
{"", "Comment"},
60+
{current_line, "Comment"},
61+
},
62+
virt_text_pos = "eol",
63+
hl_mode = "combine",
64+
})
65+
end
66+
67+
idx = idx + 1
68+
vim.defer_fn(print_line_normal, speed)
69+
end
70+
71+
print_line_normal()
72+
return true
73+
end
74+
75+
function M.run(speed)
76+
if M.next(speed) then
77+
vim.schedule(function()
78+
M.run(speed)
79+
end)
80+
end
81+
end
82+
83+
function M.ghost_line()
84+
current_style = "ghost"
85+
end
86+
87+
function M.normal()
88+
current_style = "normal"
89+
end
90+
91+
function M.clear()
92+
vim.api.nvim_buf_del_extmark(0, typist_namespace, current_extmark or 0)
93+
current_extmark = nil
94+
end
95+
96+
97+
return M

plugin/packer_compiled.lua

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ _G.packer_plugins = {
8484
path = "/home/mpaulson/.local/share/nvim/site/pack/packer/start/cellular-automaton.nvim",
8585
url = "https://github.com/eandrju/cellular-automaton.nvim"
8686
},
87+
["cloak.nvim"] = {
88+
loaded = true,
89+
path = "/home/mpaulson/.local/share/nvim/site/pack/packer/start/cloak.nvim",
90+
url = "https://github.com/laytan/cloak.nvim"
91+
},
8792
["cmp-buffer"] = {
8893
loaded = true,
8994
path = "/home/mpaulson/.local/share/nvim/site/pack/packer/start/cmp-buffer",
@@ -154,6 +159,11 @@ _G.packer_plugins = {
154159
path = "/home/mpaulson/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
155160
url = "https://github.com/nvim-treesitter/nvim-treesitter"
156161
},
162+
["nvim-treesitter-context"] = {
163+
loaded = true,
164+
path = "/home/mpaulson/.local/share/nvim/site/pack/packer/start/nvim-treesitter-context",
165+
url = "https://github.com/nvim-treesitter/nvim-treesitter-context"
166+
},
157167
["packer.nvim"] = {
158168
loaded = true,
159169
path = "/home/mpaulson/.local/share/nvim/site/pack/packer/start/packer.nvim",
@@ -169,6 +179,11 @@ _G.packer_plugins = {
169179
path = "/home/mpaulson/.local/share/nvim/site/pack/packer/start/plenary.nvim",
170180
url = "https://github.com/nvim-lua/plenary.nvim"
171181
},
182+
["refactoring.nvim"] = {
183+
loaded = true,
184+
path = "/home/mpaulson/.local/share/nvim/site/pack/packer/start/refactoring.nvim",
185+
url = "https://github.com/theprimeagen/refactoring.nvim"
186+
},
172187
["rose-pine"] = {
173188
config = { "\27LJ\2\n9\0\0\3\0\3\0\0056\0\0\0009\0\1\0'\2\2\0B\0\2\1K\0\1\0\26colorscheme rose-pine\bcmd\bvim\0" },
174189
loaded = true,

0 commit comments

Comments
 (0)