2023-06-08 23:28:09 +02:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
nixpkgs-master,
|
|
|
|
...
|
|
|
|
}: let
|
2023-06-08 22:51:09 +02:00
|
|
|
VARIABLES = import ../../src/variables.nix;
|
|
|
|
in {
|
2023-05-17 14:43:54 +02:00
|
|
|
programs.neovim.enable = true;
|
|
|
|
|
2023-06-06 02:37:52 +02:00
|
|
|
home-manager.sharedModules = [
|
|
|
|
{
|
|
|
|
programs.neovim = {
|
|
|
|
enable = true;
|
|
|
|
extraConfig = ''
|
|
|
|
filetype plugin indent on
|
|
|
|
set undofile
|
|
|
|
set spell
|
|
|
|
set number
|
|
|
|
set linebreak
|
|
|
|
set clipboard=unnamedplus
|
|
|
|
set fileencoding=utf-8 " Ensure that we always save files as utf-8
|
|
|
|
set fileencodings=utf-8,sjis " Automatically open shiftjis files with their proper encoding
|
|
|
|
set spelllang=en_us,cjk " Don't show errors for CJK characters
|
|
|
|
set noshowmode " Disable the --MODE-- text (enable if not using the status line)
|
|
|
|
set mouse=a
|
|
|
|
set ignorecase " By default use case-insensitive search (combine with smartcase)
|
|
|
|
set smartcase " Make search case-sensitive when using capital letters
|
|
|
|
set scrolloff=1 " The minimal number of rows to show when scrolling up/down
|
|
|
|
set sidescrolloff=5 " The minimal number of columns to show when scrolling left/right
|
|
|
|
set tabstop=4 " Show a tab character as 4 spaces
|
|
|
|
set softtabstop=0 " Edit soft tabs as if they're regular spaces
|
|
|
|
set shiftwidth=4 " Make autoindent appear as 4 spaces
|
2023-05-17 01:10:15 +02:00
|
|
|
|
2023-06-06 02:37:52 +02:00
|
|
|
set foldmethod=indent
|
|
|
|
set foldlevelstart=99
|
2023-05-17 01:10:15 +02:00
|
|
|
|
2023-06-06 02:37:52 +02:00
|
|
|
map <MiddleMouse> <Nop>
|
|
|
|
imap <MiddleMouse> <Nop>
|
|
|
|
map <2-MiddleMouse> <Nop>
|
|
|
|
imap <2-MiddleMouse> <Nop>
|
|
|
|
map <3-MiddleMouse> <Nop>
|
|
|
|
imap <3-MiddleMouse> <Nop>
|
|
|
|
map <4-MiddleMouse> <Nop>
|
|
|
|
imap <4-MiddleMouse> <Nop>
|
2023-05-17 01:10:15 +02:00
|
|
|
|
2023-06-06 02:37:52 +02:00
|
|
|
highlight Search ctermbg=240 ctermfg=255
|
|
|
|
highlight IncSearch ctermbg=255 ctermfg=240
|
2023-05-17 01:10:15 +02:00
|
|
|
|
2023-06-06 02:37:52 +02:00
|
|
|
let mapleader = ' '
|
|
|
|
nnoremap <silent> <leader>e :set nu!<CR>
|
|
|
|
nnoremap <silent> <leader>t :OverCommandLine<CR>%s/
|
2023-06-06 20:04:14 +02:00
|
|
|
nnoremap <silent> <leader>a <C-w>w
|
2023-06-06 18:24:49 +02:00
|
|
|
nnoremap <silent> <leader>s :Startify<CR>
|
2023-06-09 15:54:32 +02:00
|
|
|
nnoremap <silent> <leader>d :Bdelete<CR>
|
2023-06-06 02:37:52 +02:00
|
|
|
nnoremap <silent> <leader>f :Files<CR>
|
|
|
|
nnoremap <silent> <leader>g :set hlsearch!<CR>
|
|
|
|
nnoremap <silent> <leader>j :Buffers<CR>
|
|
|
|
nnoremap <silent> <leader>l :Rg<CR>
|
2023-06-06 20:04:14 +02:00
|
|
|
nnoremap <silent> <leader>; :NvimTreeToggle<CR>
|
2023-06-06 02:37:52 +02:00
|
|
|
vnoremap <C-s> y:silent !notify-send -t 4000 "成果" "$(tango '<C-r>0')"<CR>:<Esc>
|
2023-05-17 01:10:15 +02:00
|
|
|
|
2023-06-06 02:37:52 +02:00
|
|
|
autocmd BufNewFile,BufRead *.ecr setlocal syntax=html
|
|
|
|
autocmd BufWritePre,FileWritePre * silent! call mkdir(expand('<afile>:p:h'), 'p')
|
2023-06-09 02:54:17 +02:00
|
|
|
autocmd VimEnter * silent! :cd `git rev-parse --show-toplevel`
|
2023-06-06 02:37:52 +02:00
|
|
|
'';
|
|
|
|
plugins = with pkgs.vimPlugins; [
|
|
|
|
{
|
|
|
|
plugin = nvim-tree-lua;
|
|
|
|
type = "lua";
|
|
|
|
config = ''
|
|
|
|
require("nvim-tree").setup()
|
2023-06-06 13:18:59 +02:00
|
|
|
|
2023-06-06 13:50:36 +02:00
|
|
|
vim.api.nvim_create_autocmd({"QuitPre"}, {
|
|
|
|
callback = function() vim.cmd("NvimTreeClose") end
|
2023-06-06 13:18:59 +02:00
|
|
|
})
|
2023-06-06 13:27:04 +02:00
|
|
|
|
|
|
|
local function open_nvim_tree(data)
|
|
|
|
local real_file = vim.fn.filereadable(data.file) == 1
|
|
|
|
local no_name = data.file == "" and vim.bo[data.buf].buftype == ""
|
|
|
|
|
|
|
|
if not real_file and not no_name then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2023-06-06 16:52:39 +02:00
|
|
|
require("nvim-tree.api").tree.toggle({ focus = false, find_file = true })
|
2023-06-06 13:27:04 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
|
2023-06-06 02:37:52 +02:00
|
|
|
'';
|
|
|
|
}
|
|
|
|
{
|
|
|
|
plugin = indent-blankline-nvim;
|
|
|
|
type = "lua";
|
|
|
|
config = ''
|
|
|
|
require("indent_blankline").setup()
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
{
|
|
|
|
plugin = gitsigns-nvim;
|
|
|
|
type = "lua";
|
|
|
|
config = ''
|
|
|
|
require('gitsigns').setup()
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
{
|
|
|
|
plugin = nvim-web-devicons;
|
|
|
|
type = "lua";
|
|
|
|
}
|
2023-06-06 23:09:42 +02:00
|
|
|
{
|
|
|
|
plugin = nvim-scrollbar;
|
|
|
|
type = "lua";
|
|
|
|
config = ''require("scrollbar").setup()'';
|
|
|
|
}
|
2023-06-06 02:37:52 +02:00
|
|
|
{
|
|
|
|
plugin = nvim-lspconfig;
|
|
|
|
type = "lua";
|
|
|
|
config = "
|
2023-05-23 23:12:35 +02:00
|
|
|
local lspconfig = require('lspconfig')
|
|
|
|
lspconfig.nil_ls.setup {}
|
|
|
|
lspconfig.rust_analyzer.setup {}
|
|
|
|
lspconfig.marksman.setup {}
|
|
|
|
lspconfig.gopls.setup {}
|
|
|
|
lspconfig.lua_ls.setup {}
|
|
|
|
lspconfig.clangd.setup {}
|
|
|
|
lspconfig.texlab.setup {}
|
2023-06-08 23:02:50 +02:00
|
|
|
lspconfig.crystalline.setup {}
|
2023-05-23 23:12:35 +02:00
|
|
|
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float)
|
|
|
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
|
|
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
|
|
|
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist)
|
|
|
|
vim.api.nvim_create_autocmd('LspAttach', {
|
|
|
|
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
|
|
|
|
callback = function(ev)
|
|
|
|
local opts = { buffer = ev.buf }
|
|
|
|
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
|
|
|
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
|
|
|
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
|
|
|
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
|
|
|
|
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
|
|
|
|
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
|
|
|
|
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
|
|
|
|
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)
|
|
|
|
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
";
|
2023-06-06 02:37:52 +02:00
|
|
|
}
|
|
|
|
{
|
|
|
|
plugin = nvim-base16;
|
|
|
|
type = "lua";
|
|
|
|
config = "vim.cmd('colorscheme base16-monokai')";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
plugin = lualine-nvim;
|
|
|
|
type = "lua";
|
|
|
|
config = ''
|
|
|
|
require('lualine').setup {
|
|
|
|
sections = { lualine_c = {'%f'} }
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
{
|
|
|
|
plugin = git-blame-nvim;
|
|
|
|
type = "lua";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
plugin = comment-nvim;
|
|
|
|
type = "lua";
|
|
|
|
config = ''require('Comment').setup()'';
|
|
|
|
}
|
|
|
|
{
|
|
|
|
plugin = plenary-nvim;
|
|
|
|
type = "lua";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
plugin = auto-save-nvim;
|
|
|
|
type = "lua";
|
|
|
|
config = ''require("auto-save").setup()'';
|
|
|
|
}
|
|
|
|
{
|
|
|
|
plugin = vimtex;
|
|
|
|
config = ''
|
|
|
|
" Disable all keybinds so we can define our own
|
|
|
|
let g:vimtex_mappings_enabled = 0
|
|
|
|
let g:vimtex_imaps_enabled = 0
|
|
|
|
let g:vimtex_view_method = 'zathura'
|
|
|
|
let g:vimtex_compiler_latexmk = {'build_dir': '.tex'}
|
2023-05-17 01:10:15 +02:00
|
|
|
|
2023-06-06 02:37:52 +02:00
|
|
|
" Set the normal keybinds
|
|
|
|
nnoremap <localleader>f <plug>(vimtex-view)
|
|
|
|
nnoremap <localleader>g <plug>(vimtex-compile)
|
|
|
|
nnoremap <localleader>d <plug>(vimtex-env-delete)
|
|
|
|
nnoremap <localleader>c <plug>(vimtex-env-change)
|
|
|
|
'';
|
|
|
|
}
|
2023-06-06 18:24:49 +02:00
|
|
|
{
|
|
|
|
plugin = vim-startify;
|
|
|
|
config = ''
|
2023-06-09 02:12:07 +02:00
|
|
|
let g:startify_custom_header = startify#pad(split(system("cat (random choice (fd . ${pkgs.ponysay}/share/ponysay/quotes --ignore-file ~/.config/fd/ponyignore))"), '\n'))
|
2023-06-06 18:24:49 +02:00
|
|
|
|
|
|
|
let g:startify_change_to_dir = 0
|
|
|
|
|
|
|
|
function! s:gitModified()
|
|
|
|
let files = systemlist('git ls-files -m 2>/dev/null')
|
|
|
|
return map(files, "{'line': v:val, 'path': v:val}")
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! s:gitUntracked()
|
|
|
|
let files = systemlist('git ls-files -o --exclude-standard 2>/dev/null')
|
|
|
|
return map(files, "{'line': v:val, 'path': v:val}")
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
let g:startify_lists = [
|
|
|
|
\ { 'type': 'dir', 'header': [' 歴史 '. getcwd()] },
|
|
|
|
\ { 'type': function('s:gitModified'), 'header': [' 変化']},
|
|
|
|
\ { 'type': function('s:gitUntracked'), 'header': [' 新規']},
|
|
|
|
\ { 'type': 'commands', 'header': [' Commands']},
|
|
|
|
\ ]
|
|
|
|
'';
|
|
|
|
}
|
2023-06-06 02:37:52 +02:00
|
|
|
fzf-vim
|
|
|
|
vim-caddyfile
|
|
|
|
vim-graphql
|
|
|
|
vim-pug
|
|
|
|
vim-prisma
|
|
|
|
vim-javascript
|
|
|
|
vim-jsx-pretty
|
|
|
|
vim-vue
|
|
|
|
vim-over
|
|
|
|
vim-endwise
|
2023-06-07 04:15:33 +02:00
|
|
|
csv-vim
|
2023-06-06 02:37:52 +02:00
|
|
|
rust-vim
|
|
|
|
neoformat
|
2023-06-09 15:54:32 +02:00
|
|
|
bufdelete-nvim
|
2023-06-08 22:51:09 +02:00
|
|
|
nixpkgs-master.legacyPackages.${VARIABLES.system}.vimPlugins.vim-crystal
|
2023-06-06 02:37:52 +02:00
|
|
|
];
|
|
|
|
};
|
2023-06-09 02:12:07 +02:00
|
|
|
|
|
|
|
xdg.configFile."fd/ponyignore".text = ''
|
|
|
|
snowflake+horsepower+bulkbiceps.1
|
|
|
|
snowflake+horsepower+bulkbiceps.2
|
|
|
|
'';
|
2023-06-06 02:37:52 +02:00
|
|
|
}
|
|
|
|
];
|
2023-05-17 01:10:15 +02:00
|
|
|
}
|