blob: f1dba85d84d6f7a7dc4e3b7afc4d916ab6808147 (
plain) (
blame)
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
|
{
config,
lib,
pkgs,
this,
...
}:
with lib;
let
cfg = config.nixfiles.modules.vim;
in
{
options.nixfiles.modules.vim.enable = mkEnableOption "Vim";
config = mkIf cfg.enable {
hm.stylix.targets.vim.enable = false;
programs.vim = {
enable = true;
defaultEditor = true;
package = mkIf this.isHeadful (
pkgs.vim-full.customize {
name = "vim";
vimrcConfig = with cfg; {
customRC = ''
let $VIMFILES = expand('<sfile>:p:h')
let g:skip_defaults_vim = 1
let g:netrw_dirhistmax = 0
if has('unnamedplus')
set clipboard^=unnamedplus
else
set clipboard^=unnamed
endif
set viminfo=
set diffopt+=iwhite
set hidden
set lazyredraw
set mouse=
set path+=**
set cmdheight=1
set fillchars=vert:\ "
set modeline
set noshowmode
set shortmess+=I
set textwidth=0
set title
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 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
if v:version >= 700
set numberwidth=3
endif
set wildignorecase
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
set colorcolumn=
let g:EditorConfig_max_line_indicator = "none"
nnoremap <Space> <Nop>
let mapleader=" "
nnoremap :W :w
nnoremap :W! :w!
nnoremap :Q :q
nnoremap :Q! :q!
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
inoremap <C-U> <C-g>u<C-u>
inoremap <C-W> <C-g>u<C-w>
vnoremap < <gv
vnoremap > >gv
vnoremap <Tab> >gv
vnoremap <S-Tab> <gv
nnoremap <Tab> >>_
nnoremap <S-Tab> <<_
nnoremap ]b :bnext<CR>
nnoremap [b :bprevious<CR>
nnoremap <C-H> <C-w>h
nnoremap <C-J> <C-w>j
nnoremap <C-K> <C-w>k
nnoremap <C-R> <C-w>l
nnoremap * /\<<C-r>=expand('<cword>')<CR>\><CR>
nnoremap # ?\<<C-r>=expand('<cword>')<CR>\><CR>
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>
nnoremap Q @q
nnoremap <Leader>c ^v$h
nnoremap <Leader>v ggVG
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 :w!<CR>
nmap <Leader>wq :wq!<CR>
nnoremap ZX :qa!<CR>
nnoremap <Leader>q :q<CR>
command WS w !sudo tee "%" >/dev/null
'';
packages.myVimPackage.start = with pkgs.vimPlugins; [
editorconfig-vim
vim-eunuch
vim-nix
vim-sensible
vim-sleuth
vim-surround
vim-unimpaired
];
};
}
);
};
};
}
|