Skip to content

Commit

Permalink
update some files
Browse files Browse the repository at this point in the history
  • Loading branch information
steelsojka committed Dec 17, 2021
1 parent 17e0250 commit 4c2e351
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 33 deletions.
1 change: 0 additions & 1 deletion .config/nvim/fnl/dotfiles/bootstrap.fnl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(module dotfiles.bootstrap
{require {core aniseed.core
nvim aniseed.nvim
util dotfiles.util}})

;; Load all modules in no particular order.
Expand Down
58 changes: 26 additions & 32 deletions .config/nvim/fnl/dotfiles/module/filetypes/dirvish.fnl
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
(module dotfiles.module.filetypes.dirvish
{require {nvim aniseed.nvim
fzf dotfiles.fzf
keymap dotfiles.keymap}})
{require {keymap dotfiles.keymap}})

(local telescope (require "telescope.builtin"))
(local actions (require "telescope.actions"))

(def- find-fzf (fzf.create "Dirvish"))

(defn- fzf-dir [starting]
(find-fzf.execute {:source (string.format "find \"%s\" -type d" starting)
:options ["--preview=ls la {}"]}))

(defn- create [input cmd expansion placeholder]
(let [filehead (nvim.fn.expand expansion)
name (nvim.fn.input input (if placeholder filehead ""))]
(when (~= name "")
(nvim.command (string.format cmd filehead name))
(nvim.input "R"))))
(let [filehead (vim.fn.expand expansion)]
(vim.ui.input
{:prompt input
:default (if placeholder filehead "")}
#(when (and $ (~= $ ""))
(vim.cmd (string.format cmd filehead $))
(vim.api.nvim_input "R")))))

(defn- find-files [cwd]
(telescope.find_files
Expand All @@ -30,41 +24,41 @@
true)}))

(fn []
(nvim.ex.setlocal "nospell")
(vim.cmd "setlocal nospell")
(keymap.init-buffer-mappings {:g {:name "+goto"}})
(keymap.register-buffer-mappings
{"n md" {:do #(create "Create directory: " "!mkdir %s/%s" "<cfile>:h")
:description "Make directory"}
"n mf" {:do #(create "Create file: " "!touch %s/%s" "<cfile>:h")
:description "Create file"}
"n mr" {:do #(let [filename (nvim.fn.expand "<cfile>:t")
filepath (nvim.fn.expand "<cfile>")
filehead (nvim.fn.expand "<cfile>:h")
new-name (nvim.fn.input "Rename file: " filename)]
(when (and (~= new-name "") (~= new-name filename))
(-> "!mv %s %s/%s"
(string.format filepath filehead new-name)
(nvim.command))
(nvim.input "R")))
"n mr" {:do #(let [filename (vim.fn.expand "<cfile>:t")
filepath (vim.fn.expand "<cfile>")
filehead (vim.fn.expand "<cfile>:h")]
(vim.ui.input
{:prompt "Rename file: "
:default filename}
#(when (and (~= $ "") (~= $ filename))
(-> "!mv %s %s/%s"
(string.format filepath filehead $)
(vim.cmd))
(vim.api.nvim_input "R"))))
:description "Rename"}
"n mm" {:do #(create "Move file to : " "!mv %s %s" "<cfile>" true)
:description "Move"}
"n mc" {:do #(create "Copy file to : " "!cp %s %s" "<cfile>" true)
:description "Copy"}
"n mk" {:do #(let [filepath (nvim.fn.expand "<cfile>")
"n mk" {:do #(let [filepath (vim.fn.expand "<cfile>")
confirmed (-> "Delete %s?"
(string.format filepath)
(nvim.fn.confirm))]
(vim.fn.confirm))]
(when (= confirmed 1)
(-> "!rm -r %s"
(string.format filepath)
(nvim.command))
(nvim.input "R")))
(vim.cmd))
(vim.api.nvim_input "R")))
:description "Delete"}
"n mgd" {:do #(-> (nvim.fn.expand "%:p:h") (fzf-dir)) :description "Child directory"}
"n mgD" {:do #(-> (nvim.fn.getcwd) (fzf-dir)) :description "Project directory"}
"n mgf" {:do #(-> {:cwd (nvim.fn.expand "%:p:h")} (telescope.find_files)) :description "Child file"}
"n mgF" {:do #(-> (nvim.fn.getcwd) (find-files)) :description "Project file"}
"n mgf" {:do #(-> {:cwd (vim.fn.expand "%:p:h")} (telescope.find_files)) :description "Child file"}
"n mgF" {:do #(-> (vim.fn.getcwd) (find-files)) :description "Project file"}
"nH" {:do "<Plug>(dirvish_up)"}
"n q" {:do "gq" :noremap false}
"n Q" {:do "gq" :noremap false}}))
Binary file modified lib/plantuml/plantuml.jar
Binary file not shown.

0 comments on commit 4c2e351

Please sign in to comment.