[NeoVim] Clean plugins settings
This commit is contained in:
16
.config/nvim/fnl/settings/aerial.fnl
Normal file
16
.config/nvim/fnl/settings/aerial.fnl
Normal file
@@ -0,0 +1,16 @@
|
||||
(import-macros {: map!} :hibiscus.vim)
|
||||
(import-macros {: setup} :macros)
|
||||
|
||||
(setup :aerial {
|
||||
:close_behavior "global"
|
||||
:open_automatic true
|
||||
:placement_editor_edge true
|
||||
:width 30
|
||||
:on_attach (fn [bufnr]
|
||||
(map! [n :buffer] :t (fn []
|
||||
(vim.tbl_map (fn [buf]
|
||||
(if (= (vim.api.nvim_buf_get_option buf "filetype") "aerial")
|
||||
(vim.tbl_map (fn [win]
|
||||
(vim.api.nvim_set_current_win win))
|
||||
(vim.fn.win_findbuf buf))))
|
||||
(vim.api.nvim_list_bufs)))))})
|
||||
17
.config/nvim/fnl/settings/bufferline.fnl
Normal file
17
.config/nvim/fnl/settings/bufferline.fnl
Normal file
@@ -0,0 +1,17 @@
|
||||
(import-macros {: map!} :hibiscus.vim)
|
||||
(import-macros {: setup} :macros)
|
||||
|
||||
(local colors (require :solarized.colors))
|
||||
(setup :bufferline {
|
||||
:options {:close_command "Bdelete %d"
|
||||
:right_mouse_command "Bdelete %d"
|
||||
:offsets [{:filetype "neo-tree" :text "File Explorer" :padding 1}
|
||||
{:filetype "aerial" :text "Outline" :padding 1}]
|
||||
:enforce_regular_tabs true
|
||||
:separator_style "slant"}
|
||||
:highlights {:separator {:fg colors.bg_alt}
|
||||
:separator_visible {:fg colors.bg_alt}
|
||||
:separator_selected {:fg colors.bg_alt}}})
|
||||
(map! [n] :<S-Right> ":bnext<CR>")
|
||||
(map! [n] :<S-Left> ":bprevious<CR>")
|
||||
(map! [n] :q ":Bdelete<CR>")
|
||||
9
.config/nvim/fnl/settings/diffview.fnl
Normal file
9
.config/nvim/fnl/settings/diffview.fnl
Normal file
@@ -0,0 +1,9 @@
|
||||
(import-macros {: map!} :hibiscus.vim)
|
||||
(import-macros {: setup} :macros)
|
||||
|
||||
(setup :diffview {
|
||||
:keymaps {:view {:q ":tabc<CR>"}
|
||||
:file_panel {:q ":tabc<CR>"}
|
||||
:file_history_panel {:q ":tabc<CR>"}}})
|
||||
(map! [n] :r ":DiffviewOpen<CR>")
|
||||
(map! [n] :R ":DiffviewFileHistory %<CR>")
|
||||
31
.config/nvim/fnl/settings/feline.fnl
Normal file
31
.config/nvim/fnl/settings/feline.fnl
Normal file
@@ -0,0 +1,31 @@
|
||||
(import-macros {: setup} :macros)
|
||||
|
||||
(local colors (require :solarized.colors))
|
||||
|
||||
(local theme {:fg colors.fg
|
||||
:bg colors.bg_alt
|
||||
:black colors.black
|
||||
:skyblue colors.paleblue
|
||||
:cyan colors.cyan
|
||||
:green colors.green
|
||||
:oceanblue colors.blue
|
||||
:magenta colors.magenta
|
||||
:orange colors.orange
|
||||
:red colors.red
|
||||
:violet colors.purple
|
||||
:white colors.white
|
||||
:yellow colors.yellow})
|
||||
|
||||
(setup :feline {
|
||||
:theme theme
|
||||
:force_inactive {:filetypes ["^neo\\-tree$"
|
||||
"^aerial$"
|
||||
"^packer$"
|
||||
"^startify$"
|
||||
"^fugitive$"
|
||||
"^fugitiveblame$"
|
||||
"^qf$"
|
||||
"^help$"
|
||||
"^DiffviewFileHistory"]
|
||||
:buftypes ["^terminal$"]
|
||||
:bufnames ["neo\\-.*"]}})
|
||||
20
.config/nvim/fnl/settings/general.fnl
Normal file
20
.config/nvim/fnl/settings/general.fnl
Normal file
@@ -0,0 +1,20 @@
|
||||
(import-macros {: g! : set!} :hibiscus.vim)
|
||||
|
||||
(g! :maplocalleader ",")
|
||||
(set! :clipboard "unnamedplus")
|
||||
(set! :expandtab true)
|
||||
(set! :fileencoding "utf-8")
|
||||
(set! :ignorecase true)
|
||||
(set! :mouse "a")
|
||||
(set! :showmode false)
|
||||
(set! :number true)
|
||||
(set! :shiftwidth 2)
|
||||
(set! :signcolumn "yes")
|
||||
(set! :smartcase true)
|
||||
(set! :spelllang "en")
|
||||
(set! :tabstop 2)
|
||||
|
||||
; Startup
|
||||
(if (or (= (vim.fn.expand "%") "") (not= (vim.fn.isdirectory (vim.fn.expand "%")) 0))
|
||||
((. (require :neo-tree.command) :_command) (vim.fn.getcwd))
|
||||
((. (require :neo-tree.command) :_command) "show" (vim.fn.getcwd)))
|
||||
75
.config/nvim/fnl/settings/lsp/ltex.fnl
Normal file
75
.config/nvim/fnl/settings/lsp/ltex.fnl
Normal file
@@ -0,0 +1,75 @@
|
||||
(import-macros {: exec : map!} :hibiscus.vim)
|
||||
|
||||
(local M {})
|
||||
|
||||
(local files {:dictionary (.. (vim.fn.stdpath "config") "/spell/en.utf-8.add")
|
||||
:disabledRules (.. (vim.fn.stdpath "config") "/spell/disable.txt")
|
||||
:hiddenFalsePositives (.. (vim.fn.stdpath "config") "/spell/false.txt")})
|
||||
|
||||
(fn file_exists [file] (let [f (io.open file "rb")]
|
||||
(match f nil false
|
||||
_ (do (f.close f) true))))
|
||||
|
||||
(fn lines_from [file] (match (file_exists file) false []
|
||||
true (let [lines []]
|
||||
(do (each [line (io.lines file)]
|
||||
(table.insert lines line))
|
||||
lines))))
|
||||
|
||||
(fn get_client_by_name [name] (let [buf_clients (vim.lsp.buf_get_clients)]
|
||||
(each [_ client (ipairs buf_clients)]
|
||||
(match client.name name (lua "return client")))))
|
||||
|
||||
(fn update_config [lang configtype] (let [client (get_client_by_name "ltex")]
|
||||
(if client
|
||||
(if (. client.config.settings.ltex configtype)
|
||||
(do (tset client.config.settings.ltex configtype {lang (lines_from (. files configtype))})
|
||||
(client.notify "workspace/didChangeConfiguration" client.config.settings))
|
||||
(vim.notify "Error when reading dictionary config, check it")))))
|
||||
|
||||
(fn add_to_file [configtype lang file value] (let [dict (lines_from file)]
|
||||
(do (each [_ v (ipairs dict)]
|
||||
(if (= v value) (lua "return nil")))
|
||||
(let [file (io.open file "a+")]
|
||||
(if file
|
||||
(do (file.write file (.. value "\n"))
|
||||
(file.close file)
|
||||
(update_config lang configtype))
|
||||
(vim.notify (string.format "Failed insert %s" value)))))))
|
||||
|
||||
(fn do_command [arg configtype] (each [lang words (pairs arg)]
|
||||
(each [_ word (ipairs words)]
|
||||
(add_to_file configtype lang (. files configtype) word))))
|
||||
|
||||
(tset vim.lsp.commands "_ltex.addToDictionary"
|
||||
(fn [command _] (do_command (. (. command.arguments 1) :words) "dictionary")))
|
||||
(tset vim.lsp.commands "_ltex.disableRules"
|
||||
(fn [command _] (do_command (. (. command.arguments 1) :ruleIds) "disabledRules")))
|
||||
(tset vim.lsp.commands "_ltex.hideFalsePositives"
|
||||
(fn [command _] (do_command (. (. command.arguments 1) :falsePositives) "hiddenFalsePositives")))
|
||||
|
||||
(fn post_attach [] (do (exec [[:setlocal "spell"] [:setlocal "nospell"]])
|
||||
(update_config "en-US" "dictionary")
|
||||
(update_config "en-US" "disabledRules")
|
||||
(update_config "en-US" "hiddenFalsePositives")
|
||||
(map! [n :buffer :verbose] :zug (fn [] (do (exec [[:normal! "zug"]])
|
||||
(update_config "en-US" "dictionary")
|
||||
nil))
|
||||
"Remove word from spellfile and update ltex")
|
||||
(map! [n :buffer :verbose] :zg (fn [] (do (exec [[:normal! "zg"]])
|
||||
(update_config "en-US" "dictionary")
|
||||
nil))
|
||||
"Add word to spellfile and update ltex")
|
||||
nil))
|
||||
|
||||
(set M.setup (fn [opts]
|
||||
((. (. (require "lspconfig") "ltex") :setup) {:on_attach (fn [client]
|
||||
(do (opts.on_attach client) (post_attach) nil))
|
||||
:capabilities opts.capabilities
|
||||
:flags opts.flags
|
||||
:settings {:ltex {:dictionary []
|
||||
:disabledRules []
|
||||
:hiddenFalsePositives []}
|
||||
:additionalRules {:enablePickyRules true}}})))
|
||||
|
||||
M
|
||||
71
.config/nvim/fnl/settings/lspconfig.fnl
Normal file
71
.config/nvim/fnl/settings/lspconfig.fnl
Normal file
@@ -0,0 +1,71 @@
|
||||
(import-macros {: map!} :hibiscus.vim)
|
||||
(import-macros {: setup} :macros)
|
||||
|
||||
(local servers [:pyright :sumneko_lua :eslint :tsserver :ltex])
|
||||
|
||||
; Mappings.
|
||||
(map! [n :noremap] "<space>e" vim.diagnostic.open_float)
|
||||
(map! [n :noremap] "[d" vim.diagnostic.goto_prev)
|
||||
(map! [n :noremap] "]d" vim.diagnostic.goto_next)
|
||||
(map! [n :noremap] "<space>q" vim.diagnostic.setloclist)
|
||||
|
||||
(fn on_attach [_ bufnr]
|
||||
(do (map! [n :noremap :buffer] :gD vim.lsp.buf.declaration)
|
||||
(map! [n :noremap :buffer] :gd vim.lsp.buf.definition)
|
||||
(map! [n :noremap :buffer] :K vim.lsp.buf.hover)
|
||||
(map! [n :noremap :buffer] :gi vim.lsp.buf.implementation)
|
||||
(map! [n :noremap :buffer] :<C-k> vim.lsp.buf.signature_help)
|
||||
(map! [n :noremap :buffer] :<space>wa vim.lsp.buf.add_workspace_folder)
|
||||
(map! [n :noremap :buffer] :<space>wr vim.lsp.buf.remove_workspace_folder)
|
||||
(map! [n :noremap :buffer] :<space>wl (fn [] (print (vim.inspect (vim.lsp.buf.list_workspace_folders)))))
|
||||
(map! [n :noremap :buffer] :<space>D vim.lsp.buf.type_definition)
|
||||
(map! [n :noremap :buffer] :<space>rn vim.lsp.buf.rename)
|
||||
(map! [n :noremap :buffer] :<space>ca vim.lsp.buf.code_action)
|
||||
(map! [n :noremap :buffer] :gr vim.lsp.buf.references)
|
||||
(map! [n :noremap :buffer] :<space>f vim.lsp.buf.formatting)))
|
||||
|
||||
(local capabilities ((. (require :cmp_nvim_lsp) :update_capabilities) (vim.lsp.protocol.make_client_capabilities)))
|
||||
|
||||
(setup :mason)
|
||||
(setup :mason-lspconfig {:ensure_installed servers})
|
||||
|
||||
(each [_ lsp (pairs servers)]
|
||||
(do (local lsp_opts {:on_attach on_attach
|
||||
:capabilities capabilities
|
||||
:flags {:debounce_text_changes 150}})
|
||||
(local (status config) (pcall require (.. "settings.lsp." lsp)))
|
||||
(if status
|
||||
(config.setup lsp_opts)
|
||||
((. (. (require :lspconfig) lsp) :setup) lsp_opts))))
|
||||
|
||||
; LuaSnip setup
|
||||
(local luasnip (require :luasnip))
|
||||
((. (require :luasnip.loaders.from_vscode) :lazy_load))
|
||||
|
||||
; nvim-cmp setup
|
||||
(local lspkind (require :lspkind))
|
||||
(local cmp (require :cmp))
|
||||
(cmp.setup {:snippet {:expand (fn [args] (luasnip.lsp_expand args.body))}
|
||||
:mapping (cmp.mapping.preset.insert {:<C-d> (cmp.mapping.scroll_docs -4)
|
||||
:<C-f> (cmp.mapping.scroll_docs 4)
|
||||
:<C-Space> (cmp.mapping.complete)
|
||||
:<CR> (cmp.mapping.confirm {:behavior cmp.ConfirmBehavior.Replace
|
||||
:select true})
|
||||
:<Tab> (cmp.mapping (fn [fallback]
|
||||
(if (cmp.visible)
|
||||
(cmp.select_next_item)
|
||||
(if (luasnip.expand_or_jumpable)
|
||||
(luasnip.expand_or_jump)
|
||||
(fallback))))
|
||||
[:i :s])
|
||||
:<S-Tab> (cmp.mapping (fn [fallback]
|
||||
(if (cmp.visible)
|
||||
(cmp.select_prev_item)
|
||||
(if (luasnip.jumpable -1)
|
||||
(luasnip.jump -1)
|
||||
(fallback))))
|
||||
[:i :s])})
|
||||
:sources [{:name "luasnip"}
|
||||
{:name "nvim_lsp"}
|
||||
{:name "omni"}]
|
||||
:formatting {:format (lspkind.cmp_format {:mode "symbol_text"})}})
|
||||
36
.config/nvim/fnl/settings/neo-tree.fnl
Normal file
36
.config/nvim/fnl/settings/neo-tree.fnl
Normal file
@@ -0,0 +1,36 @@
|
||||
(import-macros {: g! : exec : map! : augroup!} :hibiscus.vim)
|
||||
(import-macros {: setup} :macros)
|
||||
|
||||
(g! :neo_tree_remove_legacy_commands 1)
|
||||
(setup :neo-tree {
|
||||
:close_if_last_window true
|
||||
:window {:width 30
|
||||
:mappings {:<cr> "open_with_window_picker"
|
||||
:S "split_with_window_picker"
|
||||
:s "vsplit_with_window_picker"}}
|
||||
:filesystem {:filtered_items {:visible true}
|
||||
:follow_current_file true
|
||||
:window {:mappings {:/ "noop"
|
||||
:g/ "fuzzy_finder"
|
||||
:f "noop"
|
||||
:ff (fn [] (exec [[:Telescope "find_files"]]))
|
||||
:fg (fn [] (exec [[:Telescope "live_grep"]]))
|
||||
:<S-Right> (fn [])
|
||||
:<S-Left> (fn [])}}}
|
||||
:renderers {:directory [[:indent]
|
||||
[:icon]
|
||||
[:current_filter]
|
||||
[:name]
|
||||
[:clipboard]
|
||||
{1 "diagnostics" :errors_only true}]
|
||||
:file [[:indent]
|
||||
[:icon]
|
||||
{1 "name" :use_git_status_colors true :zindex 10}
|
||||
[:clipboard]
|
||||
[:bufnr]
|
||||
[:modified]
|
||||
[:diagnostics]
|
||||
[:git_status]]}})
|
||||
(map! [n] :f ":Neotree focus<CR>")
|
||||
(map! [n] :F (fn [] (exec [[:Neotree "toggle"] [:Neotree "toggle" "action=show"]])))
|
||||
(augroup! :neo-tree [[FileType] [qf] "set nobuflisted|call feedkeys(\"F\")"])
|
||||
5
.config/nvim/fnl/settings/null-ls.fnl
Normal file
5
.config/nvim/fnl/settings/null-ls.fnl
Normal file
@@ -0,0 +1,5 @@
|
||||
(import-macros {: setup} :macros)
|
||||
|
||||
(setup :null-ls {
|
||||
:sources [(. (. (. (require :null-ls) :builtins) :diagnostics) :flake8)]})
|
||||
|
||||
11
.config/nvim/fnl/settings/smart-splits.fnl
Normal file
11
.config/nvim/fnl/settings/smart-splits.fnl
Normal file
@@ -0,0 +1,11 @@
|
||||
(import-macros {: map!} :hibiscus.vim)
|
||||
|
||||
(local smart-splits (require :smart-splits))
|
||||
(map! [n] :<C-Left> smart-splits.move_cursor_left)
|
||||
(map! [n] :<C-Down> smart-splits.move_cursor_down)
|
||||
(map! [n] :<C-Up> smart-splits.move_cursor_up)
|
||||
(map! [n] :<C-Right> smart-splits.move_cursor_right)
|
||||
(map! [n] :<C-S-Up> smart-splits.resize_up)
|
||||
(map! [n] :<C-S-Down> smart-splits.resize_down)
|
||||
(map! [n] :<C-S-Left> smart-splits.resize_left)
|
||||
(map! [n] :<C-S-Right> smart-splits.resize_right)
|
||||
10
.config/nvim/fnl/settings/solarized.fnl
Normal file
10
.config/nvim/fnl/settings/solarized.fnl
Normal file
@@ -0,0 +1,10 @@
|
||||
(import-macros {: g!} :hibiscus.vim)
|
||||
|
||||
(g! :solarized_italic_comments true)
|
||||
(g! :solarized_italic_keywords true)
|
||||
(g! :solarized_italic_functions true)
|
||||
(g! :solarized_italic_variables false)
|
||||
(g! :solarized_contrast true)
|
||||
(g! :solarized_borders false)
|
||||
(g! :solarized_disable_background false)
|
||||
((. (require :solarized) :set))
|
||||
9
.config/nvim/fnl/settings/telescope.fnl
Normal file
9
.config/nvim/fnl/settings/telescope.fnl
Normal file
@@ -0,0 +1,9 @@
|
||||
(import-macros {: setup} :macros)
|
||||
|
||||
(local actions (require :telescope.actions))
|
||||
(setup :telescope {
|
||||
:defaults {:mappings {:n {:S actions.file_split
|
||||
:s actions.file_vsplit}}
|
||||
:get_selection_window (. (require :window-picker) :pick_window)}
|
||||
:pickers {:find_files {:find_command [:fd "--type" "f" "--strip-cwd-prefix" "--hidden"]}
|
||||
:live_grep {:vimgrep_arguments ["rg" "--color=never" "--no-heading" "--with-filename" "--line-number" "--column" "--smart-case" "--hidden"]}}})
|
||||
9
.config/nvim/fnl/settings/treesitter.fnl
Normal file
9
.config/nvim/fnl/settings/treesitter.fnl
Normal file
@@ -0,0 +1,9 @@
|
||||
(import-macros {: setup} :macros)
|
||||
|
||||
(setup :nvim-treesitter.configs {
|
||||
:ensure_installed [:c :lua :rust :java :python :javascript :typescript :fennel]
|
||||
:sync_install false
|
||||
:ignore_install []
|
||||
:highlight {:enable true
|
||||
:disable []
|
||||
:additional_vim_regex_highlighting false}})
|
||||
3
.config/nvim/fnl/settings/vimtex.fnl
Normal file
3
.config/nvim/fnl/settings/vimtex.fnl
Normal file
@@ -0,0 +1,3 @@
|
||||
(import-macros {: g!} :hibiscus.vim)
|
||||
|
||||
(g! :vimtex_view_method "zathura")
|
||||
7
.config/nvim/fnl/settings/window-picker.fnl
Normal file
7
.config/nvim/fnl/settings/window-picker.fnl
Normal file
@@ -0,0 +1,7 @@
|
||||
(import-macros {: setup} :macros)
|
||||
|
||||
(setup :window-picker {
|
||||
:autoselect_one true
|
||||
:selection_chars "ABCDEFGHIJKLMNOP"
|
||||
:filter_rules {:bo {:filetype [:NvimTree :neo-tree :notify :aerial]
|
||||
:buftype [:terminal]}}})
|
||||
Reference in New Issue
Block a user