+34
-14
nixpkgs/home.nix
+34
-14
nixpkgs/home.nix
···
1
-
{ config, pkgs, ... }:
1
+
{ config, pkgs, lib, ... }:
2
2
3
3
let
4
-
# set channel channel to pkgs-unstable
4
+
# set channel channel to nixpkgs-unstable
5
5
pkgs = import <nixpkgs> {};
6
+
# https://github.com/nix-community/neovim-nightly-overlay
6
7
in
7
8
{
8
9
# Let Home Manager install and manage itself.
···
23
24
24
25
# Allow installation of propietary of "unfree" packages. Needed for parts of
25
26
# mozilla overlay.
26
-
# pkgs.config.allowUnfree = true;
27
-
# pkgs.overlays = [ (import "${mozilla-overlays}") ];
27
+
# nixpkgs.config.allowUnfree = true;
28
+
# nixpkgs.overlays = [ (import "${mozilla-overlays}") ];
29
+
nixpkgs.overlays = [
30
+
(import (builtins.fetchTarball {
31
+
url = https://github.com/nix-community/neovim-nightly-overlay/archive/master.tar.gz;
32
+
}))
33
+
];
28
34
35
+
services.lorri.enable = true;
29
36
home.packages = with pkgs; [
37
+
direnv
38
+
niv
39
+
30
40
git
31
41
bat
32
42
exa
···
71
81
# nix language server
72
82
rnix-lsp
73
83
74
-
golangci-lint
84
+
# delve
85
+
# protobuf
86
+
# golangci-lint XXX fixme: maybe bring this guy back w/ lorri/direnv?
75
87
];
76
88
77
89
programs.zsh = import ./zsh-conf.nix { pkgs = pkgs; };
···
79
91
80
92
programs.neovim = {
81
93
enable = true;
82
-
package = pkgs.neovim-unwrapped;
94
+
# package = pkgs.neovim-unwrapped;
83
95
84
96
vimdiffAlias = true;
85
97
withNodeJs = true;
86
98
withPython3 = true;
87
99
88
-
# plugins = with pkgs; [
89
-
# vimPlugins.gruvbox
90
-
# ];
100
+
plugins = with pkgs; [
101
+
vimPlugins.gruvbox
102
+
vimPlugins.nvim-lspconfig
103
+
104
+
vimPlugins.completion-tabnine
105
+
{
106
+
plugin = vimPlugins.completion-nvim;
107
+
# I'll want to move this to a .vim file and readFile it
108
+
config = builtins.readFile "${builtins.getEnv "HOME"}/.config/nvim/config/plugins/completion-nvim.vim";
109
+
}
110
+
];
91
111
92
112
# extraConfig = builtins.readFile "${builtins.getEnv "HOME"}/.config/nvim/init.vim";
93
113
extraConfig = builtins.readFile "${builtins.getEnv "HOME"}/.config/nvim/init.templ.vim";
···
104
124
changeDirWidgetCommand = "fd --type d --hidden --exclude '.git' --follow";
105
125
};
106
126
107
-
# programs.go = {
108
-
# enable = true;
109
-
# goPath = "${builtins.getEnv "HOME"}/gopath";
110
-
# goBin = "${builtins.getEnv "HOME"}/gobin";
111
-
# };
127
+
programs.go = {
128
+
enable = true;
129
+
goPath = "${builtins.getEnv "HOME"}/gopath";
130
+
goBin = "${builtins.getEnv "HOME"}/gobin";
131
+
};
112
132
}
+3
nixpkgs/zsh-conf.nix
+3
nixpkgs/zsh-conf.nix
···
24
24
sessionVariables = {
25
25
KEYTIMEOUT = 1;
26
26
EDITOR = "nvim";
27
+
#XDG_RUNTIME_DIR="/run/user/$(id -u)"; # https://github.com/Trundle/NixOS-WSL/issues/18
27
28
};
28
29
initExtraBeforeCompInit = ''
29
30
'';
···
43
44
zle -N edit-command-line
44
45
bindkey -M vicmd V edit-command-line
45
46
47
+
#sudo loginctl enable-linger "$USER" # https://github.com/Trundle/NixOS-WSL/issues/18
48
+
#eval "$(direnv hook zsh)"
46
49
eval "$(starship init zsh)"
47
50
'';
48
51
envExtra = ''
+44
nvim/config/lsp.lua
+44
nvim/config/lsp.lua
···
1
+
local nvim_lsp = require('lspconfig')
2
+
3
+
-- vim.lsp.set_log_level("debug")
4
+
5
+
-- Use an on_attach function to only map the following keys
6
+
-- after the language server attaches to the current buffer
7
+
local on_attach = function(client, bufnr)
8
+
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
9
+
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
10
+
11
+
--Enable completion triggered by <c-x><c-o>
12
+
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
13
+
14
+
-- Mappings.
15
+
local opts = { noremap=true, silent=true }
16
+
17
+
-- See `:help vim.lsp.*` for documentation on any of the below functions
18
+
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
19
+
buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
20
+
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
21
+
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
22
+
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
23
+
buf_set_keymap('n', '<leader>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
24
+
buf_set_keymap('n', '<leader>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
25
+
buf_set_keymap('n', '<leader>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
26
+
buf_set_keymap('n', '<leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
27
+
buf_set_keymap('n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
28
+
buf_set_keymap('n', '<leader>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
29
+
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
30
+
buf_set_keymap('n', '<leader>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
31
+
buf_set_keymap('n', '<C-Q>', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
32
+
buf_set_keymap('n', '<C-q>', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
33
+
buf_set_keymap('n', '<leader>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
34
+
buf_set_keymap("n", "<leader>ff", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
35
+
36
+
end
37
+
38
+
-- Use a loop to conveniently call 'setup' on multiple servers and
39
+
-- map buffer local keybindings when the language server attaches
40
+
-- local servers = { "gopls", "rust_analyzer", "tsserver", "tabnine" }
41
+
local servers = { "gopls", "rnix" }
42
+
for _, lsp in ipairs(servers) do
43
+
nvim_lsp[lsp].setup { on_attach = on_attach }
44
+
end
+22
nvim/config/plugins/completion-nvim.vim
+22
nvim/config/plugins/completion-nvim.vim
···
1
+
" Use completion-nvim in every buffer
2
+
autocmd BufEnter * lua require'completion'.on_attach()
3
+
4
+
" possible value: 'UltiSnips', 'Neosnippet', 'vim-vsnip', 'snippets.nvim'
5
+
let g:completion_enable_snippet = 'UltiSnips'
6
+
7
+
imap <tab> <Plug>(completion_smart_tab)
8
+
imap <s-tab> <Plug>(completion_smart_s_tab)
9
+
10
+
" Use <Tab> and <S-Tab> to navigate through popup menu
11
+
" Disabling for now because of conflicts w/ supertab?
12
+
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
13
+
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
14
+
15
+
" Set completeopt to have a better completion experience
16
+
set completeopt=menuone,noinsert,noselect
17
+
18
+
" Avoid showing message extra message when using completion
19
+
set shortmess+=c
20
+
21
+
" Just disabling for now because it's throwing lua errors
22
+
let g:completion_enable_auto_signature = 0
+9
nvim/custom/coc.vim
nvim/config/coc.vim
+9
nvim/custom/coc.vim
nvim/config/coc.vim
···
1
+
" Remap for rename current word
2
+
nmap <leader>rn <Plug>(coc-rename)
3
+
1
4
" Documentation
2
5
nnoremap <silent> K :call <SID>show_documentation()<CR>
3
6
let g:go_doc_keywordprg_enabled = 0 " let coc handle this
···
17
20
" Update signature help on jump placeholder
18
21
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
19
22
augroup end
23
+
24
+
" autocmd FileType rust,javascript,go nmap <silent> gd <Plug>(coc-definition)
25
+
nmap <silent> <leader>ff :call CocAction('format')<CR>
26
+
27
+
" autocmd FileType html,javascript,css,typescript nmap <silent> <leader>ff :CocCommand prettier.formatFile<cr>
28
+
" nmap <silent> <leader>ff :CocCommand prettier.formatFile<cr>
nvim/custom/go.vim
nvim/config/go.vim
nvim/custom/go.vim
nvim/config/go.vim
+1
-1
nvim/custom/looks.vim
nvim/config/looks.vim
+1
-1
nvim/custom/looks.vim
nvim/config/looks.vim
nvim/custom/misc_funcs.vim
nvim/config/misc_funcs.vim
nvim/custom/misc_funcs.vim
nvim/config/misc_funcs.vim
+13
-19
nvim/init.templ.vim
+13
-19
nvim/init.templ.vim
···
2
2
" current plugin state. I may be able to generate one, commit it, add it as a
3
3
" dependency in my nix conf.
4
4
call plug#begin('~/.config/nvim/plugged')
5
-
Plug 'neoclide/coc.nvim', {'branch': 'release'}
5
+
" Plug 'neoclide/coc.nvim', {'branch': 'release'}
6
6
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
7
7
Plug 'junegunn/fzf'
8
8
Plug 'LnL7/vim-nix'
···
13
13
" Plug 'zchee/deoplete-go', { 'do': 'make' }
14
14
15
15
Plug 'majutsushi/tagbar' " source code nav in sidebar
16
-
Plug 'dense-analysis/ale'
16
+
" Plug 'dense-analysis/ale'
17
17
Plug 'vim-airline/vim-airline'
18
18
Plug 'vim-airline/vim-airline-themes'
19
19
Plug 'scrooloose/nerdtree'
···
24
24
" Plug 'Raimondi/delimitMate'
25
25
Plug 'christoomey/vim-tmux-navigator'
26
26
Plug 'cohama/lexima.vim' " adds auto-closing; not sure how this interacts with tpop/vim-endwise
27
-
Plug 'ervandew/supertab'
27
+
" Plug 'ervandew/supertab'
28
28
" Plug 'milkypostman/vim-togglelist' " toggle loclist and quickfix
29
29
Plug 'rhysd/vim-crystal' " support for crystal lang
30
30
" Plug 'leafgarland/typescript-vim'
···
47
47
Plug 'dracula/vim', { 'as': 'dracula' }
48
48
Plug 'chriskempson/base16-vim'
49
49
Plug 'iCyMind/NeoSolarized'
50
-
Plug 'morhetz/gruvbox'
50
+
" Plug 'morhetz/gruvbox'
51
51
Plug 'sonph/onehalf', { 'rtp': 'vim/' }
52
52
53
53
"Plug 'maksimr/vim-jsbeautify'
···
68
68
Plug 'pangloss/vim-javascript'
69
69
call plug#end()
70
70
71
-
source ~/.config/nvim/custom/looks.vim
72
-
source ~/.config/nvim/custom/go.vim
73
-
source ~/.config/nvim/custom/coc.vim
74
-
source ~/.config/nvim/custom/misc_funcs.vim
71
+
source ~/.config/nvim/config/looks.vim
72
+
source ~/.config/nvim/config/go.vim
73
+
" source ~/.config/nvim/config/coc.vim
74
+
source ~/.config/nvim/config/misc_funcs.vim
75
+
luafile ~/.config/nvim/config/lsp.lua
75
76
76
77
" XXX for vim-highlightedyank, can delete this on newer versions of neovim
77
78
" if !exists('##TextYankPost')
···
89
90
90
91
" Potential performance improvemenets (scrolling)
91
92
set noshowcmd
92
-
set nolazyredraw
93
+
" set nolazyredraw
93
94
94
95
" base64 encoding/decoding
95
96
" Visual Mode mappings
···
105
106
autocmd FileType markdown setlocal textwidth=80 expandtab wrap spell
106
107
autocmd FileType proto setlocal ts=4 expandtab
107
108
108
-
109
-
" Remap for rename current word
110
-
nmap <leader>rn <Plug>(coc-rename)
111
109
112
110
" set folding method to be language defined and files are not folded when
113
111
" opened
···
163
161
nmap <C-n> :bnext<CR>
164
162
nmap <C-m> :bprev<CR>
165
163
166
-
" autocmd FileType rust,javascript,go nmap <silent> gd <Plug>(coc-definition)
167
-
nmap <silent> <leader>ff :call CocAction('format')<CR>
168
164
169
165
au BufNewFile,BufRead *.ejs set filetype=html
170
-
" autocmd FileType html,javascript,css,typescript nmap <silent> <leader>ff :CocCommand prettier.formatFile<cr>
171
-
" nmap <silent> <leader>ff :CocCommand prettier.formatFile<cr>
172
166
173
167
"nmap <leader>.. :lclose<CR>
174
168
nmap <script> <silent> <leader>.. :call ToggleLocationList()<CR>
175
169
176
170
" ale
177
-
nmap <silent> <C-Q> <Plug>(ale_previous_wrap)
178
-
nmap <silent> <C-q> <Plug>(ale_next_wrap)
171
+
" nmap <silent> <C-Q> <Plug>(ale_previous_wrap)
172
+
" nmap <silent> <C-q> <Plug>(ale_next_wrap)
179
173
" nmap <silent> <leader>Q <Plug>(ale_previous_wrap)
180
174
" nmap <silent> <leader>q <Plug>(ale_next_wrap)
181
175
" nmap <silent> <C-Q> <Plug>(coc-diagnostic-prev)
···
257
251
nmap <leader>' i'<Esc>p
258
252
259
253
" https://github.com/neovim/neovim/issues/2528#issuecomment-239993819
260
-
hi Normal ctermbg=NONE
254
+
" hi Normal ctermbg=NONE
261
255
262
256
" rust
263
257
" let g:rustfmt_autosave = 1