summaryrefslogtreecommitdiff
path: root/fnl/conf/init.fnl
blob: b548d046ece686f8862a2148201a0d4e8c0e26ab (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
(vim.cmd "colorscheme kanagawa-wave")
(vim.cmd "filetype plugin on")
(vim.cmd "filetype indent on")
(vim.cmd "highlight WinSeparator guibg=None")

(require :conf.settings)
(require :conf.pkgs)
(require :conf.lsp)
(require :conf.events)
(require :conf.newtab)
(require :conf.nix-develop)

;; (require :conf.cmd)

(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>")
  (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 "))

(tset _G :P (lambda [...]
              (let [inspected (icollect [_ v (ipairs [...])]
                                (vim.inspect v))]
                (each [_ printer (ipairs inspected)]
                  (print printer)))))

(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"))
                                  {})