1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
|
{ config, pkgs, ... }:
let
font1 = "UW Ttyp0";
font2 = "Efont Biwidth";
xftBase = ":pixelsize=14:style=Regular:antialias=false";
xftFont1 = "${font1}${xftBase}";
xftFont2 = "${font2}${xftBase}";
colorBlack0 = "#161719";
colorBlack1 = "#969896";
colorRed0 = "#cc6666";
colorRed1 = "#cc6666";
colorGreen0 = "#b5bd68";
colorGreen1 = "#b5bd68";
colorYellow0 = "#f0c674";
colorYellow1 = "#f0c674";
colorBlue0 = "#81a2be";
colorBlue1 = "#81a2be";
colorMagenta0 = "#b294bb";
colorMagenta1 = "#b294bb";
colorCyan0 = "#8abeb7";
colorCyan1 = "#8abeb7";
colorWhite0 = "#c5c8c6";
colorWhite1 = "#ffffff";
in {
home = {
username = builtins.getEnv "USER";
homeDirectory = builtins.getEnv "HOME";
packages = with pkgs; [
bat
bear
ccls
clang-tools
cling
cmake-language-server
doxygen
fd
include-what-you-use
llvmPackages_12.clangUseLLVM
nixfmt
pandoc
pgcli
pipenv
plan9port
python-language-server
python39Packages.adblock
python39Packages.black
python39Packages.isort
python39Packages.pyflakes
rappel
ripgrep
ripgrep-all
shellcheck
shfmt
speedtest-cli
stdman
translate-shell
];
stateVersion = "21.11";
};
xdg = let localDirectory = "${config.home.homeDirectory}/.local";
in {
configHome = "${localDirectory}/etc";
dataHome = "${localDirectory}/var/lib";
cacheHome = "${localDirectory}/var/cache";
userDirs = let
atHome = dir: config.home.homeDirectory + "/" + dir;
tmp = atHome "tmp";
in {
enable = true;
createDirectories = true;
desktop = tmp;
documents = tmp;
download = tmp;
music = atHome "music";
pictures = tmp;
publicShare = tmp;
templates = tmp;
videos = tmp;
};
};
programs = {
home-manager.enable = true;
bat = {
enable = true;
config = {
style = "plain";
tabs = "4";
theme = "base16";
wrap = "never";
};
};
beets = {
enable = true;
settings = with config.xdg; {
library = "${dataHome}/beets/library.db";
directory = userDirs.music;
plugins = "badfiles edit fetchart info mbsync scrub";
original_date = true;
import = {
write = true;
copy = true;
move = false;
bell = true;
from_scratch = true;
};
match = {
preferred = {
countries =
[ "JP" "KR" "TW" "HK" "CN" "RU" "GB|UK" "AU" "NZ" "US" ];
original_year = true;
};
};
edit = {
albumfields = "album artist albumartist";
itemfields =
"track title album artist albumartist day month year genre";
};
fetchart = {
auto = true;
cautious = true;
cover_names =
"cover Cover folder Folder art Art album Album front Front";
sources = "filesystem coverart itunes amazon albumart wikipedia";
};
scrub.auto = true;
};
};
direnv = {
enable = true;
nix-direnv = {
enable = true;
enableFlakes = true;
};
};
neovim = {
enable = true;
extraConfig = ''
set autoread
set backspace=indent,eol,start
set clipboard=unnamed,unnamedplus
set fillchars=vert:\ "
set hidden
set lazyredraw
set modeline
set mouse=
set noshowmode
set path+=**
set statusline=
set statusline+=\ %m%r
set statusline+=%f\ "
set statusline+=%1*
set statusline+=%*
set statusline+=%=
set statusline+=%1*
set statusline+=\ %l:%c/%L\ %p%%\ "
set statusline+=%*
set noerrorbells
set novisualbell
set splitbelow
set splitright
set complete=
set complete+=.
set complete+=b
set complete+=t
set completeopt=
set completeopt+=menu
set completeopt+=longest
set gdefault
set hlsearch
set incsearch
set iskeyword+=-
set magic
set foldmethod=marker
set nofoldenable
set shortmess=
set shortmess+=I
set shortmess+=T
set shortmess+=a
set shortmess+=c
set shortmess+=t
set nolist
set nowrap
set scrolloff=10
set sidescrolloff=10
set number
set relativenumber
set wildignorecase
set wildmenu
set wildignore=
set nobackup
set noswapfile
set noundofile
set nowritebackup
set smartcase
set ignorecase
set autoindent
set breakindent
set smartindent
set expandtab
set shiftround
set shiftwidth=4
set smarttab
set softtabstop=4
set tabstop=4
try
set encoding=utf-8
scriptencoding utf-8
catch
endtry
if has('autocmd')
filetype on
filetype plugin on
filetype indent on
endif
if has('syntax')
syntax enable
endif
let mapleader = ' '
nnoremap <Expr> j v:count ? 'j' : 'gj'
nnoremap <Expr> k v:count ? 'k' : 'gk'
nnoremap J gt
nnoremap K gT
nnoremap <C-a> ^h
vnoremap <C-a> ^h
nnoremap H ^h
vnoremap H ^h
nnoremap <C-e> $
vnoremap <C-e> $
nnoremap L $
vnoremap L $
nnoremap N Nzzzv
nnoremap n nzzzv
vnoremap < <gv
vnoremap > >gv
nnoremap ]b :<C-u>bnext<CR>
nnoremap [b :<C-u>bprevious<CR>
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
nnoremap <C-l> :<C-u>nohlsearch<Bar>redraw!<Bar>echo<CR><C-l>
cnoremap ;/ <C-r>=expand('%:p:h').'/'<CR>
cnoremap ;; <C-r>=expand('%:t')<CR>
cnoremap ;. <C-r>=expand('%:p:r')<CR>
nnoremap <Leader>. :lcd %:p:h<CR>
cnoremap <C-a> <Home>
cnoremap <C-e> <End>
nnoremap gw vapgw
nnoremap Q @q
nnoremap <Leader>c ^v$h
nnoremap <Leader>v ggVG
map <Leader>sn ]s
map <Leader>sp [s
map <Leader>sa zg
map <Leader>s? z=
nnoremap <Leader>y "+y
nnoremap <Leader>Y "+Y
nnoremap <Leader>p "+p
nnoremap <Leader>P "+P
inoremap <C-v> <C-c>"+pi
cnoremap <C-v> <C-r>+
nmap <Leader>w :<C-u>w!<CR>
nmap <Leader>wq :<C-u>wq!<CR>
nnoremap ZX :<C-u>qa!<CR>
nnoremap <Leader>q :q<CR>
function! SwitchCase()
normal! ~
if strlen(getline('.')) != virtcol('.')
normal! h
endif
endfunction
nnoremap ~ :<C-u>call SwitchCase()<CR>
function! MapGoToTab()
let s:i = 1
while s:i < 10
exe 'nnoremap <Leader>' . s:i . ' :<C-u>tabnext ' . s:i . '<CR>'
let s:i += 1
endwhile
endfunction
call MapGoToTab()
autocmd BufEnter * set noreadonly
'';
plugins = with pkgs.vimPlugins; [
ansible-vim
auto-pairs
calendar-vim
csv-vim
editorconfig-vim
gentoo-syntax
neco-vim
neoinclude-vim
nginx-vim
rainbow_parentheses-vim
vim-SyntaxRange
vim-abolish
vim-commentary
vim-cool
vim-eunuch
vim-expand-region
vim-fugitive
vim-gnupg
vim-husk
vim-illuminate
vim-lastplace
vim-nix
vim-obsession
vim-polyglot
vim-repeat
vim-rhubarb
vim-shellcheck
vim-sleuth
vim-sneak
vim-speeddating
vim-surround
vim-tmux
vim-tmux-focus-events
vim-unimpaired
{
plugin = vim-clang-format;
config = ''
nnoremap <Buffer><Leader>cf :<C-u>ClangFormat<CR>
vnoremap <Buffer><Leader>cf :<C-u>ClangFormat<CR>
'';
}
{
plugin = LanguageClient-neovim;
config = ''
let g:LanguageClient_loadSettings = 1
nnoremap <Leader>lm :<C-u>call LanguageClient_contextMenu()<CR>
nnoremap <Leader>la :<C-u>call LanguageClient_workspace_applyEdit()<CR>
nnoremap <Leader>lc :<C-u>call LanguageClient#textDocument_completion()<CR>
nnoremap <Leader>ld :<C-u>call LanguageClient#textDocument_definition()<CR>
nnoremap <Leader>le :<C-u>call LanguageClient#textDocument_references()<CR>
nnoremap <Leader>lf :<C-u>call LanguageClient#textDocument_formatting()<CR>
nnoremap <Leader>lh :<C-u>call LanguageClient#textDocument_hover()<CR>
nnoremap <Leader>lr :<C-u>call LanguageClient#textDocument_rename()<CR>
nnoremap <Leader>ls :<C-u>call LanguageClient#textDocument_documentSymbol()<CR>
nnoremap <Leader>lt :<C-u>call LanguageClient#textDocument_typeDefinition()<CR>
let g:LanguageClient_serverCommands = {}
if executable('ccls')
let g:LanguageClient_serverCommands[ 'c' ] = [ 'ccls' ]
let g:LanguageClient_serverCommands[ 'cpp' ] = [ 'ccls' ]
nnoremap <Leader>h :<C-u>call LanguageClient#findLocations({'method':'$ccls/navigate','direction':'L'})<CR>
nnoremap <Leader>j :<C-u>call LanguageClient#findLocations({'method':'$ccls/navigate','direction':'D'})<CR>
nnoremap <Leader>k :<C-u>call LanguageClient#findLocations({'method':'$ccls/navigate','direction':'U'})<CR>
nnoremap <Leader>l :<C-u>call LanguageClient#findLocations({'method':'$ccls/navigate','direction':'R'})<CR>
elseif executable('clangd')
let g:LanguageClient_serverCommands[ 'c' ] = [ 'clangd', '-background-index' ]
let g:LanguageClient_serverCommands[ 'cpp' ] = [ 'clangd', '-background-index' ]
endif
if executable('gopls')
let g:LanguageClient_serverCommands[ 'go' ] = [ 'gopls' ]
endif
if executable('haskell-language-server-wrapper')
let g:LanguageClient_serverCommands[ 'haskell' ] = [ 'haskell-language-server-wrapper', '--lsp' ]
endif
if executable('pyls')
let g:LanguageClient_serverCommands[ 'python' ] = [ 'pyls' ]
endif
'';
}
];
withNodeJs = false;
withPython3 = true;
withRuby = false;
};
zathura = {
enable = true;
options = {
font = font1;
default-fg = colorWhite0;
default-bg = colorBlack0;
statusbar-fg = colorBlack0;
statusbar-bg = colorWhite0;
inputbar-fg = colorBlack0;
inputbar-bg = colorGreen1;
notification-fg = colorBlack0;
notification-bg = colorBlue1;
notification-error-fg = colorBlack0;
notification-error-bg = colorRed1;
notification-warning-fg = colorBlack0;
notification-warning-bg = colorYellow1;
highlight-color = colorYellow1;
highlight-active-color = colorYellow0;
completion-fg = colorWhite1;
completion-bg = colorBlack1;
completion-highlight-fg = colorBlack0;
completion-highlight-bg = colorRed1;
completion-group-fg = colorBlack0;
completion-group-bg = colorRed1;
recolor-darkcolor = colorBlack0;
recolor-lightcolor = colorWhite0;
recolor = true;
recolor-keephue = false;
recolor-reverse-video = false;
highlight-transparency = "0.3";
n-completion-items = 10;
guioptions = "";
statusbar-basename = true;
statusbar-home-tilde = true;
statusbar-h-padding = 0;
statusbar-v-padding = 0;
window-height = 800;
window-width = 600;
window-icon = "";
abort-clear-search = true;
incremental-search = true;
adjust-open = "best-fit";
advance-pages-per-row = false;
database = "sqlite";
dbus-service = false;
page-padding = 0;
pages-per-row = 1;
render-loading = false;
show-directories = true;
show-hidden = true;
show-recent = 10;
link-zoom = true;
link-hadjust = true;
window-title-basename = true;
window-title-home-tilde = true;
window-title-page = true;
zoom-center = false;
zoom-max = 1000;
zoom-min = 10;
zoom-step = 10;
scroll-hstep = -1;
scroll-step = 40;
scroll-full-overlap = 0;
scroll-wrap = true;
scroll-page-aware = false;
selection-clipboard = "primary";
selection-notification = false;
};
};
};
xresources = {
properties = {
"*.font" = xftFont1;
"Xcursor.theme" = "core";
"Xcursor.theme_core" = "true";
"Xcursor.size" = 16;
"Xft.antialias" = 1;
"Xft.autohint" = 0;
"Xft.dpi" = 96;
"Xft.hinting" = 1;
"Xft.hintstyle" = "hintslight";
"Xft.lcdfilter" = "lcddefault";
"Xft.rgba" = "rgb";
"*.color0" = colorBlack0;
"*.color8" = colorBlack1;
"*.color1" = colorRed0;
"*.color9" = colorRed1;
"*.color2" = colorGreen0;
"*.color10" = colorGreen1;
"*.color3" = colorYellow0;
"*.color11" = colorYellow1;
"*.color4" = colorBlue0;
"*.color12" = colorBlue1;
"*.color5" = colorMagenta0;
"*.color13" = colorMagenta1;
"*.color6" = colorCyan0;
"*.color14" = colorCyan1;
"*.color7" = colorWhite0;
"*.color15" = colorWhite1;
"*.background" = colorBlack0;
"*.foreground" = colorWhite0;
};
};
}
|