mirror of
https://github.com/elkowar/dots-of-war.git
synced 2024-11-06 03:12:24 +00:00
Merge branch 'nvim-lsp' of /home/leon/terminal-dotfiles
This commit is contained in:
commit
9c6904d5f6
11 changed files with 866 additions and 0 deletions
12
.netrwhist
Normal file
12
.netrwhist
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
let g:netrw_dirhistmax =10
|
||||||
|
let g:netrw_dirhistcnt =8
|
||||||
|
let g:netrw_dirhist_8='/home/leon/coding/projects/trup-rs/src/commands'
|
||||||
|
let g:netrw_dirhist_7='/home/leon/coding/projects/trup-rs/src/features/ban'
|
||||||
|
let g:netrw_dirhist_6='/home/leon/coding/projects/trup-rs/migrations'
|
||||||
|
let g:netrw_dirhist_5='/home/leon/coding/projects/trup-rs/.git'
|
||||||
|
let g:netrw_dirhist_4='/home/leon/a-box-of-gruv/styles'
|
||||||
|
let g:netrw_dirhist_3='/home/leon/tmp/pythonshit'
|
||||||
|
let g:netrw_dirhist_2='/home/leon/dotfiles/.vim'
|
||||||
|
let g:netrw_dirhist_1='/home/leon/.config/discord'
|
||||||
|
let g:netrw_dirhist_0='/home/leon/coding/projects/eww/src'
|
||||||
|
let g:netrw_dirhist_9='/home/leon/.config/polybar'
|
1
nvim/coc-settings.json
Symbolic link
1
nvim/coc-settings.json
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../.vim/coc-settings.json
|
62
nvim/fnl/init.fnl
Normal file
62
nvim/fnl/init.fnl
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
(module init
|
||||||
|
{require {a aniseed.core
|
||||||
|
fennel aniseed.fennel
|
||||||
|
nvim aniseed.nvim
|
||||||
|
kb keybinds
|
||||||
|
utils utils}
|
||||||
|
require-macros [macros]})
|
||||||
|
|
||||||
|
(require "plugins.telescope")
|
||||||
|
(require "plugins.lsp")
|
||||||
|
(require "plugins.galaxyline")
|
||||||
|
|
||||||
|
|
||||||
|
(global pp
|
||||||
|
(fn [x]
|
||||||
|
(print (fennel.view x))))
|
||||||
|
|
||||||
|
;(set nvim.g.conjure#client#fennel#aniseed#aniseed_module_prefix "aniseed.")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(local colors (utils.colors))
|
||||||
|
(local bufferline (require "bufferline"))
|
||||||
|
|
||||||
|
; :h bufferline-lua-highlights
|
||||||
|
(let [selected { :guibg colors.neutral_aqua :guifg colors.dark0 :gui ""}
|
||||||
|
visible { :guibg colors.dark1 :guifg colors.neutral_aqua :gui ""}]
|
||||||
|
(bufferline.setup
|
||||||
|
{ :options
|
||||||
|
{ :diagnostics "nvim_lsp"
|
||||||
|
:diagnostics_indicator (fn [cnt lvl diagnostics-dict] (.. " (" cnt ")"))
|
||||||
|
:show_buffer_close_icons false
|
||||||
|
:show_close_icon false
|
||||||
|
:show_tab_indicators false
|
||||||
|
:enforce_regular_tabs false
|
||||||
|
:tab_size 10}
|
||||||
|
|
||||||
|
:highlights
|
||||||
|
{ :fill { :guibg colors.dark0 :guifg colors.light0}
|
||||||
|
:background visible
|
||||||
|
:buffer_visible visible
|
||||||
|
:buffer_selected selected
|
||||||
|
:modified visible
|
||||||
|
:modified_visible visible
|
||||||
|
:modified_selected selected
|
||||||
|
:error visible
|
||||||
|
:error_selected selected
|
||||||
|
:error_visible visible
|
||||||
|
:warning visible
|
||||||
|
:warning_selected selected
|
||||||
|
:warning_visible visible
|
||||||
|
:separator visible
|
||||||
|
:indicator_selected {:guibg colors.neutral_aqua :guifg colors.neutral_aqua}
|
||||||
|
|
||||||
|
; stuff I've never seen before :thonk:
|
||||||
|
:pick_selected {:guibg colors.bright_red :guifg colors.bright_red}
|
||||||
|
:tab_selected {:guibg colors.bright_green :guifg colors.bright_green}
|
||||||
|
:tab {:guibg colors.bright_yellow :guifg colors.bright_yellow}}}))
|
||||||
|
|
||||||
|
|
||||||
|
(utils.highlight :BufferLineInfoSelected { :bg colors.neutral_aqua :fg colors.dark0 :gui "NONE"})
|
||||||
|
|
82
nvim/fnl/keybinds.fnl
Normal file
82
nvim/fnl/keybinds.fnl
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
(module keybinds
|
||||||
|
{require {a aniseed.core
|
||||||
|
nvim aniseed.nvim
|
||||||
|
utils utils
|
||||||
|
fennel aniseed.fennel}
|
||||||
|
require-macros [macros]})
|
||||||
|
|
||||||
|
|
||||||
|
(utils.noremap :n :<leader> ":<c-u>WhichKey '<Space>'<CR>")
|
||||||
|
(utils.noremap :v :<leader> ":<c-u>WhichKeyVisual '<Space>'<CR>")
|
||||||
|
|
||||||
|
;(utils.mapexpr :i :<CR> "compe#confirm(lexima#expand('<LT>CR>', 'i'))")
|
||||||
|
|
||||||
|
(utils.mapexpr :i :<C-Space> "compe#complete()")
|
||||||
|
(utils.mapexpr :i :<esc> "compe#close('<esc>')")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(fn le [s] (.. ":call luaeval(\"" s "\")"))
|
||||||
|
|
||||||
|
(set nvim.g.which_key_map {})
|
||||||
|
(nvim.command "call which_key#register('<Space>', \"g:which_key_map\")")
|
||||||
|
|
||||||
|
(set nvim.g.which_key_map
|
||||||
|
{ "h" [ ":bprevious" "previous buffer"]
|
||||||
|
"l" [ ":bnext" "next buffer"]
|
||||||
|
"f" "which_key_ignore"
|
||||||
|
"s" "which_key_ignore"
|
||||||
|
"o" [":Telescope live_grep" "Grep files"]
|
||||||
|
"p" [":Telescope file_browser" "Open file-browser"]
|
||||||
|
"[" ["<Plug>(YoinkPostPasteSwapBack)" "Swap last paste backwards"]
|
||||||
|
"]" ["<Plug>(YoinkPostPasteSwapForward)" "Swap last paste backwards"]
|
||||||
|
":" [":Commands" "Search command with fzf"]
|
||||||
|
"c" { :name "+comment_out"}
|
||||||
|
"e" { :name "+emmet"}
|
||||||
|
|
||||||
|
"z" { :name "+folds"
|
||||||
|
"c" ["foldclose" "close fold"]
|
||||||
|
"o" ["foldopen" "open fold"]}
|
||||||
|
|
||||||
|
"m" { :name "+Code-actions"
|
||||||
|
"d" [ ":Lspsaga hover_doc" "show documentation"]
|
||||||
|
"b" [ ":Lspsaga lsp_finder" "find stuff"]
|
||||||
|
"x" [ ":Lspsaga preview_definition" "Preview definition"]
|
||||||
|
"o" [ ":Telescope lsp_document_symbols" "symbols in document"]
|
||||||
|
"s" [ ":Telescope lsp_workspace_symbols" "symbols in workspace"]
|
||||||
|
"t" [ ":Lspsaga signature_help" "Show signature help"]
|
||||||
|
"n" [ ":Lspsaga rename" "rename"]
|
||||||
|
"v" [ ":Lspsaga code_action" "apply codeaction"]
|
||||||
|
"a" [ ":Lspsaga show_cursor_diagnostics" "Cursor diagnostics"]
|
||||||
|
"A" [ ":Lspsaga show_line_diagnostics" "Line diagnostics"]
|
||||||
|
"E" [ ":Telescope lsp_workspace_diagnostics" "List diagnostics"]
|
||||||
|
"e" [ (le "vim.lsp.diagnostic.goto_next()") "Jump to the next error"]
|
||||||
|
"g" [ (le "vim.lsp.buf.definition()") "go to definition"]
|
||||||
|
"i" [ (le "vim.lsp.buf.implementation()") "show implementation"]
|
||||||
|
;"r" [ (le "vim.lsp.buf.references()") "show references"]
|
||||||
|
"r" [ ":Telescope lsp_references" "show references"]
|
||||||
|
"f" [ (le "vim.lsp.buf.formatting()") "format file"]}
|
||||||
|
|
||||||
|
|
||||||
|
"f" { :name "+folds"
|
||||||
|
"o" [ ":foldopen" "open fold"]
|
||||||
|
"n" [ ":foldclose" "close fold"]
|
||||||
|
"j" [ "zj" "jump to next fold"]
|
||||||
|
"k" [ "zk" "jump to previous fold"]}
|
||||||
|
|
||||||
|
"v" { :name "+view-and-layout"
|
||||||
|
"n" [":set relativenumber!" "toggle relative numbers"]
|
||||||
|
"m" [":set nonumber! norelativenumber" "toggle numbers"]
|
||||||
|
"g" [":Goyo | set linebreak" "toggle focus mode"]
|
||||||
|
"i" [":IndentGuidesToggle" "toggle indent guides"]}
|
||||||
|
|
||||||
|
"b" { :name "+buffers"
|
||||||
|
"b" [":Buffers" "select open buffer"]
|
||||||
|
"c" [":bdelete!" "close open buffer"]
|
||||||
|
"w" [":bwipeout!" "wipeout open buffer"]}})
|
||||||
|
|
||||||
|
(set nvim.o.timeoutlen 200)
|
||||||
|
|
||||||
|
(nvim.command
|
||||||
|
"autocmd! VimEnter * :unmap <space>ig
|
||||||
|
autocmd! FileType which_key")
|
19
nvim/fnl/macros.fnl
Normal file
19
nvim/fnl/macros.fnl
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{:augroup
|
||||||
|
(fn [name ...]
|
||||||
|
`(do
|
||||||
|
(nvim.ex.augroup ,(tostring name))
|
||||||
|
(nvim.ex.autocmd_)
|
||||||
|
,...
|
||||||
|
(nvim.ex.augroup :END)))
|
||||||
|
|
||||||
|
:autocmd
|
||||||
|
(fn [...]
|
||||||
|
`(nvim.ex.autocmd ,...))
|
||||||
|
|
||||||
|
:_:
|
||||||
|
(fn [name ...]
|
||||||
|
`((. nvim.ex ,(tostring name)) ,...))
|
||||||
|
|
||||||
|
:viml->fn
|
||||||
|
(fn [name]
|
||||||
|
`(.. "lua require('" *module-name* "')['" ,(tostring name) "']()"))}
|
109
nvim/fnl/plugins/galaxyline.fnl
Normal file
109
nvim/fnl/plugins/galaxyline.fnl
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
(module plugins.galaxyline
|
||||||
|
{require {a aniseed.core
|
||||||
|
fennel aniseed.fennel
|
||||||
|
nvim aniseed.nvim
|
||||||
|
utils utils
|
||||||
|
|
||||||
|
galaxyline galaxyline
|
||||||
|
gl-condition galaxyline.condition
|
||||||
|
gl-fileinfo galaxyline.provider_fileinfo
|
||||||
|
gl-diagnostic galaxyline.provider_diagnostic
|
||||||
|
gl-vcs galaxyline.provider_vcs}
|
||||||
|
|
||||||
|
require-macros [macros]})
|
||||||
|
|
||||||
|
(local colors (utils.colors))
|
||||||
|
|
||||||
|
(local modes
|
||||||
|
{ :n { :text "NORMAL" :colors { :bg colors.neutral_aqua :fg colors.dark0}}
|
||||||
|
:i { :text "INSERT" :colors { :bg colors.neutral_yellow :fg colors.dark0}}
|
||||||
|
:c { :text "CMD" :colors { :bg colors.neutral_aqua :fg colors.dark0}}
|
||||||
|
:ce { :text "NORMEX" :colors { :bg colors.neutral_aqua :fg colors.dark0}}
|
||||||
|
:cv { :text "EX" :colors { :bg colors.neutral_aqua :fg colors.dark0}}
|
||||||
|
:ic { :text "INSCOMP" :colors { :bg colors.neutral_aqua :fg colors.dark0}}
|
||||||
|
:no { :text "OP-PENDING" :colors { :bg colors.neutral_aqua :fg colors.dark0}}
|
||||||
|
:r { :text "HIT-ENTER" :colors { :bg colors.neutral_aqua :fg colors.dark0}}
|
||||||
|
:r? { :text "CONFIRM" :colors { :bg colors.neutral_aqua :fg colors.dark0}}
|
||||||
|
:R { :text "REPLACE" :colors { :bg colors.neutral_aqua :fg colors.dark0}}
|
||||||
|
:Rv { :text "VIRTUAL" :colors { :bg colors.neutral_aqua :fg colors.dark0}}
|
||||||
|
:s { :text "SELECT" :colors { :bg colors.neutral_aqua :fg colors.dark0}}
|
||||||
|
:S { :text "SELECT" :colors { :bg colors.neutral_aqua :fg colors.dark0}}
|
||||||
|
:t { :text "TERM" :colors { :bg colors.neutral_aqua :fg colors.dark0}}
|
||||||
|
:v { :text "VISUAL" :colors { :bg colors.neutral_blue :fg colors.dark0}}
|
||||||
|
:V { :text "VISUAL LINE" :colors { :bg colors.neutral_blue :fg colors.dark0}}
|
||||||
|
"" { :text "VISUAL BLOCK" :colors { :bg colors.neutral_blue :fg colors.dark0}}})
|
||||||
|
|
||||||
|
|
||||||
|
(fn buf-empty? []
|
||||||
|
(= 1 (nvim.fn.empty (nvim.fn.expand "%:t"))))
|
||||||
|
|
||||||
|
(fn get-current-file-name []
|
||||||
|
(let [file (nvim.fn.expand "%:t")]
|
||||||
|
(if
|
||||||
|
(= 1 (nvim.fn.empty file)) ""
|
||||||
|
nvim.bo.readonly (.. "RO " file)
|
||||||
|
(and nvim.bo.modifiable nvim.bo.modified) (.. file " ")
|
||||||
|
file)))
|
||||||
|
|
||||||
|
(fn get-mode-data []
|
||||||
|
(or (. modes (nvim.fn.mode))
|
||||||
|
{ :text (nvim.fn.mode)
|
||||||
|
:colors {:bg colors.neutral_orange :fg colors.dark0}}))
|
||||||
|
|
||||||
|
(fn vim-mode-provider []
|
||||||
|
(let [modedata (get-mode-data)]
|
||||||
|
(utils.highlight "GalaxyViMode" modedata.colors)
|
||||||
|
(.. " " modedata.text " ")))
|
||||||
|
|
||||||
|
|
||||||
|
(utils.highlight "StatusLine" {:bg colors.dark1 :fg colors.light0 })
|
||||||
|
(set galaxyline.short_line_list ["dbui" "diff" "peekaboo" "undotree" "vista" "vista_markdown"])
|
||||||
|
|
||||||
|
|
||||||
|
(set galaxyline.section.left
|
||||||
|
[ { :ViMode { :provider vim-mode-provider}}
|
||||||
|
{ :FileName { :provider get-current-file-name
|
||||||
|
:highlight [colors.light4 colors.dark1]}}
|
||||||
|
{ :Space { :provider (fn [] "")
|
||||||
|
:highlight [colors.light0 colors.dark1]}}])
|
||||||
|
|
||||||
|
(fn make-lsp-diagnostic-provider [kind]
|
||||||
|
(fn []
|
||||||
|
(let [n (vim.lsp.diagnostic.get_count 0 kind)]
|
||||||
|
(if (= n 0) "" (.. " " n " ")))))
|
||||||
|
|
||||||
|
(fn git-branch-provider []
|
||||||
|
(let [branch (gl-vcs.get_git_branch)]
|
||||||
|
(if (= "master" branch) "" branch)))
|
||||||
|
|
||||||
|
(set galaxyline.section.right
|
||||||
|
[ { :GitBranch { :provider git-branch-provider
|
||||||
|
:highlight [colors.light4 colors.dark1]}}
|
||||||
|
{ :FileType { :provider (fn [] nvim.bo.filetype)
|
||||||
|
:highlight [colors.neutral_aqua colors.dark1]}}
|
||||||
|
|
||||||
|
{ :DiagnosticInfo { :provider (make-lsp-diagnostic-provider "Info")
|
||||||
|
:highlight [colors.dark1 colors.neutral_blue]}}
|
||||||
|
{ :DiagnosticWarn { :provider (make-lsp-diagnostic-provider "Warning")
|
||||||
|
:highlight [colors.dark1 colors.neutral_yellow]
|
||||||
|
:separator ""}}
|
||||||
|
{ :DiagnosticError { :provider (make-lsp-diagnostic-provider "Error")
|
||||||
|
:highlight [colors.dark1 colors.bright_red]
|
||||||
|
:separator ""}}
|
||||||
|
{ :LineInfo { :provider (fn [] (.. " " (gl-fileinfo.line_column) " "))
|
||||||
|
:highlight "GalaxyViMode"
|
||||||
|
:separator ""}}])
|
||||||
|
|
||||||
|
(do
|
||||||
|
(fn add-segment-defaults [data]
|
||||||
|
(a.merge { :highlight [colors.light0 colors.dark1]
|
||||||
|
:separator " "
|
||||||
|
:separator_highlight "StatusLine"}
|
||||||
|
data))
|
||||||
|
|
||||||
|
(fn map-gl-section [f section]
|
||||||
|
(icollect [_ elem (ipairs section)]
|
||||||
|
(collect [k v (pairs elem)] (values k (f v)))))
|
||||||
|
|
||||||
|
(set galaxyline.section.left (map-gl-section add-segment-defaults galaxyline.section.left))
|
||||||
|
(set galaxyline.section.right (map-gl-section add-segment-defaults galaxyline.section.right)))
|
107
nvim/fnl/plugins/lsp.fnl
Normal file
107
nvim/fnl/plugins/lsp.fnl
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
(module plugins.lsp
|
||||||
|
{require {a aniseed.core
|
||||||
|
fennel aniseed.fennel
|
||||||
|
nvim aniseed.nvim
|
||||||
|
lsp lspconfig
|
||||||
|
lsp-configs lspconfig.configs
|
||||||
|
saga lspsaga
|
||||||
|
utils utils
|
||||||
|
compe compe}
|
||||||
|
|
||||||
|
|
||||||
|
require-macros [macros]})
|
||||||
|
|
||||||
|
|
||||||
|
(fn on_attach [client bufnr]
|
||||||
|
(if client.resolved_capabilities.document_highlight
|
||||||
|
(do
|
||||||
|
(utils.highlight "LspReferenceRead" {:gui "underline"})
|
||||||
|
(utils.highlight "LspReferenceText" {:gui "underline"})
|
||||||
|
(utils.highlight "LspReferenceWrite" {:gui "underline"})
|
||||||
|
(vim.api.nvim_exec
|
||||||
|
"augroup lsp_document_highlight
|
||||||
|
autocmd! * <buffer>
|
||||||
|
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
|
||||||
|
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
|
||||||
|
augroup END"
|
||||||
|
false))))
|
||||||
|
|
||||||
|
|
||||||
|
(fn better_root_pattern [patterns except-patterns]
|
||||||
|
"match path if one of the given patterns is matched, EXCEPT if one of the except-patterns is matched"
|
||||||
|
(fn [path]
|
||||||
|
(when (not ((lsp.util.root_pattern except-patterns) path))
|
||||||
|
((lsp.util.root_pattern patterns) path))))
|
||||||
|
|
||||||
|
|
||||||
|
(local capabilities (vim.lsp.protocol.make_client_capabilities))
|
||||||
|
(set capabilities.textDocument.completion.completionItem.snippetSupport true)
|
||||||
|
(set capabilities.textDocument.completion.completionItem.resolveSupport
|
||||||
|
{ :properties ["documentation" "detail" "additionalTextEdits"]})
|
||||||
|
|
||||||
|
(fn init-lsp [lsp-name ?opts]
|
||||||
|
"initialize a language server with defaults"
|
||||||
|
(let [merged-opts {:on_attach on_attach}]
|
||||||
|
(each [k v (pairs (or opts {}))]
|
||||||
|
(tset merged-opts k v))
|
||||||
|
((. lsp lsp-name :setup) merged-opts)))
|
||||||
|
|
||||||
|
|
||||||
|
(init-lsp :rust_analyzer { :capabilities capabilities})
|
||||||
|
(init-lsp :tsserver { :root_dir (lsp.util.root_pattern "package.json")})
|
||||||
|
(init-lsp :jsonls { :commands { :Format [ #(vim.lsp.buf.range_formatting [] [0 0] [(vim.fn.line "$") 0])]}})
|
||||||
|
(init-lsp :denols { :root_dir (better_root_pattern [".git"] ["package.json"])})
|
||||||
|
(init-lsp :hls { :settings { :languageServerHaskell { :formattingProvider "stylish-haskell"}}})
|
||||||
|
(init-lsp :vimls)
|
||||||
|
(init-lsp :bashls)
|
||||||
|
(init-lsp :erlangls)
|
||||||
|
(init-lsp :yamlls)
|
||||||
|
(init-lsp :html)
|
||||||
|
(init-lsp :cssls)
|
||||||
|
|
||||||
|
|
||||||
|
;(lsp.vimls.setup { :on_attach on_attach})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(compe.setup
|
||||||
|
{ :enabled true
|
||||||
|
:autocomplete false
|
||||||
|
:debug false
|
||||||
|
:min_length 1
|
||||||
|
:preselect "enable"
|
||||||
|
:throttle_time 80
|
||||||
|
:source_timeout 200
|
||||||
|
:incomplete_delay 400
|
||||||
|
:max_abbr_width 100
|
||||||
|
:max_kind_width 100
|
||||||
|
:max_menu_width 100
|
||||||
|
:documentation true
|
||||||
|
:source { :path true
|
||||||
|
:buffer true
|
||||||
|
:calc true
|
||||||
|
:nvim_lsp true
|
||||||
|
:nvim_lua true
|
||||||
|
:vsnip false}})
|
||||||
|
|
||||||
|
|
||||||
|
(saga.init_lsp_saga
|
||||||
|
{ :border_style 1
|
||||||
|
:code_action_keys { :quit "<esc>" :exec "<CR>"}
|
||||||
|
:rename_action_keys { :quit "<esc>" :exec "<CR>"}
|
||||||
|
:finder_action_keys { :quit "<esc>"
|
||||||
|
:open "<CR>"
|
||||||
|
:vsplit "v"
|
||||||
|
:split "b"
|
||||||
|
:scroll_up "<C-u>"
|
||||||
|
:scroll_down "<C-d>"}})
|
||||||
|
|
||||||
|
|
||||||
|
(utils.highlight "LspSagaCodeActionTitle" {:fg "#8ec07c"})
|
||||||
|
(utils.highlight "LspSagaBorderTitle" {:fg "#8ec07c"})
|
||||||
|
(utils.highlight "LspSagaCodeActionContent" {:fg "#8ec07c"})
|
||||||
|
(utils.highlight "LspSagaFinderSelection" {:fg "#8ec07c"})
|
||||||
|
(utils.highlight "LspSagaDiagnosticHeader" {:fg "#8ec07c"})
|
||||||
|
(utils.highlight "TargetWord" {:fg "#8ec07c"})
|
||||||
|
|
||||||
|
(set nvim.o.signcolumn "yes")
|
18
nvim/fnl/plugins/telescope.fnl
Normal file
18
nvim/fnl/plugins/telescope.fnl
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
(module plugins.telescope
|
||||||
|
{require {a aniseed.core
|
||||||
|
fennel aniseed.fennel
|
||||||
|
nvim aniseed.nvim
|
||||||
|
utils utils
|
||||||
|
|
||||||
|
telescope telescope
|
||||||
|
actions telescope.actions}})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(telescope.setup
|
||||||
|
{:defaults
|
||||||
|
{:i { "<esc>" actions.close}}})
|
||||||
|
|
||||||
|
(telescope.load_extension "media_files")
|
||||||
|
|
||||||
|
(utils.noremap :n :<C-p> ":Telescope find_files<CR>")
|
63
nvim/fnl/utils.fnl
Normal file
63
nvim/fnl/utils.fnl
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
(module utils
|
||||||
|
{require {a aniseed.core
|
||||||
|
nvim aniseed.nvim}
|
||||||
|
require-macros [macros]})
|
||||||
|
|
||||||
|
(defn noremap [mode from to]
|
||||||
|
"Sets a mapping with {:noremap true :silent true}."
|
||||||
|
(nvim.set_keymap mode from to {:noremap true :silent true}))
|
||||||
|
|
||||||
|
(defn mapexpr [mode from to]
|
||||||
|
"Sets a mapping with {:noremap true :silent true :expr true}."
|
||||||
|
(nvim.set_keymap mode from to {:noremap true :silent true :expr true}))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(defn colors []
|
||||||
|
{ :dark0_hard "#1d2021"
|
||||||
|
:dark0 "#282828"
|
||||||
|
:dark0_soft "#32302f"
|
||||||
|
:dark1 "#3c3836"
|
||||||
|
:dark2 "#504945"
|
||||||
|
:dark3 "#665c54"
|
||||||
|
:dark4 "#7c6f64"
|
||||||
|
:light0_hard "#f9f5d7"
|
||||||
|
:light0 "#fbf1c7"
|
||||||
|
:light0_soft "#f2e5bc"
|
||||||
|
:light1 "#ebdbb2"
|
||||||
|
:light2 "#d5c4a1"
|
||||||
|
:light3 "#bdae93"
|
||||||
|
:light4 "#a89984"
|
||||||
|
:bright_red "#fb4934"
|
||||||
|
:bright_green "#b8bb26"
|
||||||
|
:bright_yellow "#fabd2f"
|
||||||
|
:bright_blue "#83a598"
|
||||||
|
:bright_purple "#d3869b"
|
||||||
|
:bright_aqua "#8ec07c"
|
||||||
|
:bright_orange "#fe8019"
|
||||||
|
:neutral_red "#cc241d"
|
||||||
|
:neutral_green "#98971a"
|
||||||
|
:neutral_yellow "#d79921"
|
||||||
|
:neutral_blue "#458588"
|
||||||
|
:neutral_purple "#b16286"
|
||||||
|
:neutral_aqua "#689d6a"
|
||||||
|
:neutral_orange "#d65d0e"
|
||||||
|
:faded_red "#9d0006"
|
||||||
|
:faded_green "#79740e"
|
||||||
|
:faded_yellow "#b57614"
|
||||||
|
:faded_blue "#076678"
|
||||||
|
:faded_purple "#8f3f71"
|
||||||
|
:faded_aqua "#427b58"
|
||||||
|
:faded_orange "#af3a03"
|
||||||
|
:gray "#928374"})
|
||||||
|
|
||||||
|
|
||||||
|
(defn highlight [group colset]
|
||||||
|
(let [default { :fg "NONE" :bg "NONE" :gui "NONE"}
|
||||||
|
opts (a.merge default colset)]
|
||||||
|
(nvim.command (.. "hi! "group" guifg='"opts.fg"' guibg='"opts.bg"' gui='"opts.gui"'"))))
|
||||||
|
|
||||||
|
|
||||||
|
(defn comp [f g]
|
||||||
|
(fn [...]
|
||||||
|
(f (g ...))))
|
271
nvim/init.vim
Normal file
271
nvim/init.vim
Normal file
|
@ -0,0 +1,271 @@
|
||||||
|
" __ _(_)_ __ ___ _ __ ___
|
||||||
|
" \ \ / / | '_ ` _ \| '__/ __|
|
||||||
|
" \ V /| | | | | | | | | (__
|
||||||
|
" \_/ |_|_| |_| |_|_| \___|
|
||||||
|
|
||||||
|
|
||||||
|
"set runtimepath^=~/coding/tmp/coc.nvim/
|
||||||
|
|
||||||
|
let g:vim_config_root = expand('<sfile>:p:h')
|
||||||
|
let $VIM_ROOT = g:vim_config_root
|
||||||
|
|
||||||
|
source $VIM_ROOT/plugins.vim
|
||||||
|
|
||||||
|
|
||||||
|
if &shell =~# 'fish$'
|
||||||
|
set shell=bash
|
||||||
|
endif
|
||||||
|
|
||||||
|
let mapleader ="\<Space>"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
" Vanilla VIM configuration ------------------------------------ {{{
|
||||||
|
|
||||||
|
filetype plugin indent on
|
||||||
|
syntax on
|
||||||
|
|
||||||
|
set noshowmode " mode is already shown in airline
|
||||||
|
set foldmethod=marker
|
||||||
|
set undodir=~/.vim/undo-dir
|
||||||
|
set undofile
|
||||||
|
set shortmess+=c " Don't give completion messages like 'match 1 of 2' or 'The only match'
|
||||||
|
set hidden
|
||||||
|
set encoding=utf-8
|
||||||
|
set nonumber norelativenumber
|
||||||
|
set nocompatible
|
||||||
|
set cursorline
|
||||||
|
set incsearch
|
||||||
|
set hlsearch
|
||||||
|
set inccommand=nosplit
|
||||||
|
|
||||||
|
if (has("termguicolors"))
|
||||||
|
set termguicolors
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Indentation
|
||||||
|
set shiftwidth=2
|
||||||
|
set tabstop=2
|
||||||
|
set backspace=indent,eol,start
|
||||||
|
set autoindent smartindent noet expandtab
|
||||||
|
set nowrap
|
||||||
|
set noshowmode " hide the mode as shown by vim, because the status line does it better!
|
||||||
|
|
||||||
|
set completeopt=longest,menuone,noselect " Enable autocompletion
|
||||||
|
set laststatus=2
|
||||||
|
set noshowmode
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
set background=dark
|
||||||
|
colorscheme gruvbox
|
||||||
|
let g:onedark_terminal_italics=1
|
||||||
|
hi LineNr ctermbg=NONE guibg=NONE
|
||||||
|
hi Comment cterm=italic
|
||||||
|
let &t_ut=''
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
" hide empty line ~'s
|
||||||
|
highlight EndOfBuffer ctermfg=black ctermbg=black guibg=NONE guifg='#282828'
|
||||||
|
|
||||||
|
|
||||||
|
hi Pmenu ctermbg=black guibg='#1d2021'
|
||||||
|
hi PmenuSel guibg='#8ec07c'
|
||||||
|
hi PmenuSbar guibg='#1d2021'
|
||||||
|
hi PmenuThumb guibg='#3c3836'
|
||||||
|
|
||||||
|
hi WhichKeyFloating ctermbg=black guibg='#282828'
|
||||||
|
|
||||||
|
hi NormalFloat ctermbg=black guibg='#1d2021'
|
||||||
|
hi SignColumn ctermbg=NONE guibg='#282828'
|
||||||
|
hi link Function GruvboxGreen
|
||||||
|
|
||||||
|
|
||||||
|
if !has("nvim")
|
||||||
|
set term=xterm-256color
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Clipboard support in WSL
|
||||||
|
func! GetSelectedText()
|
||||||
|
normal gv"xy
|
||||||
|
let result = getreg("x")
|
||||||
|
return result
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
if !has("clipboard") && executable("clip.exe")
|
||||||
|
vnoremap <C-C> :call system('clip.exe', GetSelectedText())<CR>
|
||||||
|
vnoremap <C-X> :call system('clip.exe', GetSelectedText())<CR>gvx
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
" Mouse config
|
||||||
|
set mouse=a
|
||||||
|
if !has("nvim")
|
||||||
|
if has("mouse_sgr")
|
||||||
|
set ttymouse=sgr
|
||||||
|
else
|
||||||
|
set ttymouse=xterm2
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if !has('gui_running')
|
||||||
|
set t_Co=256
|
||||||
|
endif
|
||||||
|
|
||||||
|
augroup basics
|
||||||
|
autocmd!
|
||||||
|
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o "Disables automatic commenting on newline:
|
||||||
|
autocmd FileType vim setlocal foldmethod=marker
|
||||||
|
|
||||||
|
" file type assignments
|
||||||
|
autocmd BufRead,BufNewFile *.ddl setlocal filetype=sql
|
||||||
|
|
||||||
|
|
||||||
|
" Auto-close quickfix list when element
|
||||||
|
autocmd FileType qf nnoremap <buffer> <CR> <CR>:cclose<CR>
|
||||||
|
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
" autoclose empty unedited buffers
|
||||||
|
function! CleanNoNameEmptyBuffers()
|
||||||
|
let buffers = filter(range(1, bufnr('$')), 'buflisted(v:val) && empty(bufname(v:val)) && bufwinnr(v:val) < 0 && (getbufline(v:val, 1, "$") == [""])')
|
||||||
|
if !empty(buffers)
|
||||||
|
exe 'bd '.join(buffers, ' ')
|
||||||
|
else
|
||||||
|
echo 'No buffer deleted'
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
autocmd BufCreate * execute 'call CleanNoNameEmptyBuffers()'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
" ===============
|
||||||
|
" Basic remapping
|
||||||
|
" ===============
|
||||||
|
|
||||||
|
" Split configs
|
||||||
|
nnoremap <C-J> <C-W><C-J>
|
||||||
|
nnoremap <C-K> <C-W><C-K>
|
||||||
|
nnoremap <C-L> <C-W><C-L>
|
||||||
|
nnoremap <C-H> <C-W><C-H>
|
||||||
|
set splitbelow splitright
|
||||||
|
|
||||||
|
" Buffer switching
|
||||||
|
"noremap <silent> <leader>l :bnext<CR>
|
||||||
|
"noremap <silent> <leader>h :bprevious<CR>
|
||||||
|
|
||||||
|
" Disable default K mapping (would open man page of hovered word)
|
||||||
|
nnoremap K <Nop>
|
||||||
|
vnoremap K <Nop>
|
||||||
|
|
||||||
|
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Plugin configuration --------------------------------------------------- {{{
|
||||||
|
|
||||||
|
let g:VM_leader = 'm'
|
||||||
|
|
||||||
|
autocmd BufReadPost * :DetectIndent
|
||||||
|
let g:detectindent_preferred_expandtab = 1
|
||||||
|
let g:detectindent_preferred_indent = 2
|
||||||
|
|
||||||
|
autocmd BufReadPost *.hs :set shiftwidth=2
|
||||||
|
|
||||||
|
let g:vim_parinfer_filetypes = ['carp']
|
||||||
|
|
||||||
|
|
||||||
|
let g:sneak#label = 1
|
||||||
|
nmap <DEL> <Plug>Sneak_s
|
||||||
|
nmap <S-DEL> <Plug>Sneak_S
|
||||||
|
omap <DEL> <Plug>Sneak_s
|
||||||
|
omap <S-DEL> <Plug>Sneak_S
|
||||||
|
|
||||||
|
|
||||||
|
let g:rust_clip_command = 'xclip -selection clipboard'
|
||||||
|
let g:rustfmt_autosave = 1
|
||||||
|
|
||||||
|
let g:user_emmet_leader_key='<leader>e'
|
||||||
|
let g:user_emmet_settings = { 'javascript.jsx' : { 'extends' : 'jsx' }, 'typescript.jsx' : { 'extends' : 'jsx' } }
|
||||||
|
|
||||||
|
let g:qs_highlight_on_keys = ['f', 'F', 't', 'T']
|
||||||
|
let g:qs_lazy_highlight = 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
au VimEnter * RainbowParenthesesToggle
|
||||||
|
au Syntax * RainbowParenthesesLoadRound
|
||||||
|
au Syntax * RainbowParenthesesLoadSquare
|
||||||
|
au Syntax * RainbowParenthesesLoadBraces
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
"map <Leader>f <Plug>(easymotion-bd-f)
|
||||||
|
"map <Leader>s <Plug>(easymotion-overwin-f2)
|
||||||
|
"let g:EasyMotion_smartcase = 1
|
||||||
|
|
||||||
|
let g:signify_sign_add = '▍'
|
||||||
|
let g:signify_sign_delete = '▍'
|
||||||
|
let g:signify_sign_delete_first_line = '▍'
|
||||||
|
let g:signify_sign_change = '▍'
|
||||||
|
"let g:signify_sign_show_text = 0
|
||||||
|
|
||||||
|
hi SignifySignDelete cterm=NONE gui=NONE guifg='#fb4934'
|
||||||
|
hi SignifySignChange cterm=NONE gui=NONE guifg='#83a598'
|
||||||
|
hi SignifySignAdd cterm=NONE gui=NONE guifg='#8ec07c'
|
||||||
|
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" :: and _ as space ------------------------------------------------------------------- {{{
|
||||||
|
|
||||||
|
function RebindShit(newKey)
|
||||||
|
let b:RemappedSpace={
|
||||||
|
\ 'old': maparg("<Space>", "i"),
|
||||||
|
\ 'cur': a:newKey
|
||||||
|
\ }
|
||||||
|
exe 'inoremap <buffer> <Space>' a:newKey
|
||||||
|
endfun
|
||||||
|
|
||||||
|
function! UnbindSpaceStuff()
|
||||||
|
if get(b:, "RemappedSpace", {}) != {}
|
||||||
|
exe 'iunmap <buffer> <Space>'
|
||||||
|
if b:RemappedSpace['old'] != ""
|
||||||
|
exe 'inoremap <buffer> <space>' b:RemappedSpace['old']
|
||||||
|
endif
|
||||||
|
unlet b:RemappedSpace
|
||||||
|
endif
|
||||||
|
endfun
|
||||||
|
|
||||||
|
augroup UnmapSpaceStuff
|
||||||
|
autocmd!
|
||||||
|
autocmd InsertLeave * call UnbindSpaceStuff()
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
|
||||||
|
nnoremap <Tab>j :call RebindShit("_")<CR>a
|
||||||
|
nnoremap <Tab>k :call RebindShit("::")<CR>a
|
||||||
|
|
||||||
|
inoremap <Tab>j <space><C-o>:call RebindShit("_")<CR>
|
||||||
|
inoremap <Tab>k <space><C-o>:call RebindShit("::")<CR>
|
||||||
|
|
||||||
|
|
||||||
|
nnoremap ö a
|
||||||
|
|
||||||
|
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
|
||||||
|
" how 2 highlight group at cursor
|
||||||
|
":exe 'hi '.synIDattr(synID(line("."), col("."), 0),"name")
|
||||||
|
|
||||||
|
"source $VIM_ROOT/whichkeyConfig.vim
|
||||||
|
|
||||||
|
let g:aniseed#env = v:true
|
||||||
|
|
||||||
|
"let g:lexima_no_default_rules = v:true
|
||||||
|
"call lexima#set_default_rules()
|
122
nvim/plugins.vim
Normal file
122
nvim/plugins.vim
Normal file
|
@ -0,0 +1,122 @@
|
||||||
|
if empty(glob('~/.vim/autoload/plug.vim'))
|
||||||
|
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
|
||||||
|
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||||
|
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
call plug#begin('~/.vim/plugged')
|
||||||
|
|
||||||
|
Plug 'kevinhwang91/nvim-bqf'
|
||||||
|
|
||||||
|
Plug 'akinsho/nvim-bufferline.lua'
|
||||||
|
|
||||||
|
Plug 'Olical/aniseed', { 'tag': 'v3.16.0' }
|
||||||
|
|
||||||
|
" general purpose lua wrappers for nvim stuff
|
||||||
|
Plug 'norcalli/nvim.lua'
|
||||||
|
|
||||||
|
Plug 'tweekmonster/startuptime.vim'
|
||||||
|
Plug 'tpope/vim-repeat'
|
||||||
|
|
||||||
|
Plug 'junegunn/goyo.vim', {'on': 'Goyo'}
|
||||||
|
|
||||||
|
Plug 'liuchengxu/vim-which-key'
|
||||||
|
|
||||||
|
Plug 'mhinz/vim-signify'
|
||||||
|
|
||||||
|
Plug 'tpope/vim-fugitive'
|
||||||
|
|
||||||
|
Plug 'preservim/nerdcommenter'
|
||||||
|
|
||||||
|
Plug 'glepnir/galaxyline.nvim'
|
||||||
|
|
||||||
|
Plug 'gruvbox-community/gruvbox'
|
||||||
|
|
||||||
|
Plug 'godlygeek/tabular' " :Tab /regex can align code on occurrences of the given regex. I.e. :Tab /= aligns all = signs in a block.
|
||||||
|
Plug 'tpope/vim-surround'
|
||||||
|
|
||||||
|
Plug 'christoomey/vim-tmux-navigator' " good integration with tmux pane switching
|
||||||
|
Plug 'nathanaelkane/vim-indent-guides' " Can be toggled using <leader>ig (intent-guides)
|
||||||
|
|
||||||
|
" <C-n> to select current word. <C-n> to select next occurrence.
|
||||||
|
" with multiple lines selected in Visual mode, <C-n> to insert cursor in each line. I not i to insert in Visual-mode.
|
||||||
|
"Plug 'terryma/vim-multiple-cursors'
|
||||||
|
Plug 'mg979/vim-visual-multi'
|
||||||
|
Plug 'hauleth/sad.vim' " Use siw instead of ciw. when using . afterwards, will find the next occurrence of the changed word and change it too
|
||||||
|
Plug 'wellle/targets.vim' " more text objects. IE: cin) (change in next parens). generally better handling of surrounding objects.
|
||||||
|
|
||||||
|
Plug 'unblevable/quick-scope' " highlight targets when pressing f<character>
|
||||||
|
Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() } } " :MarkdownPreview for live markdown preview
|
||||||
|
|
||||||
|
Plug 'machakann/vim-highlightedyank'
|
||||||
|
|
||||||
|
Plug 'ciaranm/detectindent'
|
||||||
|
Plug 'pechorin/any-jump.vim'
|
||||||
|
Plug 'justinmk/vim-sneak'
|
||||||
|
Plug 'psliwka/vim-smoothie'
|
||||||
|
|
||||||
|
Plug 'editorconfig/editorconfig-vim'
|
||||||
|
|
||||||
|
Plug 'honza/vim-snippets'
|
||||||
|
|
||||||
|
Plug 'tommcdo/vim-exchange'
|
||||||
|
|
||||||
|
Plug 'kien/rainbow_parentheses.vim'
|
||||||
|
|
||||||
|
Plug 'bhurlow/vim-parinfer'
|
||||||
|
|
||||||
|
"Plug 'Olical/conjure', {'tag': 'v4.17.0'}
|
||||||
|
|
||||||
|
|
||||||
|
" Language Plugins ----------------------------------------------------- {{{
|
||||||
|
|
||||||
|
Plug 'bduggan/vim-raku'
|
||||||
|
Plug 'LnL7/vim-nix'
|
||||||
|
|
||||||
|
Plug 'kevinoid/vim-jsonc'
|
||||||
|
|
||||||
|
Plug 'ap/vim-css-color'
|
||||||
|
Plug 'pangloss/vim-javascript' " syntax highlighting JS
|
||||||
|
Plug 'ianks/vim-tsx'
|
||||||
|
Plug 'leafgarland/typescript-vim'
|
||||||
|
Plug 'sheerun/vim-polyglot' " Syntax highlighting for most languages
|
||||||
|
"Plug 'mattn/emmet-vim'
|
||||||
|
|
||||||
|
Plug 'purescript-contrib/purescript-vim'
|
||||||
|
|
||||||
|
Plug 'HerringtonDarkholme/yats.vim' " typescript syntax highlighting
|
||||||
|
Plug 'mxw/vim-jsx'
|
||||||
|
|
||||||
|
"" Haskell
|
||||||
|
Plug 'neovimhaskell/haskell-vim'
|
||||||
|
|
||||||
|
" Rust
|
||||||
|
Plug 'rust-lang/rust.vim'
|
||||||
|
Plug 'mattn/webapi-vim'
|
||||||
|
|
||||||
|
Plug 'bakpakin/fennel.vim'
|
||||||
|
Plug 'tjdevries/nlua.nvim'
|
||||||
|
|
||||||
|
"Plug 'mxw/vim-prolog'
|
||||||
|
|
||||||
|
|
||||||
|
Plug 'neovim/nvim-lspconfig'
|
||||||
|
|
||||||
|
"Plug 'nvim-lua/completion-nvim'
|
||||||
|
Plug 'hrsh7th/nvim-compe'
|
||||||
|
Plug 'glepnir/lspsaga.nvim'
|
||||||
|
"Plug 'cohama/lexima.vim'
|
||||||
|
|
||||||
|
Plug 'nvim-lua/popup.nvim'
|
||||||
|
Plug 'nvim-lua/plenary.nvim'
|
||||||
|
Plug 'nvim-telescope/telescope.nvim'
|
||||||
|
|
||||||
|
Plug 'RishabhRD/popfix'
|
||||||
|
Plug 'RishabhRD/nvim-lsputils'
|
||||||
|
|
||||||
|
Plug 'nvim-telescope/telescope-media-files.nvim'
|
||||||
|
|
||||||
|
" }}}
|
||||||
|
call plug#end()
|
||||||
|
|
Loading…
Reference in a new issue