2021-04-15 12:23:55 +02:00
|
|
|
{ pkgs, config, ... }@inputs:
|
2021-04-11 18:04:01 +02:00
|
|
|
{
|
2021-04-11 19:26:38 +02:00
|
|
|
programs.neovim = {
|
2021-04-11 18:04:01 +02:00
|
|
|
|
2021-04-11 19:26:38 +02:00
|
|
|
enable = true;
|
|
|
|
vimdiffAlias = true;
|
|
|
|
withNodeJs = true;
|
|
|
|
|
|
|
|
plugins = with pkgs.vimPlugins; [
|
|
|
|
{
|
|
|
|
plugin = coc-nvim;
|
|
|
|
config = ''
|
2021-04-11 18:04:01 +02:00
|
|
|
nmap <silent> <F2> <Plug>(coc-rename)
|
|
|
|
|
|
|
|
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
|
|
|
|
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
|
|
|
|
|
|
|
|
" Remap <C-f> and <C-b> for scroll float windows/popups.
|
|
|
|
if has('nvim-0.4.0') || has('patch-8.2.0750')
|
|
|
|
nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
|
|
|
|
nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
|
|
|
|
inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
|
|
|
|
inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
|
|
|
|
vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
|
|
|
|
vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
|
|
|
|
endif
|
|
|
|
'';
|
2021-04-11 19:26:38 +02:00
|
|
|
}
|
|
|
|
fzf-vim
|
|
|
|
{
|
|
|
|
plugin = iceberg-vim;
|
|
|
|
config = "colorscheme iceberg";
|
|
|
|
}
|
2021-10-19 22:14:27 +02:00
|
|
|
{
|
|
|
|
plugin = nvim-dap;
|
|
|
|
config = ''
|
2021-12-06 20:13:29 +01:00
|
|
|
lua <<EOF
|
|
|
|
local dap = require'dap'
|
|
|
|
dap.adapters.go = function(callback, config)
|
|
|
|
local stdout = vim.loop.new_pipe(false)
|
|
|
|
local handle
|
|
|
|
local pid_or_err
|
|
|
|
local port = 38697
|
|
|
|
local opts = {
|
|
|
|
stdio = {nil, stdout},
|
|
|
|
args = {"dap", "-l", "127.0.0.1:" .. port},
|
|
|
|
detached = true
|
|
|
|
}
|
|
|
|
handle, pid_or_err = vim.loop.spawn("dlv", opts, function(code)
|
|
|
|
stdout:close()
|
|
|
|
handle:close()
|
|
|
|
if code ~= 0 then
|
|
|
|
print('dlv exited with code', code)
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
assert(handle, 'Error running dlv: ' .. tostring(pid_or_err))
|
|
|
|
stdout:read_start(function(err, chunk)
|
|
|
|
assert(not err, err)
|
|
|
|
if chunk then
|
|
|
|
vim.schedule(function()
|
|
|
|
require('dap.repl').append(chunk)
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
-- Wait for delve to start
|
|
|
|
vim.defer_fn(
|
|
|
|
function()
|
|
|
|
callback({type = "server", host = "127.0.0.1", port = port})
|
|
|
|
end,
|
|
|
|
100)
|
|
|
|
end
|
|
|
|
-- https://github.com/go-delve/delve/blob/master/Documentation/usage/dlv_dap.md
|
|
|
|
dap.configurations.go = {
|
|
|
|
-- works with go.mod packages and sub packages
|
|
|
|
{
|
|
|
|
type = "go",
|
|
|
|
name = "Debug (go.mod)",
|
|
|
|
request = "launch",
|
|
|
|
program = "''${workspaceFolder}"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type = "go",
|
|
|
|
name = "Debug test (go.mod)",
|
|
|
|
request = "launch",
|
|
|
|
mode = "test",
|
|
|
|
program = "''${workspaceFolder}"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type = "go",
|
|
|
|
name = "Debug",
|
|
|
|
request = "launch",
|
|
|
|
program = "''${file}"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type = "go",
|
|
|
|
name = "Debug test", -- configuration for debugging test files
|
|
|
|
request = "launch",
|
|
|
|
mode = "test",
|
|
|
|
program = "''${file}"
|
|
|
|
},
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
nnoremap <silent> <F5> :lua require'dap'.continue()<CR>
|
|
|
|
nnoremap <silent> <F10> :lua require'dap'.step_over()<CR>
|
|
|
|
nnoremap <silent> <F11> :lua require'dap'.step_into()<CR>
|
|
|
|
nnoremap <silent> <F12> :lua require'dap'.step_out()<CR>
|
|
|
|
nnoremap <silent> <leader>b :lua require'dap'.toggle_breakpoint()<CR>
|
|
|
|
nnoremap <silent> <leader>B :lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))<CR>
|
|
|
|
nnoremap <silent> <leader>lp :lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: '))<CR>
|
|
|
|
nnoremap <silent> <leader>dr :lua require'dap'.repl.open()<CR>
|
|
|
|
nnoremap <silent> <leader>dl :lua require'dap'.run_last()<CR>
|
2021-10-19 22:14:27 +02:00
|
|
|
'';
|
|
|
|
}
|
|
|
|
{
|
|
|
|
plugin = nvim-dap-ui;
|
|
|
|
config = "lua require('dapui').setup()";
|
|
|
|
}
|
|
|
|
|
2021-04-11 19:26:38 +02:00
|
|
|
vim-sleuth
|
2021-08-31 23:20:09 +02:00
|
|
|
vim-nix
|
2021-08-27 14:43:53 +02:00
|
|
|
pkgs.go-fold-if-err-nil
|
2021-04-11 19:26:38 +02:00
|
|
|
coc-json
|
2022-02-26 14:03:39 +01:00
|
|
|
coc-emmet
|
2021-08-24 14:46:19 +02:00
|
|
|
coc-go
|
2021-04-11 19:26:38 +02:00
|
|
|
coc-html
|
2022-01-14 19:57:43 +01:00
|
|
|
coc-rust-analyzer
|
2021-11-12 23:54:41 +01:00
|
|
|
coc-pyright
|
2021-04-11 19:26:38 +02:00
|
|
|
coc-tsserver
|
2021-04-28 20:23:15 +02:00
|
|
|
coc-clangd
|
2021-04-11 19:26:38 +02:00
|
|
|
neoformat
|
|
|
|
undotree
|
|
|
|
{
|
|
|
|
plugin = vim-jsdoc;
|
|
|
|
config = ''
|
2021-04-11 18:04:01 +02:00
|
|
|
let g:jsdoc_formatter = "tsdoc"
|
|
|
|
let g:typescript_indent_disable = 1
|
|
|
|
'';
|
2021-04-11 19:26:38 +02:00
|
|
|
}
|
|
|
|
];
|
|
|
|
extraConfig = ''
|
2021-04-11 18:04:01 +02:00
|
|
|
set background=dark
|
|
|
|
set termguicolors
|
|
|
|
|
|
|
|
set ic
|
|
|
|
set number
|
|
|
|
set autoindent
|
|
|
|
|
|
|
|
set completeopt=menuone,noinsert,noselect
|
|
|
|
set shortmess+=c
|
|
|
|
'';
|
2021-12-06 20:13:29 +01:00
|
|
|
coc.enable = true;
|
|
|
|
coc.settings = {
|
|
|
|
text = {
|
|
|
|
"coc.preferences.formatOnSaveFiletypes" = [
|
|
|
|
"css"
|
|
|
|
"markdown"
|
|
|
|
"javascript"
|
|
|
|
"typescript"
|
|
|
|
];
|
|
|
|
"prettier.useTabs" = true;
|
|
|
|
"rust-analyzer.server.path" = "${pkgs.rust-analyzer}";
|
|
|
|
"rust-analyzer.cargo.loadOutDirsFromCheck" = true;
|
|
|
|
"rust-analyzer.procMacro.enable" = true;
|
|
|
|
"clangd.checkUpdates" = false;
|
|
|
|
"clangd.path" = "clangd";
|
|
|
|
"svelte.plugin.svelte.format.enable" = false;
|
|
|
|
"languageserver" = {
|
|
|
|
"nix" = {
|
|
|
|
"command" = "${pkgs.rnix-lsp}/bin/rnix-lsp";
|
|
|
|
"filetypes" = [
|
|
|
|
"nix"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2021-04-11 19:26:38 +02:00
|
|
|
};
|
2021-04-11 18:04:01 +02:00
|
|
|
}
|