blob: 881cbbe99aac4243d6438f03f91da457e38b2d77 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
(vim.cmd "colorscheme kanagawa-wave")
(vim.cmd "filetype plugin on")
(vim.cmd "filetype indent on")
(vim.cmd "highlight WinSeparator guibg=None")
(vim.cmd "packadd cfilter")
(require :conf.settings)
(require :conf.pkgs)
(require :conf.lsp)
(require :conf.events)
(require :conf.filetype)
(require :conf.newtab)
(require :conf.nix-develop)
(require :conf.diagnostic)
;; TODO: make a function that sets this autocommand: au BufWritePost currentfile :!curl -X POST -d "{\"previewRun\": true, \"yamlOverride\": \"$(cat % | yq -P)\", \"resources\": {\"repositories\": {\"self\": {\"refName\": \"refs/heads/branch\"}}}}" -s -H "Content-Type: application/json" -H "Authorization: Basic $WORK_AZDO_GIT_AUTH" "$WORK_AZDO_GIT_ORG_URL/Stater/_apis/pipelines/pipelineid/preview?api-version=7.1-preview.1" | jq -r '.finalYaml // .' > scratch.yaml
(let [map vim.keymap.set]
(map :t :<c-s> "<c-\\><c-n>")
;; pausing and continueing printing output is not necessary inside neovim terminal right?
(map :t :<c-q> "<c-\\><c-n>:q<cr>")
(map :n :<leader>qo ":copen<cr>")
(map :n :<leader>qc ":cclose<cr>")
(map :n :<leader>lo ":lopen<cr>")
(map :n :<leader>lc ":lclose<cr>")
(map :n "[q" ":cprevious<cr>")
(map :n "]q" ":cnext<cr>")
(map :n "[x" ":lprevious<cr>")
(map :n "]x" ":lnext<cr>")
(map :n :<c-p> ":Telescope find_files<cr>")
(map :n "`<Backspace>" ":FocusDispatch ")
(map :n "`k" ":K9s ")
(map :n :<leader>p ":NewTab<cr>")
(map :n :<leader>cf ":tabedit ~/flake|tc ~/flake|G<cr><c-w>o")
(map :n :<leader>cn ":tabedit ~/neovim|tc ~/neovim|G<cr><c-w>o"))
(tset _G :P (lambda [...]
(let [inspected (icollect [_ v (ipairs [...])]
(vim.inspect v))]
(each [_ printer (ipairs inspected)]
(print printer)))))
(local git-worktree (require :git-worktree))
(git-worktree.setup {:change_directory_command :tcd
:update_on_change true
:autopush false})
(vim.keymap.set [:n] :<leader>w ":Worktree ")
(vim.api.nvim_create_user_command :Worktree
(fn [ctx]
(match ctx.fargs
[:create tree branch upstream] (git-worktree.create_worktree tree
branch
upstream)
[:create tree upstream] (git-worktree.create_worktree tree
tree
upstream)
[:create tree] (git-worktree.create_worktree tree
tree
:origin)
[:switch tree] (git-worktree.switch_worktree tree)
[:delete tree] (git-worktree.delete_worktree tree)
[tree] (git-worktree.switch_worktree tree)))
{:nargs "*"
:complete (fn [lead cmdline cursor]
(local cmds
[:create :switch :delete])
(if (accumulate [cmd-given false _ cmd (ipairs cmds)]
(or cmd-given
(string.find cmdline
cmd)))
[]
cmds))})
(vim.api.nvim_create_user_command :HomeManager
(fn [ctx]
(vim.cmd (.. ":Dispatch home-manager switch --impure "
(os.getenv :HOME) "/flake#"
(. ctx.fargs 1))))
{:nargs 1})
(vim.api.nvim_create_user_command :Gpush
(fn [ctx]
(vim.cmd ":Dispatch git push"))
{})
(vim.api.nvim_create_user_command :Grunt
(fn [ctx]
(match (. ctx.fargs 1)
:plan (vim.cmd (.. ":Dispatch "
(if ctx.bang
"TF_LOG=DEBUG "
"")
"terragrunt "
(table.concat ctx.fargs
" ")
" " :-out=gruntplan))
:apply (vim.cmd (.. ":Dispatch "
(if ctx.bang
"TF_LOG=DEBUG "
"")
"terragrunt "
(table.concat ctx.fargs
" ")
" " :gruntplan))
_ (vim.cmd (.. ":Start "
(if ctx.bang
"TF_LOG=DEBUG "
"")
"terragrunt "
(table.concat ctx.fargs
" ")))))
{:nargs "*" :bang true})
(vim.api.nvim_create_user_command :K9s
(fn [ctx]
(vim.cmd (.. ":Start k9s --context "
(. ctx.fargs 1))))
{:nargs 1})
|