diff options
author | sefidel <contact@sefidel.net> | 2022-02-16 08:54:25 +0900 |
---|---|---|
committer | sefidel <contact@sefidel.net> | 2022-02-16 17:16:41 +0900 |
commit | 2fb74089d3515077395299bce9df32e9e989a8ac (patch) | |
tree | b7e8064cff1c687a11788ab96f96cbcf6d3c88fa | |
parent | 6b4cacae7b9c435666c2ec399261f6504336bdce (diff) | |
download | nvimrc-2fb74089d3515077395299bce9df32e9e989a8ac.tar.gz nvimrc-2fb74089d3515077395299bce9df32e9e989a8ac.zip |
rel: v0.1
- Disable lazy-loading plugins - Add more useful plugins - Fix bar from loading slowly - Add support for neomutt - Change keybinds - Add Editorconfig
-rw-r--r-- | .editorconfig | 17 | ||||
-rw-r--r-- | fnl/nvrc/colors.fnl | 42 | ||||
-rw-r--r-- | fnl/nvrc/keymaps.fnl | 30 | ||||
-rw-r--r-- | fnl/nvrc/options.fnl | 36 | ||||
-rw-r--r-- | fnl/nvrc/pack.fnl | 43 | ||||
-rw-r--r-- | fnl/nvrc/packs/diffview.fnl | 7 | ||||
-rw-r--r-- | fnl/nvrc/packs/filetype.fnl | 3 | ||||
-rw-r--r-- | fnl/nvrc/packs/harpoon.fnl | 3 | ||||
-rw-r--r-- | fnl/nvrc/packs/mergetool.fnl | 7 | ||||
-rw-r--r-- | fnl/nvrc/packs/nvimtree.fnl | 44 | ||||
-rw-r--r-- | fnl/nvrc/packs/treesitter.fnl | 22 | ||||
-rw-r--r-- | init.lua | 2 |
12 files changed, 137 insertions, 119 deletions
diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..a4e6da6 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,17 @@ +root = true + +[*.fnl] +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true + +[*.lua] +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true + +[*.md] +indent_style = space +indent_size = 4 +max_line_length = 80 +trim_trailing_whitespace = false 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] :<space> "" "") (setv! mapleader " ") -(map! [n :silent] :<leader>fe ":NvimTreeToggle <cr>") -(map! [n :silent] :<leader>ft ":NvimTreeFocus <cr>") +(map! [n :silent] :<leader>e ":bprev <cr>") +(map! [n :silent] :<leader>r ":bnext <cr>") (map! [n :silent] :<leader>/ ":lua require('Comment.api').toggle_current_linewise() <cr>") @@ -16,27 +16,37 @@ (map! [n :silent] :<leader>fc ":FzfLua grep <cr>") (map! [n :silent] :<leader>fs ":FzfLua live_grep <cr>") (map! [n :silent] :<leader>fb ":FzfLua buffers <cr>") -(map! [n :silent] :<leader>gc ":FzfLua git_commits <cr>") -(map! [n :silent] :<leader>gs ":FzfLua git_status <cr>") +(map! [n :silent] :<leader>fg ":FzfLua git_commits <cr>") +(map! [n :silent] :<leader>fs ":FzfLua git_status <cr>") (map! [n] :f :<plug>Lightspeed_f) (map! [n] :F :<plug>Lightspeed_F) (map! [n] :t :<plug>Lightspeed_t) (map! [n] :T :<plug>Lightspeed_T) -(map! [n :silent] :<leader>rm ":TZMinimalist <cr>") -(map! [n :silent] :<leader>rf ":TZFocus <cr>") -(map! [n :silent] :<leader>ra ":TZAtaraxis <cr>") +(map! [n :silent] :<leader>mm ":TZMinimalist <cr>") +(map! [n :silent] :<leader>mf ":TZFocus <cr>") +(map! [n :silent] :<leader>ma ":TZAtaraxis <cr>") + +(map! [n :silent] :<leader>h ":lua require('harpoon.ui').nav_file(1) <cr>") +(map! [n :silent] :<leader>j ":lua require('harpoon.ui').nav_file(2) <cr>") +(map! [n :silent] :<leader>k ":lua require('harpoon.ui').nav_file(3) <cr>") +(map! [n :silent] :<leader>l ":lua require('harpoon.ui').nav_file(4) <cr>") +(map! [n :silent] "<leader>;" ":lua require('harpoon.term').gotoTerminal(1) <cr>") +(map! [n :silent] "<leader>'" ":lua require('harpoon.term').gotoTerminal(2) <cr>") +(map! [n :silent] :<leader>g ":lua require('harpoon.ui').toggle_quick_menu() <cr>") +(map! [n :silent] :<leader>u ":lua require('harpoon.mark').add_file() <cr>") (map! [t] :jk "<C-\\><C-n>") (map! [t :silent] :JK "<C-\\><C-n> :lua require ('nvrc.utils').del_buf() <cr>") ; FIXME This opens on top of existing vertical/horizontal term +; TODO come up with a better category key (map! [n :silent] :<leader>th ":execute 15 .. 'new +terminal' | let b:term_type = 'hori' <cr>") -(map! [n :silent] :<leader>tv ":execute 'vnew +terminal' | let b:term_type = 'vert' <cr>") -(map! [n :silent] :<leader>tn ":execute 'terminal' | let b:term_type = 'wind' <cr>") +(map! [n :silent] :<leader>tj ":execute 'vnew +terminal' | let b:term_type = 'vert' <cr>") +(map! [n :silent] :<leader>tk ":execute 'terminal' | let b:term_type = 'wind' <cr>") (map! [n :silent] :<leader>q ":lua require('nvrc.utils').del_buf() <cr>") (map! [n :silent] :<leader>ya ":%y+ <cr>") (map! [n :silent] :<leader>bn ":enew <cr>") (map! [n :silent] :<leader>wn ":tabnew <cr>") -(map! [n :silent] :<leader>lt ":set nu! <cr>") +(map! [n :silent] :<leader>tl ":set nu! <cr>") 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 "<Plug>EasyAlign"}) +(pack! :monaqa/dial.nvim {:keys [:<C-a> :<C-x>]}) +(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 "<cmd>DiffviewClose<cr>"} + :file_history_panel {:q "<cmd>DiffviewClose<cr>"} + :view {:q "<cmd>DiffviewClose<cr>"}}}) 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 :<localleader>rn}} + :keymaps {:smart_rename :grr}} :navigation {:enable true - :keymaps {:goto_definition :<localleader>gd - :list_definitions :<localleader>ld - :list_definitions_toc :<localleader>td - :goto_next_usage :<a-*> - :goto_previous_usage "<a-#>"}}} + :keymaps {:goto_definition :gnd + :list_definitions :gnD + :goto_next_usage :<M-2> + :goto_previous_usage :<M-1>}}} :textobjects {:select {:enable true :lookahead true :keymaps {:if "@function.inner" diff --git a/init.lua b/init.lua index 6829152..c14a467 100644 --- a/init.lua +++ b/init.lua @@ -20,6 +20,4 @@ ensure("wbthomason", "packer.nvim") ensure("rktjmp", "hotpot.nvim") require("hotpot").setup { provide_require_fennel = true } -vim.opt.termguicolors = true - require("nvrc.ignite") |