Skip to content

Commit

Permalink
update: lsp_conf.lua, hi.fnl, init.fnl, map.fnl, nmap.fnl, file.fnl, …
Browse files Browse the repository at this point in the history
…plugs.fnl, map.lua,
  • Loading branch information
Cassin01 committed Sep 9, 2024
1 parent d7f2e42 commit a429469
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 52 deletions.
7 changes: 6 additions & 1 deletion after_opt/lsp_conf.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,14 @@ local default_on_attach = function(client, bufnr)
vim.keymap.set("n", keys, func, { buffer = bufnr, desc = desc })
end
nmap('sd', vim.lsp.buf.definition, 'definition')
nmap('sr', require('telescope.builtin').lsp_references, 'references')
nmap('si', vim.lsp.buf.implementation, 'implementation')
nmap('sy', vim.lsp.buf.type_definition, 'type definition')
nmap('sK', vim.lsp.buf.hover, 'hover')
nmap('sD', vim.lsp.buf.declaration, 'declaration')
nmap('s<C-k>', vim.lsp.buf.signature_help, 'signature_help')
nmap('sa', vim.lsp.buf.code_action, 'code_action')
nmap('swl', function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, 'list_workspace_folders')
nmap('sr', require('telescope.builtin').lsp_references, 'references')
nmap('<Space>td', require('telescope.builtin').lsp_document_symbols, 'lsp document symbol')
nmap('<Space>tw', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'lsp workspace symbols')

Expand Down
2 changes: 1 addition & 1 deletion fnl/core/au/hi.fnl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
(add-hl :NonText {:underline true})
(add-hl :SpecialKey {:bg nil :italic true})
(when-let bg (get-hl :Normal :bg)
(add-hl :StatusLine {:fg bg})
(add-hl :StatusLine {:fg bg :bg bg})
(add-hl :StatusLineNC {:fg bg})
(add-hl :WinBar {:bg bg})
(add-hl :WinBarNC {:bg bg}))
Expand Down
98 changes: 57 additions & 41 deletions fnl/core/au/init.fnl
Original file line number Diff line number Diff line change
Expand Up @@ -51,34 +51,44 @@
(fn print-second [a b]
(print (vim.inspect b)))
(au! :match-hi :ColorScheme
(do
(when (= vim.g.colors_name "fluoromachine")
(vim.api.nvim_set_hl 0 :Comment (link :Comment {:fg (blightness (get-hl :Comment :fg) 1.6)}))
(vim.api.nvim_set_hl 0 :Folded (link :Folded {:bg (blightness (get-hl :Folded :bg) 0.5)
:fg (blightness (get-hl :Folded :fg) 1.5)})))
(each [_ k (ipairs
[;[:Tabs {:bg (blightness (get-hl :Normal :bg) 0.9)}]
[:TrailingSpaces {:bg :#FFa331}]
[:DoubleSpace {:bg :#cff082}]
[:TodoEx {:bg :#44a005 :fg :#F0FFF0}]
[:TSNote {:bg :#086788 :fg :#F0FFF0}]
[:FoldMark (link :Comment {})
; (do
; (local fg (get-hl :Comment :fg))
; (if (= nil fg)
; (link :Comment {})
; (link :comment (blightness fg 0.8))))
; (link :Comment {:fg (blightness (get-hl :Comment :fg) 0.8)})
]
[:CommentHead (link :Comment {:fg :#727ca7})]
[:VertSplit (link :LineNr {})]
[:WinSeparator (link :LineNr {})]
[:StatusLine (link :NonText {})]
; [:StatusLine (link :NonText {:fg (get-hl :StatusLine :fg)})]
; [:BufferLineFill (link :NonText {:fg (get-hl :BufferLineFill :fg)})]
; [:BufferLineBackground (link :bufferLineBackground (get-hl :BufferLineInfoVisible :bg))]
])]
(vim.api.nvim_set_hl 0 (unpack k)))))
(let [{: lazy} (require :kaza.cmd)]
(lazy
1000
(lambda []
(do
(when (= vim.g.colors_name "fluoromachine")
(vim.api.nvim_set_hl 0 :Comment (link :Comment {:fg (blightness (get-hl :Comment :fg) 1.6)}))
(vim.api.nvim_set_hl 0 :Folded (link :Folded {:bg (blightness (get-hl :Folded :bg) 0.5)
:fg (blightness (get-hl :Folded :fg) 1.5)})))
(each [_ k (ipairs
[;[:Tabs {:bg (blightness (get-hl :Normal :bg) 0.9)}]
[:TrailingSpaces {:bg :#FFa331}]
[:DoubleSpace {:bg :#cff082}]
[:TodoEx {:bg :#44a005 :fg :#F0FFF0}]
[:TSNote {:bg :#086788 :fg :#F0FFF0}]
[:FoldMark (link :Comment {})
; (do
; (local fg (get-hl :Comment :fg))
; (if (= nil fg)
; (link :Comment {})
; (link :comment (blightness fg 0.8))))
; (link :Comment {:fg (blightness (get-hl :Comment :fg) 0.8)})
]
[:CommentHead (link :Comment {:fg :#727ca7})]
[:VertSplit (link :LineNr {})]
[:WinSeparator (link :LineNr {})]
; [:StatusLine (link :NonText {:bg (get-hl :Normal :bg)})]
; [:StatusLine (link :NonText {:fg (get-hl :StatusLine :fg)})]
; [:BufferLineFill (link :NonText {:fg (get-hl :BufferLineFill :fg)})]
; [:BufferLineBackground (link :bufferLineBackground (get-hl :BufferLineInfoVisible :bg))]
])]
(vim.api.nvim_set_hl 0 (unpack k))))))))
; (au! :mmatch [:BufWinEnter :ColorScheme :ColorSchemePre]
; (let [{: lazy} (require :kaza.cmd)]
; (lazy
; 1000
; (lambda []
; ((. (require :core.au.match) :add-matches))))))
(au! :mmatch [:BufWinEnter] ((. (require :core.au.match) :add-matches)))

;; terminal mode
Expand Down Expand Up @@ -154,8 +164,14 @@
(create_autocmd
[:BufRead :BufNewFile]
{:callback (λ []
(buf_set_option 0 :commentstring "// %s")
(win_set_option 0 :foldmethod :indent)
(vim.api.nvim_buf_set_option 0 :commentstring "// %s")
(vim.api.nvim_win_set_option 0 :foldmethod :indent)
(let [bn (vim.fn.line :$)
wn (vim.fn.winheight 0)]
(vim.notify bn)
(vim.notify wn)
(when (< bn (* wn 2))
(vim.api.nvim_win_set_option 0 :foldenable false)))
(buf_set_keymap 0
:i
:/*
Expand Down Expand Up @@ -320,14 +336,14 @@


;; bufferline
(au! :reload-devicon
; [:BufWinEnter :BufWinLeave :BufReadPost]
; [:BufWinEnter :TabEnter :WinEnter]
[:BufEnter :BufLeave :WinEnter :WinLeave :TabEnter :TabLeave :BufWinEnter :BufWinLeave :BufReadPost :BufReadPre]
(do
(when-let fg (get-hl :Comment :fg)
(local cs (vim.api.nvim_get_hl 0 {}))
(each [hi-name _ (pairs cs)]
(when (not= (hi-name:match "^BufferLineDevIcon.*Inactive$") nil)
(vim.cmd (.. "hi " hi-name " guifg=" fg))))))
{})
; (au! :reload-devicon
; ; [:BufWinEnter :BufWinLeave :BufReadPost]
; ; [:BufWinEnter :TabEnter :WinEnter]
; [:BufEnter :BufLeave :WinEnter :WinLeave :TabEnter :TabLeave :BufWinEnter :BufWinLeave :BufReadPost :BufReadPre]
; (do
; (when-let fg (get-hl :Comment :fg)
; (local cs (vim.api.nvim_get_hl 0 {}))
; (each [hi-name _ (pairs cs)]
; (when (not= (hi-name:match "^BufferLineDevIcon.*Inactive$") nil)
; (vim.cmd (.. "hi " hi-name " guifg=" fg))))))
; {})
1 change: 1 addition & 0 deletions fnl/core/map/map.fnl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
[:n :U :<C-r> "redo"]
[:n :<space><c-i> "<cmd>echo 'c-i'<cr>" "for test"]
[:n :<space><c-u> "<cmd> echom 'c-u'<cr>" "c-u for test"]
[:n :<F7> "<cmd>!make<cr>" "make"]
; [:n :<c-s> inc-search "incremental search"]

[[:n :v] :sh :0 "line start"]
Expand Down
16 changes: 14 additions & 2 deletions fnl/core/map/nmap.fnl
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,21 @@
(vim.api.nvim_open_win buf true {:relative :editor :style :minimal :row 3 :col 3 :height 40 :width 150}))) "show message"]
[:em (la (let [width 27
height 30
buf (vim.api.nvim_create_buf false true)]
buf
; (if false
(let [nvim-cache (. (require :kaza.file) :nvim-cache)
dpath (.. (nvim-cache) :/my)
fpath (.. dpath :/memo.org)]
; (print fpath)
; (when (not (vf.isdirectory dpath))
; (os.execute (.. "mkdir " dpath)))
; (when (not (vf.filewritable fpath))
; (os.excute (.. "touch " fpath)))
(vf.bufadd fpath))
; (vim.api.nvim_create_buf false true)
]
(vim.api.nvim_buf_set_option buf :filetype :org)
(vim.api.nvim_buf_set_lines buf 0 height false ["Note"])
; (vim.api.nvim_buf_set_lines buf 0 height false ["MEMO"])
(vim.api.nvim_open_win buf true {:relative :editor
:style :minimal
:border :rounded
Expand Down
5 changes: 5 additions & 0 deletions fnl/kaza/file.fnl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
(local cmd "echo expand(\"$HOME/.config/nvim\")")
(vim.api.nvim_exec cmd true))

;;; get `~/.cache/nvim`
(fn M.nvim-cache []
(local cmd "echo expand(\"$HOME/.cache/nvim\")")
(vim.api.nvim_exec cmd true))

;;; read_all
(fn M.read_file [path]
(local (file msg) (io.open path "rb"))
Expand Down
29 changes: 24 additions & 5 deletions fnl/plugs.fnl
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
{1 :stevearc/oil.nvim
:config (la
(ref-f :setup :oil {:win_options {:signcolumn :yes:2}})
(map :n :<F3> (cmd :Oil) "open oil")
(nmaps
:<Space>oi
:oil
Expand Down Expand Up @@ -308,10 +309,10 @@
(bufferline bg))))
(lazy 1000 set-hl "^BufferLine.*$")
(let [g (vim.api.nvim_create_augroup :bufferline-overwrite-devicon {:clear true})]
(au!
(au!
g
[:TabNew]
(set-hl "^BufferLineDevIcon.*$"))))}
[:WinEnter]
(lazy 1000 set-hl "^BufferLineDevIcon.*$"))))}

{1 :sheerun/vim-polyglot}
{1 :David-Kunz/markid}
Expand All @@ -334,7 +335,7 @@
:auto_install true
:ignore_install [ "javascript" ]
:highlight {:enable true
:disable [ "c" "rust" "org" "vim" "tex"]
:disable [ "c" "rust" "org" "vim" "tex" "typescript"]
:additional_vim_regex_highlighting ["org"]}
:rainbow {:enable true
:extended_mode true
Expand Down Expand Up @@ -1059,7 +1060,7 @@

; {1 :uki00a/denops-pomodoro.vim}
; {1 :skanehira/denops-docker.vim}
{1 :epwalsh/pomo.nvim
{1 :epwalsh/pomo.nvim
:cmd ["TimerStart" "TimerRepeat"]
:lazy true
:init (λ [] (ref-f :setup :pomo {}))
Expand Down Expand Up @@ -1129,6 +1130,24 @@
{1 :rust-lang/rust.vim
:event ["User plug-lazy-load"]}

;; go
{1 :ray-x/go.nvim
:dependencies ["ray-x/guihua.lua"
"neovim/nvim-lspconfig"
"nvim-treesitter/nvim-treesitter"
]
:config (la (ref-f :setup :go {})
(let [g (vim.api.nvim_create_augroup :GoFormat {:clear true})]
(au!
g
[:BufWritePre]
(ref-f :goimports :go.format)
{:pattern :*.go})))
:event ["CmdlineEnter"]
:ft [:go :gomod]
:build ":lua require(\"go.install\").update_all_sync()"
}

;; tex
{1 :https://github.com/lervag/vimtex
:config (λ []
Expand Down
8 changes: 6 additions & 2 deletions lua/map.lua
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,15 @@ table.insert(
{
prefix = "c;",
ret = function()
local header = string.format(vim.opt_local.commentstring["_value"], " {{{ ")
local footer = string.format(vim.opt_local.commentstring["_value"], " }}} ")
local header = string.format(vim.opt_local.commentstring["_value"], " {{{")
local footer = string.format(vim.opt_local.commentstring["_value"], " }}}")
return header .. footer .. string.rep("<Left>", string.len(footer)) .. "<CR><ESC>O" .. string.rep("<Space>", vim.bo.shiftwidth)
end
},
{
prefix = "cc;",
ret = "{{{"
},
})
)
table.insert(
Expand Down

0 comments on commit a429469

Please sign in to comment.