-
Notifications
You must be signed in to change notification settings - Fork 12
/
vim.nix
159 lines (129 loc) · 3.14 KB
/
vim.nix
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
pkgs:
{
enable = true;
viAlias = true;
vimAlias = true;
plugins = with pkgs.vimPlugins; [
coc-nvim
editorconfig-vim
fzf-vim
fzfWrapper
LanguageClient-neovim
lightline-vim
nerdtree
supertab
tabular
vim-better-whitespace
vim-multiple-cursors
vim-surround
#vimproc
#vimproc-vim
# themes
wombat256
# language packages
# Elixir
vim-elixir
# Cue
vim-cue
# Elm
elm-vim
# HCL
vim-hcl
# Haskell
vim-hoogle
neco-ghc
haskell-vim
hlint-refactor-vim
ghc-mod-vim
# Hocon
vim-hocon
# Nix
vim-nix
# Csharp
vim-csharp
# Powershell
vim-ps1
# Python
semshi
# rust
#coc-rust-analyzer
YouCompleteMe
vim-toml
# sql
#sqlite-lua
];
extraPackages = with pkgs; [
#rust-analyzer
];
extraConfig = ''
colorscheme wombat256mod
syntax on
filetype plugin indent on
set splitbelow
set shiftwidth=2
set tabstop=2
set number
set expandtab
set foldmethod=indent
set foldnestmax=5
set foldlevelstart=99
set foldcolumn=0
" Displays column at character
set colorcolumn=80
set list
set listchars=tab:>-
let g:better_whitespace_enabled=1
let g:strip_whitespace_on_save=1
let mapleader=' '
let g:SuperTabDefaultCompletionType = '<c-x><c-o>'
if has("gui_running")
imap <c-space> <c-r>=SuperTabAlternateCompletion("\<lt>c-x>\<lt>c-o>")<cr>
else " no gui
if has("unix")
inoremap <Nul> <c-r>=SuperTabAlternateCompletion("\<lt>c-x>\<lt>c-o>")<cr>
endif
endif
let g:haskellmode_completion_ghc = 0
autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc
autocmd FileType markdown setlocal conceallevel=0
autocmd FileType cue setlocal shiftwidth=2 tabstop=2 expandtab
autocmd FileType cue DisableStripWhitespaceOnSave
" Format elm files after saving
autocmd BufWritePost *.elm silent !elm-format --yes <afile>
" Tabular bindings
let g:haskell_tabular = 1
vmap <leader>a= :Tabularize /=<CR>
vmap <leader>a; :Tabularize /::<CR>
vmap <leader>a- :Tabularize /-><CR>
vmap <leader>a# :Tabularize /#<CR>
" fzf bindings
nnoremap <leader>r :Rg<CR>
nnoremap <leader>b :Buffers<CR>
nnoremap <leader>e :Files<CR>
nnoremap <leader>l :Lines<CR>
nnoremap <leader>L :BLines<CR>
nnoremap <leader>c :Commits<CR>
nnoremap <leader>C :BCommits<CR>
" Wayland copy
nnoremap <C-@> :call system("wl-copy", @")<CR>
xnoremap <silent> <leader>y :w !wl-copy<CR><CR>
let g:cue_fmt_on_save = 0
let g:ycm_autoclose_preview_window_after_completion = 1
let g:ycm_language_server =
\ [
\ {
\ 'name': 'rust',
\ 'cmdline': ['rust-analyzer'],
\ 'filetypes': ['rust'],
\ 'project_root_files': ['Cargo.toml']
\ }
\ ]
let g:LanguageClient_serverCommands = {
\ 'rust': ['rust-analyzer'],
\ }
"CTRL-t to toggle tree view with CTRL-t
nmap <silent> <C-t> :NERDTreeToggle<CR>
"Set F2 to put the cursor to the nerdtree
nmap <silent> <F2> :NERDTreeFind<CR>
'';
}