about summary refs log tree commit diff
path: root/nix
diff options
context:
space:
mode:
authorNguyễn Gia Phong <cnx@loang.net>2023-11-19 21:37:24 +0900
committerNguyễn Gia Phong <cnx@loang.net>2023-11-19 21:37:24 +0900
commitdc0154041bba4ab9017e86b8218c501e935fd9cf (patch)
tree396781c29324342c07bd541912e7c68bf20fc076 /nix
parent5e2354e8f819875ac3d981cb94eddfbe0d00eb77 (diff)
downloaddotfiles-dc0154041bba4ab9017e86b8218c501e935fd9cf.tar.gz
Config vim and git in nix
Diffstat (limited to 'nix')
-rw-r--r--nix/devel.nix107
1 files changed, 101 insertions, 6 deletions
diff --git a/nix/devel.nix b/nix/devel.nix
index 28311f8..d977dd4 100644
--- a/nix/devel.nix
+++ b/nix/devel.nix
@@ -2,19 +2,114 @@
 
 {
   environment.systemPackages = with pkgs; [
-    bat comma fd jq ripgrep vim_configurable
     bintools gdb gnumake pkg-config
-    exa gitAndTools.gitFull minicom rlwrap
     gcc go guile_3_0 lua rakudo zig
+    fd htmlq jq ripgrep rlwrap
     man-pages man-pages-posix stdman
     texlive.combined.scheme-full
     (python3.withPackages (pypkgs: with pypkgs; [ flit rsskey ]))
+    (vim_configurable.customize {
+      vimrcConfig = {
+        customRC = ''
+          set nocompatible
+          set undodir=~/.cache/vim/undo
+          set directory=~/.cache/vim/swap
+          set backupdir=~/.cache/vim/backup
+          set viminfo+=n~/.cache/vim/viminfo
+          set title clipboard=unnamedplus autochdir
+
+          set ignorecase infercase
+          set dictionary=${miscfiles}/share/web2,${miscfiles}/share/web2a
+          set omnifunc=syntaxcomplete#Complete
+          set keymap=vietnamese-telex imdisable iminsert=0 imsearch=-1
+          imap <C-x><C-x> <C-^>
+          map Q gq
+          command Q q
+          command W w
+          nmap W :w<CR>
+
+          set showcmd noshowmode ruler wildmenu confirm number relativenumber
+          set diffopt+=algorithm:patience
+          set tabstop=8 expandtab shiftwidth=4 softtabstop=-1 smarttab
+          set list listchars+=space:·,tab:\ \ 
+          set t_Co=256
+          let g:srcery_hard_black_terminal_bg = 0
+          let g:srcery_italic = 1
+          let g:srcery_italic_types = 1
+          let g:srcery_orange_cterm = 9
+          let g:srcery_bright_orange_cterm = 11
+          let g:srcery_hard_black_cterm = 231
+          let g:srcery_xgray1_cterm = 255
+          let g:srcery_xgray2_cterm = 254
+          let g:srcery_xgray3_cterm = 253
+          let g:srcery_xgray4_cterm = 252
+          let g:srcery_xgray5_cterm = 251
+          let g:srcery_xgray6_cterm = 250
+          colorscheme srcery
+
+          let g:jedi#popup_on_dot = 0
+          let g:jedi#popup_select_first = 0
+          let g:jedi#show_call_signatures = 2
+          let g:jedi#smart_auto_mappings = 0
+          let g:polyglot_disabled = ['latex']
+          let g:tex_flavor='latex'
+          let g:vimtex_indent_enabled=0
+          let g:vimtex_quickfix_mode=0
+          let g:zig_fmt_autosave = 0
+
+          augroup ft
+            autocmd BufNewFile,BufRead *.vert,*.geom,*.frag
+                  \ setlocal filetype=glsl
+            autocmd BufNewFile,BufRead *.info setlocal filetype=json
+            autocmd BufNewFile,BufRead *.ms setlocal filetype=groff
+            autocmd BufNewFile,BufRead *.m setlocal filetype=octave
+            autocmd BufNewFile,BufRead CHANGES setlocal filetype=mail
+          augroup END
+
+          augroup fmt
+            autocmd FileType asm,automake,c,h,go,glsl,make,php
+                  \ setlocal cindent cinoptions=(0 noexpandtab shiftwidth=8 tabstop=8
+            autocmd FileType diff,gitconfig,gitsendemail,mail,sshconfig,tsv
+                  \ setlocal cindent cinoptions=(0 noexpandtab shiftwidth=8 tabstop=8
+            autocmd FileType vim,sh,scheme,lua,tex,cmake,plantuml,html,pascal
+                  \ setlocal shiftwidth=2
+            autocmd FileType cpp
+                  \ setlocal cindent cinoptions=>4,n-2,{2,^-2,:2,=2,g0,h2,p5,t0,+2,(0,u0,w1,m1
+            autocmd FileType rst setlocal shiftwidth=3
+            autocmd FileType mail,markdown,rst,tex setlocal spell
+            autocmd BufWinEnter *
+                  \ if &filetype ==# 'python' || &filetype ==# 'cython'
+                  \ || &filetype ==# 'mail'
+                  \ | let w:m1=matchadd('ColorColumn', '\%<80v.\%>73v', -1) |
+                  \ else
+                  \ | let w:m1=matchadd('ColorColumn', '\%<81v.\%>80v', -1) |
+                  \ endif
+          augroup END
+
+          augroup pkg
+            autocmd FileType python :packadd jedi-vim
+            autocmd FileType tex :packadd vimtex
+            autocmd ColorScheme * highlight! link SpecialKey SrceryXgray4
+          augroup END
+        '';
+        packages.myVimPackage = with vimPlugins; {
+          start = [ ranger-vim srcery-vim vim-polyglot ];
+          opt = [ jedi-vim vimtex ];
+        };
+      };
+    })
   ];
 
-  programs.gnupg.agent = {
-    enable = true;
-    enableSSHSupport = true;
-    pinentryFlavor = "qt";
+  programs = {
+    git = {
+      enable = true;
+      package = pkgs.gitFull;
+    };
+    gnupg.agent = {
+      enable = true;
+      enableSSHSupport = true;
+      pinentryFlavor = "qt";
+    };
   };
 
   services.openssh = {