瀏覽代碼

nixpkgs/neovim: switch to gitsigns and mini.statusline

Thomas Dy 3 年之前
父節點
當前提交
b403ff22aa
共有 3 個文件被更改,包括 34 次插入17 次删除
  1. 2 3
      .config/nixpkgs/neovim/flake.nix
  2. 25 0
      .config/nixpkgs/neovim/init.lua
  3. 7 14
      .config/nixpkgs/neovim/vimrc

+ 2 - 3
.config/nixpkgs/neovim/flake.nix

@@ -37,11 +37,11 @@
               vim-fugitive
               vim-surround
               vim-abolish
-              vim-signify
               undotree
               vim-merginal
               fzf-vim
-              lightline-vim
+              mini-nvim
+              gitsigns-nvim
               seti-vim
 
               (nvim-treesitter.withPlugins (p: with p; [
@@ -57,7 +57,6 @@
               ]))
 
               nvim-lspconfig
-              mini-nvim
               nvim-lsp-ts-utils
               null-ls-nvim
             ];

+ 25 - 0
.config/nixpkgs/neovim/init.lua

@@ -1,3 +1,28 @@
+require('gitsigns').setup()
+
+require('mini.statusline').setup({
+  content = {
+    active = function()
+      local mode, mode_hl = MiniStatusline.section_mode({ trunc_width = 120 })
+      local git           = MiniStatusline.section_git({ trunc_width = 75, icon = '' })
+      local diagnostics   = MiniStatusline.section_diagnostics({ trunc_width = 75, icon = '' })
+      local filename      = MiniStatusline.section_filename({ trunc_width = 140 })
+      local fileinfo      = MiniStatusline.section_fileinfo({ trunc_width = 120 })
+      local location      = MiniStatusline.section_location({ trunc_width = 75 })
+
+      return MiniStatusline.combine_groups({
+        { hl = mode_hl,                  strings = { mode } },
+        { hl = 'MiniStatuslineDevinfo',  strings = { git, diagnostics } },
+        '%<', -- Mark general truncate point
+        { hl = 'MiniStatuslineFilename', strings = { filename } },
+        '%=', -- End left alignment
+        { hl = 'MiniStatuslineFileinfo', strings = { fileinfo } },
+        { hl = mode_hl,                  strings = { location } },
+      })
+    end
+  },
+})
+
 require('nvim-treesitter.configs').setup {
   highlight = {
     enable = true,

+ 7 - 14
.config/nixpkgs/neovim/vimrc

@@ -1,17 +1,3 @@
-" ----- plugin settings ------
-let g:signify_vcs_list = [ 'git' ]
-
-let g:lightline = {
-      \ 'colorscheme': 'wombat',
-      \ 'active': {
-      \   'left': [ [ 'mode', 'paste' ],
-      \             [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
-      \ },
-      \ 'component_function': {
-      \   'gitbranch': 'fugitive#head'
-      \ },
-      \ }
-
 " ------ settings ------
 
 " change terminal title
@@ -138,3 +124,10 @@ highlight Normal ctermbg=NONE
 " Add a background for popups and floats to distinguish from regular text
 highlight Pmenu ctermbg=235 guibg=#282a2b
 highlight link FloatBorder Pmenu
+
+highlight MiniStatuslineModeNormal ctermbg=117 ctermfg=0
+highlight MiniStatuslineModeCommand ctermbg=117 ctermfg=0
+highlight MiniStatuslineModeInsert ctermbg=119 ctermfg=0
+highlight MiniStatuslineModeVisual ctermbg=216 ctermfg=0
+highlight MiniStatuslineModeReplace ctermbg=216 ctermfg=0
+highlight MiniStatuslineModeOther ctermbg=119 ctermfg=0