From 2fb74089d3515077395299bce9df32e9e989a8ac Mon Sep 17 00:00:00 2001 From: sefidel Date: Wed, 16 Feb 2022 08:54:25 +0900 Subject: rel: v0.1 - Disable lazy-loading plugins - Add more useful plugins - Fix bar from loading slowly - Add support for neomutt - Change keybinds - Add Editorconfig --- fnl/nvrc/colors.fnl | 42 ++++++++++++++++++----------------------- fnl/nvrc/keymaps.fnl | 30 +++++++++++++++++++---------- fnl/nvrc/options.fnl | 36 +++++++++++++++++------------------ fnl/nvrc/pack.fnl | 43 +++++++++++++++++++++++++++--------------- fnl/nvrc/packs/diffview.fnl | 7 +++++++ fnl/nvrc/packs/filetype.fnl | 3 +++ fnl/nvrc/packs/harpoon.fnl | 3 +++ fnl/nvrc/packs/mergetool.fnl | 7 +++++++ fnl/nvrc/packs/nvimtree.fnl | 44 ------------------------------------------- fnl/nvrc/packs/treesitter.fnl | 22 ++++++++++++++++------ 10 files changed, 120 insertions(+), 117 deletions(-) create mode 100644 fnl/nvrc/packs/diffview.fnl create mode 100644 fnl/nvrc/packs/filetype.fnl create mode 100644 fnl/nvrc/packs/harpoon.fnl create mode 100644 fnl/nvrc/packs/mergetool.fnl delete mode 100644 fnl/nvrc/packs/nvimtree.fnl (limited to 'fnl') diff --git a/fnl/nvrc/colors.fnl b/fnl/nvrc/colors.fnl index 854b79f..7750814 100644 --- a/fnl/nvrc/colors.fnl +++ b/fnl/nvrc/colors.fnl @@ -5,8 +5,10 @@ :black "#181818" :black2 "#101010" :bblack "#252525" - :grey "#888888" + :dgrey "#333333" + :mgrey "#444444" :grey2 "#666666" + :grey "#888888" :bgrey "#999999" :red "#cf6a4c" :orange "#fabb6e" @@ -16,12 +18,12 @@ :skyblue "#8fbfdc" :blue "#8197bf" :violet "#c6b6ee" - :magenta "#f0a0c0" - :sign "#333333"}) + :magenta "#f0a0c0"}) -(fn colors.apply [] + +(lambda colors.apply [colorscheme] (local {: highlight} (require :nvrc.macro.color)) - (vim.cmd "colorscheme jellybeans") + (vim.cmd (.. "colorscheme " colorscheme)) ; Buffer (highlight :EndOfBuffer {:fg (. colors :bg)}) @@ -31,7 +33,7 @@ ; Pmenu (highlight :Pmenu {:bg (. colors :bblack)}) (highlight :PmenuSbar {:bg (. colors :bblack)}) - (highlight :PmenuSel {:fg (. colors :orange) :bg (. colors :sign)}) + (highlight :PmenuSel {:fg (. colors :orange) :bg (. colors :dgrey)}) (highlight :PmenuThumb {:bg (. colors :skyblue)}) (highlight :CmpItemAbbr {:fg (. colors :fg)}) (highlight :CmpItemAbbrMatch {:fg (. colors :fg)}) @@ -41,16 +43,19 @@ ; Misc (highlight :StatusLine {:bg (. colors :black)}) (highlight :StatusLineNC {:fg (. colors :grey) :bg (. colors :black) :underline true}) + (highlight :TabLine {:fg (. colors :fg) :bg (. colors :mgrey)}) + (highlight :TabLineFill {:fg (. colors :fg) :bg (. colors :bg)}) + (highlight :TabLineSel {:fg (. colors :fg) :bg (. colors :grey2)}) (highlight :LineNr {:fg (. colors :grey)}) (highlight :NvimInternalError {:fg (. colors :red)}) (highlight :VertSplit {:fg (. colors :grey2)}) - ; Gitsigns - (highlight :DiffAdd {:fg (. colors :green) :bg (. colors :sign)}) - (highlight :DiffChange {:fg (. colors :yellow) :bg (. colors :sign)}) - (highlight :DiffChangeDelete {:fg (. colors :red) :bg (. colors :sign)}) - (highlight :DiffModified {:fg (. colors :red) :bg (. colors :sign)}) - (highlight :DiffDelete {:fg (. colors :red) :bg (. colors :sign)}) + ; Gitdgreys + (highlight :DiffAdd {:fg (. colors :green) :bg (. colors :dgrey)}) + (highlight :DiffChange {:fg (. colors :yellow) :bg (. colors :dgrey)}) + (highlight :DiffChangeDelete {:fg (. colors :red) :bg (. colors :dgrey)}) + (highlight :DiffModified {:fg (. colors :red) :bg (. colors :dgrey)}) + (highlight :DiffDelete {:fg (. colors :red) :bg (. colors :dgrey)}) ; Nvimtree (highlight :NvimTreeNormal {:bg (. colors :black)}) @@ -65,17 +70,6 @@ (highlight :NvimTreeFolderIcon {:fg (. colors :skyblue)}) (highlight :NvimTreeFolderName {:fg (. colors :skyblue)}) (highlight :NvimTreeOpenedFolderName {:fg (. colors :magenta)}) - (highlight :NvimTreeEndOfBuffer {:fg (. colors :black2)}) - - ; Telescope - (highlight :TelescopeBorder {:fg (. colors :fg)}) - (highlight :TelescopePromptBorder {:fg (. colors :fg)}) - (highlight :TelescopePromptNormal {:fg (. colors :fg)}) - (highlight :TelescopePromptPrefix {:fg (. colors :red)}) - (highlight :TelescopeNormal {:bg :NONE}) - (highlight :TelescopePreviewTitle {:fg (. colors :nvimbg) :bg (. colors :green)}) - (highlight :TelescopePromptTitle {:fg (. colors :nvimbg) :bg (. colors :red)}) - (highlight :TelescopeResultsTitle {:fg (. colors :nvimbg) :bg (. colors :skyblue)}) - (highlight :TelescopeSelection {:link :Search})) + (highlight :NvimTreeEndOfBuffer {:fg (. colors :black2)})) colors diff --git a/fnl/nvrc/keymaps.fnl b/fnl/nvrc/keymaps.fnl index 790d21b..c3bf6c0 100644 --- a/fnl/nvrc/keymaps.fnl +++ b/fnl/nvrc/keymaps.fnl @@ -4,8 +4,8 @@ (map! [n] : "" "") (setv! mapleader " ") -(map! [n :silent] :fe ":NvimTreeToggle ") -(map! [n :silent] :ft ":NvimTreeFocus ") +(map! [n :silent] :e ":bprev ") +(map! [n :silent] :r ":bnext ") (map! [n :silent] :/ ":lua require('Comment.api').toggle_current_linewise() ") @@ -16,27 +16,37 @@ (map! [n :silent] :fc ":FzfLua grep ") (map! [n :silent] :fs ":FzfLua live_grep ") (map! [n :silent] :fb ":FzfLua buffers ") -(map! [n :silent] :gc ":FzfLua git_commits ") -(map! [n :silent] :gs ":FzfLua git_status ") +(map! [n :silent] :fg ":FzfLua git_commits ") +(map! [n :silent] :fs ":FzfLua git_status ") (map! [n] :f :Lightspeed_f) (map! [n] :F :Lightspeed_F) (map! [n] :t :Lightspeed_t) (map! [n] :T :Lightspeed_T) -(map! [n :silent] :rm ":TZMinimalist ") -(map! [n :silent] :rf ":TZFocus ") -(map! [n :silent] :ra ":TZAtaraxis ") +(map! [n :silent] :mm ":TZMinimalist ") +(map! [n :silent] :mf ":TZFocus ") +(map! [n :silent] :ma ":TZAtaraxis ") + +(map! [n :silent] :h ":lua require('harpoon.ui').nav_file(1) ") +(map! [n :silent] :j ":lua require('harpoon.ui').nav_file(2) ") +(map! [n :silent] :k ":lua require('harpoon.ui').nav_file(3) ") +(map! [n :silent] :l ":lua require('harpoon.ui').nav_file(4) ") +(map! [n :silent] ";" ":lua require('harpoon.term').gotoTerminal(1) ") +(map! [n :silent] "'" ":lua require('harpoon.term').gotoTerminal(2) ") +(map! [n :silent] :g ":lua require('harpoon.ui').toggle_quick_menu() ") +(map! [n :silent] :u ":lua require('harpoon.mark').add_file() ") (map! [t] :jk "") (map! [t :silent] :JK " :lua require ('nvrc.utils').del_buf() ") ; FIXME This opens on top of existing vertical/horizontal term +; TODO come up with a better category key (map! [n :silent] :th ":execute 15 .. 'new +terminal' | let b:term_type = 'hori' ") -(map! [n :silent] :tv ":execute 'vnew +terminal' | let b:term_type = 'vert' ") -(map! [n :silent] :tn ":execute 'terminal' | let b:term_type = 'wind' ") +(map! [n :silent] :tj ":execute 'vnew +terminal' | let b:term_type = 'vert' ") +(map! [n :silent] :tk ":execute 'terminal' | let b:term_type = 'wind' ") (map! [n :silent] :q ":lua require('nvrc.utils').del_buf() ") (map! [n :silent] :ya ":%y+ ") (map! [n :silent] :bn ":enew ") (map! [n :silent] :wn ":tabnew ") -(map! [n :silent] :lt ":set nu! ") +(map! [n :silent] :tl ":set nu! ") diff --git a/fnl/nvrc/options.fnl b/fnl/nvrc/options.fnl index b9a59bc..abd0a7b 100644 --- a/fnl/nvrc/options.fnl +++ b/fnl/nvrc/options.fnl @@ -7,8 +7,8 @@ (set! cul) (set! cmdheight 1) (set! number) -(set! numberwidth 2) (set! shortmess+ :sI) +(set! signcolumn :yes) (set! splitbelow) (set! splitright) (set! termguicolors) @@ -32,20 +32,20 @@ (set! whichwrap+ "<>[]hl") (disable-builtins! [:2html_plugin - :getscript - :getscriptPlugin - :gzip - :logipat - :netrw - :netrwPlugin - :netrwSettings - :netrwFileHandlers - :matchit - :tar - :tarPlugin - :rrhelper - :spellfile_plugin - :vimball - :vimballPlugin - :zip - :zipPlugin]) + :getscript + :getscriptPlugin + :gzip + :logipat + :netrw + :netrwPlugin + :netrwSettings + :netrwFileHandlers + :matchit + :tar + :tarPlugin + :rrhelper + :spellfile_plugin + :vimball + :vimballPlugin + :zip + :zipPlugin]) diff --git a/fnl/nvrc/pack.fnl b/fnl/nvrc/pack.fnl index d30f27e..71901ac 100644 --- a/fnl/nvrc/pack.fnl +++ b/fnl/nvrc/pack.fnl @@ -4,29 +4,42 @@ (pack! :rktjmp/hotpot.nvim) (pack! :lewis6991/impatient.nvim) (pack! :nvim-lua/plenary.nvim {:module :plenary}) +(pack! :nathom/filetype.nvim {:req :filetype}) -(pack! :nanotech/jellybeans.vim {:event :VimEnter :config "require('nvrc.colors').apply()"}) +(pack! :nanotech/jellybeans.vim {:config "require('nvrc.colors').apply('jellybeans')"}) (pack! :feline-nvim/feline.nvim {:req :feline}) -(pack! :lukas-reineke/indent-blankline.nvim {:after :feline.nvim :req :blankline}) -(pack! :NvChad/nvim-colorizer.lua {:init :colorizer :event :BufRead}) -(pack! :nvim-treesitter/nvim-treesitter {:req :treesitter :defer :nvim-treesitter :run ":TSUpdate"}) -(pack! :lewis6991/gitsigns.nvim {:req :gitsigns :event :BufRead}) +(pack! :lukas-reineke/indent-blankline.nvim {:req :blankline}) +(pack! :NvChad/nvim-colorizer.lua {:init :colorizer :cmd :ColorizerToggle}) +(pack! :nvim-treesitter/nvim-treesitter {:req :treesitter :run ":TSUpdate"}) +(pack! :p00f/nvim-ts-rainbow) +(pack! :nvim-treesitter/nvim-treesitter-refactor) +(pack! :nvim-treesitter/nvim-treesitter-textobjects) +(pack! :JoosepAlviste/nvim-ts-context-commentstring) +(pack! :lewis6991/gitsigns.nvim {:req :gitsigns}) +(pack! :sindrets/diffview.nvim {:req :diffview :cmd [:DiffviewOpen :DiffviewFileHistory] :module_pattern [:diffview :diffview.*]}) (pack! :Pocco81/TrueZen.nvim {:cmd [:TZMinimalist :TZFocus :TZAtaraxis]}) (pack! :stefandtw/quickfix-reflector.vim {:ft :qf}) -(pack! :neovim/nvim-lspconfig {:req :lspconfig :module :lspconfig :setup (fn [] - ((. (require :nvrc.utils) :defer_unpack) :nvim-lspconfig 100) - (vim.defer_fn #(vim.cmd "if &ft == 'packer' | echo '' | else | silent! e %") 150))}) -(pack! :ray-x/lsp_signature.nvim {:req :lsp_signature :after :nvim-lspconfig}) -(pack! :hrsh7th/nvim-cmp {:req :cmp :event :InsertEnter}) -(pack! :hrsh7th/cmp-nvim-lsp {:after :nvim-cmp}) +(pack! :neovim/nvim-lspconfig {:req :lspconfig}) +(pack! :ray-x/lsp_signature.nvim {:req :lsp_signature}) +(pack! :hrsh7th/nvim-cmp {:req :cmp}) +(pack! :hrsh7th/cmp-nvim-lsp) -(pack! :luukvbaal/stabilize.nvim {:after :jellybeans.vim :init :stabilize}) +(pack! :luukvbaal/stabilize.nvim {:init :stabilize}) +(pack! :antoinemadec/FixCursorHold.nvim) (pack! :numToStr/Comment.nvim {:module :Comment :init :Comment}) -(pack! :kyazdani42/nvim-tree.lua {:req :nvimtree :defer :nvim-tree.lua}) -(pack! :ggandor/lightspeed.nvim {:keys [:s :S :x :X :f :F]}) +(pack! :lewis6991/spaceless.nvim {:init :spaceless}) +(pack! :tpope/vim-surround) +(pack! :junegunn/vim-easy-align {:keys "EasyAlign"}) +(pack! :monaqa/dial.nvim {:keys [: :]}) +(pack! :ggandor/lightspeed.nvim) +(pack! :nacro90/numb.nvim {:init :numb}) (pack! :ibhagwan/fzf-lua {:req :fzf :module :fzf-lua :cmd :FzfLua}) +(pack! :andymass/vim-matchup) +(pack! :ThePrimeagen/harpoon {:req :harpoon}) +(pack! :gpanders/editorconfig.nvim) -(pack! :bakpakin/fennel.vim {:ft :fennel}) +(pack! :simrat39/rust-tools.nvim {:init :rust-tools :ft :rust}) +(pack! :eraserhd/parinfer-rust {:ft [:fennel :clojure :query :lisp] :run "cargo build --release"}) (unpack!) diff --git a/fnl/nvrc/packs/diffview.fnl b/fnl/nvrc/packs/diffview.fnl new file mode 100644 index 0000000..a32dea5 --- /dev/null +++ b/fnl/nvrc/packs/diffview.fnl @@ -0,0 +1,7 @@ +(local {: setup} (require :diffview)) + +(setup {:enhanced_diff_hl true + :use_icons false + :key_bindings {:file_panel {:q "DiffviewClose"} + :file_history_panel {:q "DiffviewClose"} + :view {:q "DiffviewClose"}}}) diff --git a/fnl/nvrc/packs/filetype.fnl b/fnl/nvrc/packs/filetype.fnl new file mode 100644 index 0000000..d24d322 --- /dev/null +++ b/fnl/nvrc/packs/filetype.fnl @@ -0,0 +1,3 @@ +(local {: setup} (require :filetype)) + +(setup {:overrides {:complex {:.*neomutt-.* :mail}}}) diff --git a/fnl/nvrc/packs/harpoon.fnl b/fnl/nvrc/packs/harpoon.fnl new file mode 100644 index 0000000..073f406 --- /dev/null +++ b/fnl/nvrc/packs/harpoon.fnl @@ -0,0 +1,3 @@ +(local {: setup} (require :harpoon)) + +(setup {:save_on_toggle true}) diff --git a/fnl/nvrc/packs/mergetool.fnl b/fnl/nvrc/packs/mergetool.fnl new file mode 100644 index 0000000..5a8cfba --- /dev/null +++ b/fnl/nvrc/packs/mergetool.fnl @@ -0,0 +1,7 @@ +(import-macros {: setv!} :nvrc.macro.set) + +(setv! MergetoolSetLayoutCallback + (fn [split] + (when (and (= "mr,b" (. split :layout)) (= :b (. split :split))) + (set vim.wo.diff false) + (vim.cmd "resize 15")))) diff --git a/fnl/nvrc/packs/nvimtree.fnl b/fnl/nvrc/packs/nvimtree.fnl deleted file mode 100644 index 83326ea..0000000 --- a/fnl/nvrc/packs/nvimtree.fnl +++ /dev/null @@ -1,44 +0,0 @@ -(import-macros {: setv!} :nvrc.macro.set) -(local {: setup} (require :nvim-tree)) - -(setv! nvim_tree_add_trailing 0) -(setv! nvim_tree_git_hl 1) -(setv! nvim_tree_highlight_opened_files 0) -(setv! nvim_tree_indent_markers 1) -(setv! nvim_tree_quit_on_open 0) -(setv! nvim_tree_root_folder_modifier - (table.concat {1 ":t:gs?$?/.." 2 (string.rep " " 1000) 3 "?:gs?^??"})) -(setv! nvim_tree_window_picker_exclude - {:filetype {1 :notify 2 :packer 3 :qf} :buftype {1 :terminal}}) - -(setv! nvim_tree_show_icons {:folders 0 :files 0 :git 0 :folder_arrows 0}) - -; Nvimtree still shows folder icon despite folders being disabled -; Maybe the nvim_tree_show_icons option isn't really working? -(setv! nvim_tree_symlink_arrow " -> ") -(setv! nvim_tree_icons {:default "" - :symlink "~" - :git {:deleted :x - :ignored "?" - :renamed "->" - :staged "*" - :unmerged "!" - :unstaged "!" - :untracked "!"} - :folder {:default "+" - :empty "?" - :empty_open "-" - :open "-" - :symlink "~" - :symlink_open "~-"}}) - -(setup {:filters {:dotfiles false} - :disable_netrw true - :hijack_netrw true - :auto_close false - :open_on_tab false - :hijack_cursor true - :update_cwd true - :update_focused_file {:enable true :update_cwd false} - :view {:allow_resize true :side :left :width 25 :hide_root_folder true} - :git {:enable false :ignore false}}) diff --git a/fnl/nvrc/packs/treesitter.fnl b/fnl/nvrc/packs/treesitter.fnl index d43f97a..befcbc9 100644 --- a/fnl/nvrc/packs/treesitter.fnl +++ b/fnl/nvrc/packs/treesitter.fnl @@ -4,17 +4,27 @@ (setup {:ensure_installed [:fennel :lua :nix] :highlight {:enable true} + :context_commentstring {:enable true + :config {:fennel "; %s"}} + :rainbow {:enable true + :extended_mode true + :max_file_lines 2000 + :disable ["c" "cpp"] + :colors [ + (. colors :skyblue) + (. colors :blue) + (. colors :violet) + (. colors :magenta)]} :indent {:enable true} :refactor {:highlight_definitions {:enable true} :highlight_current_scope {:enable false} :smart_rename {:enable true - :keymaps {:smart_rename :rn}} + :keymaps {:smart_rename :grr}} :navigation {:enable true - :keymaps {:goto_definition :gd - :list_definitions :ld - :list_definitions_toc :td - :goto_next_usage : - :goto_previous_usage ""}}} + :keymaps {:goto_definition :gnd + :list_definitions :gnD + :goto_next_usage : + :goto_previous_usage :}}} :textobjects {:select {:enable true :lookahead true :keymaps {:if "@function.inner" -- cgit 1.4.1