Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ttak0422 committed Jul 20, 2024
1 parent cb60f4a commit 7843422
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 79 deletions.
13 changes: 13 additions & 0 deletions fnl/hook-leader.fnl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@
[:<Leader>ha
(lcmd "require('harpoon'):list():add()")
(desc "Register file")]
[:<Leader>fp
(cmd "Ddu -name=fd file_fd")
(desc "search by file name")]
[:<Leader>fP (cmd "Ddu -name=ghq ghq") (desc "search repo (ghq)")]
[:<Leader>fru
(cmd "Ddu -name=mru mru")
(desc "MRU (Most Recently Used files)")]
[:<Leader>frw
(cmd "Ddu -name=mrw mrw")
(desc "MRW (Most Recently Written files)")]
;; mark
[:<leader>mq (cmd :MarksQFListBuf) (desc "marks in current buffer")]
[:<leader>mQ (cmd :MarksQFListGlobal) (desc "marks in all buffer")]
Expand All @@ -30,6 +40,9 @@
(desc "Enter Neorg (today journal)")]
[:<Leader>no (cmd "Neorg toc") (desc "Show Neorg TOC")]
[:<Leader>N (cmd :Neorg) (desc "Enter Neorg")]
[:<Leader>fn
(cmd "Neorg keybind norg core.integrations.telescope.find_linkable")
(desc "find Neorg linkable")]
;; git
[:<Leader>G (cmd :Neogit) (desc "Neovim git client")]
;; filter
Expand Down
92 changes: 44 additions & 48 deletions fnl/prelude.fnl
Original file line number Diff line number Diff line change
@@ -1,62 +1,58 @@
;; options
(let [opts {;; 言語メニューを無効にする
:langmenu :none
;; shortmessオプションにsWIcCSを追加
:shortmess (.. vim.o.shortmess :sWIcCS)
;; コマンドラインの高さを0に設定
:cmdheight 0
;; guifg, guibgの有効化
:termguicolors true
;; モードを非表示
:showmode false
;; 起動時に行数を非表示表示
:number false
;; signcolumnを起動時に非表示
:signcolumn :no
;; tablineを起動時に非表示
:showtabline 0
;; statuslineを起動時に非表示
:laststatus 0
:foldlevel 99
:foldlevelstart 99}]
(vim.loader.enable)
(each [k v (pairs opts)]
(tset vim.o k v)))
(vim.loader.enable)
(each [k v (pairs {;; 言語メニューを無効にする
:langmenu :none
;; shortmessオプションにsWIcCSを追加
:shortmess (.. vim.o.shortmess :sWIcCS)
;; コマンドラインの高さを0に設定
:cmdheight 0
;; guifg, guibgの有効化
:termguicolors true
;; モードを非表示
:showmode false
;; 起動時に行数を非表示表示
:number false
;; signcolumnを起動時に非表示
:signcolumn :no
;; tablineを起動時に非表示
:showtabline 0
;; statuslineを起動時に非表示
:laststatus 0
:foldlevel 99
:foldlevelstart 99})]
(tset vim.o k v))

;; keymaps
(set vim.g.mapleader " ")
(set vim.g.maplocalleader ",")

(let [map vim.keymap.set
cmd (fn [c] (.. :<cmd> c :<cr>))
opts {:noremap true :silent true}
N [[:<leader> ":lua vim.cmd('doautocmd User TriggerLeader')<CR>"]
[";" ":"]
]
V [[";" ":"]
]]
;; normal mode keymaps
(each [_ K (ipairs N)]
(map :n (. K 1) (. K 2) (or (. K 3) opts)))
;; visual mode keymaps
(each [_ K (ipairs V)]
(map :v (. K 1) (. K 2) (or (. K 3) opts)))
(let [M vim.keymap.set
C (fn [c] (.. :<cmd> c :<cr>))
O {:noremap true :silent true}]
;; keymaps
(each [_ K (ipairs [[:n
:<leader>
":lua vim.cmd('doautocmd User TriggerLeader')<CR>"]
[:n ";" ":"]
[:v ";" ":"]])]
(M (. K 1) (. K 2) (. K 3) O))
;; term toggle keymaps
(for [i 0 9]
(map [:n :t :i] (.. :<C- i ">") (cmd (.. "TermToggle " i)) opts)))
(M [:n :t :i] (.. :<C- i ">") (C (.. "TermToggle " i)) O)))

;; user events
(var specificFileEnterAutoCmd nil)

;; SpecificFileEnter
(let [A vim.api
gen A.nvim_create_autocmd
exec A.nvim_exec_autocmds
del A.nvim_del_autocmd]
(let [A vim.api]
(set specificFileEnterAutoCmd
(gen :FileType
{:callback (fn []
(if (not= vim.bo.filetype "")
(do
(exec :User {:pattern :SpecificFileEnter})
(del specificFileEnterAutoCmd))))})))
(A.nvim_create_autocmd :FileType
{:callback (fn []
(if (let [F vim.bo.filetype]
(not (or (= F "")
(= F :prompt)
(= F :nofile))))
(do
(A.nvim_exec_autocmds :User
{:pattern :SpecificFileEnter})
(A.nvim_del_autocmd specificFileEnterAutoCmd))))})))
13 changes: 8 additions & 5 deletions full.nix
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ rec {
cmp
treesitter
telescope
dressing
];
postConfig = read ./lua/autogen/neorg.lua;
hooks = {
Expand Down Expand Up @@ -327,6 +328,11 @@ rec {
commands = [ "Glance" ];
};
};
dressing = {
package = dressing-nvim;
postConfig = read ./lua/autogen/dressing.lua;
depends = [ telescope ];
};
lsp = {
packages = [ nvim-lspconfig ];
depends = [
Expand All @@ -346,11 +352,7 @@ rec {
package = diagflow-nvim;
postConfig = read ./lua/autogen/diagflow.lua;
}
{
package = dressing-nvim;
postConfig = read ./lua/autogen/dressing.lua;
depends = [ telescope ];
}
dressing
cmp
telescope
{
Expand Down Expand Up @@ -1322,6 +1324,7 @@ rec {
};
ddu = {
packages = [
ddu-vim
ddu-ui-ff
ddu-ui-filter
ddu-source-file
Expand Down
2 changes: 1 addition & 1 deletion lua/autogen/hook-leader.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 19 additions & 25 deletions lua/autogen/prelude.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7843422

Please sign in to comment.