vim: Put in correct folder
This commit is contained in:
parent
42bc007ed4
commit
83b38ddf61
|
@ -187,6 +187,7 @@
|
||||||
enableZshIntegration = true;
|
enableZshIntegration = true;
|
||||||
};
|
};
|
||||||
less.enable = true;
|
less.enable = true;
|
||||||
|
nixvim.enable = true;
|
||||||
readline = {
|
readline = {
|
||||||
enable = true;
|
enable = true;
|
||||||
variables = {
|
variables = {
|
||||||
|
|
|
@ -15,6 +15,6 @@
|
||||||
./style.nix
|
./style.nix
|
||||||
./tmux
|
./tmux
|
||||||
./usernix
|
./usernix
|
||||||
./vim.nix
|
./vim
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
398
hm/vim.nix
398
hm/vim.nix
|
@ -1,398 +0,0 @@
|
||||||
{ pkgs, lib, config, ... }:
|
|
||||||
let
|
|
||||||
vim-shot-f = pkgs.vimUtils.buildVimPlugin {
|
|
||||||
pname = "vim-shot-f";
|
|
||||||
version = "2016-02-05";
|
|
||||||
src = pkgs.fetchFromGitHub {
|
|
||||||
owner = "deris";
|
|
||||||
repo = "vim-shot-f";
|
|
||||||
rev = "eea71d2a1038aa87fe175de9150b39dc155e5e7f";
|
|
||||||
sha256 = "iAPvIs/lhW+w5kFTZKaY97D/kfCGtqKrJVFvZ8cHu+c=";
|
|
||||||
};
|
|
||||||
meta.homepage = "https://github.com/deris/vim-shot-f";
|
|
||||||
};
|
|
||||||
quick-scope = pkgs.vimUtils.buildVimPlugin rec {
|
|
||||||
pname = "quick-scope";
|
|
||||||
version = "2.6.1";
|
|
||||||
src = pkgs.fetchFromGitHub {
|
|
||||||
owner = "unblevable";
|
|
||||||
repo = "quick-scope";
|
|
||||||
rev = "v${version}";
|
|
||||||
sha256 = "TcA4jZIdnQd06V+JrXGiCMr0Yhm9gB6OMiTSdzMt/Qw=";
|
|
||||||
};
|
|
||||||
meta.homepage = "https://github.com/unblevable/quick-scope";
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
|
|
||||||
programs.nixvim = {
|
|
||||||
enable = true;
|
|
||||||
# Setting a custom base16 theme via nixvim is required so feline works, and
|
|
||||||
# because stylix makes a config that otherwise only works with dark
|
|
||||||
# polarity.
|
|
||||||
colorschemes.base16.colorscheme = "solarized-${config.frogeye.polarity}";
|
|
||||||
options = {
|
|
||||||
# From https://www.hillelwayne.com/post/intermediate-vim/
|
|
||||||
title = true;
|
|
||||||
number = true;
|
|
||||||
relativenumber = true;
|
|
||||||
scrolloff = 10;
|
|
||||||
lazyredraw = true; # Do not redraw screen in the middle of a macro. Makes them complete faster.
|
|
||||||
cursorcolumn = true;
|
|
||||||
|
|
||||||
ignorecase = true;
|
|
||||||
smartcase = true;
|
|
||||||
gdefault = true;
|
|
||||||
|
|
||||||
tabstop = 4;
|
|
||||||
shiftwidth = 4;
|
|
||||||
expandtab = true;
|
|
||||||
|
|
||||||
splitbelow = true;
|
|
||||||
visualbell = true;
|
|
||||||
|
|
||||||
updatetime = 250;
|
|
||||||
undofile = true;
|
|
||||||
|
|
||||||
# From http://stackoverflow.com/a/5004785/2766106
|
|
||||||
list = true;
|
|
||||||
listchars = "tab:╾╌,trail:·,extends:↦,precedes:↤,nbsp:_";
|
|
||||||
showbreak = "↪";
|
|
||||||
|
|
||||||
wildmode = "longest:full,full";
|
|
||||||
wildmenu = true;
|
|
||||||
};
|
|
||||||
globals = {
|
|
||||||
netrw_fastbrowse = 0; # Close the file explorer once you select a file
|
|
||||||
};
|
|
||||||
plugins = {
|
|
||||||
# Catches attention when cursor changed position
|
|
||||||
# TODO Unmapped, do I still want to use it?
|
|
||||||
specs = {
|
|
||||||
enable = true;
|
|
||||||
min_jump = 5;
|
|
||||||
fader = { builtin = "pulse_fader"; };
|
|
||||||
resizer = { builtin = "shrink_resizer"; };
|
|
||||||
};
|
|
||||||
|
|
||||||
# Tabline
|
|
||||||
barbar.enable = true;
|
|
||||||
|
|
||||||
# Go to whatever
|
|
||||||
telescope = {
|
|
||||||
enable = true;
|
|
||||||
keymaps = {
|
|
||||||
gF = "find_files";
|
|
||||||
gf = "git_files";
|
|
||||||
gB = "buffers";
|
|
||||||
gl = "current_buffer_fuzzy_find";
|
|
||||||
gL = "live_grep";
|
|
||||||
gT = "tags";
|
|
||||||
gt = "treesitter";
|
|
||||||
gm = "marks";
|
|
||||||
gh = "oldfiles";
|
|
||||||
gH = "command_history";
|
|
||||||
gS = "search_history";
|
|
||||||
gC = "commands";
|
|
||||||
gr = "lsp_references";
|
|
||||||
ge = "diagnostics";
|
|
||||||
# ga = "lsp_code_actions";
|
|
||||||
# gE = "lsp_workspace_diagnostics";
|
|
||||||
# TODO Above makes nvim crash on startup, action is not provided
|
|
||||||
gd = "lsp_definitions";
|
|
||||||
gs = "lsp_document_symbols";
|
|
||||||
};
|
|
||||||
defaults = {
|
|
||||||
vimgrep_arguments = [
|
|
||||||
"${pkgs.ripgrep}/bin/rg"
|
|
||||||
"--color=never"
|
|
||||||
"--no-heading"
|
|
||||||
"--with-filename"
|
|
||||||
"--line-number"
|
|
||||||
"--column"
|
|
||||||
"--smart-case"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
extensions.fzf-native = {
|
|
||||||
enable = true;
|
|
||||||
caseMode = "smart_case";
|
|
||||||
fuzzy = true;
|
|
||||||
overrideFileSorter = true;
|
|
||||||
overrideGenericSorter = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# Surrounding pairs
|
|
||||||
surround.enable = true; # Change surrounding pairs (e.g. brackets, quotes)
|
|
||||||
|
|
||||||
# Language Server
|
|
||||||
lsp = {
|
|
||||||
enable = true;
|
|
||||||
keymaps = {
|
|
||||||
silent = true;
|
|
||||||
diagnostic = {
|
|
||||||
"<Space>e" = "open_float";
|
|
||||||
"[e" = "goto_prev";
|
|
||||||
"]e" = "goto_next";
|
|
||||||
};
|
|
||||||
lspBuf = {
|
|
||||||
"gD" = "declaration";
|
|
||||||
"K" = "hover";
|
|
||||||
"gi" = "implementation";
|
|
||||||
"<C-S-k>" = "signature_help";
|
|
||||||
"<space>wa" = "add_workspace_folder";
|
|
||||||
"<space>wr" = "remove_workspace_folder";
|
|
||||||
# "<space>wl" = "list_workspace_folder";
|
|
||||||
# TODO Full thing was function() print(vim.inspect(vim.lsp.buf.list_workspace_folder())) end but not sure I'm ever really using this
|
|
||||||
# Also makes nvim crash like this, so uncommented
|
|
||||||
"<space>D" = "type_definition";
|
|
||||||
"<space>rn" = "rename";
|
|
||||||
"<space>f" = "format";
|
|
||||||
# TODO Full thing was function() vim.lsp.buf.format { async = true } end, so async while this isn't
|
|
||||||
# Maybe replace this with lsp-format?
|
|
||||||
};
|
|
||||||
};
|
|
||||||
servers = {
|
|
||||||
ansiblels.enable = config.frogeye.dev.ansible; # Ansible
|
|
||||||
bashls.enable = true; # Bash
|
|
||||||
jsonls.enable = true; # JSON
|
|
||||||
lua-ls.enable = true; # Lua (for Neovim debugging)
|
|
||||||
perlpls.enable = config.frogeye.dev.perl; # Perl
|
|
||||||
pylsp = {
|
|
||||||
# Python
|
|
||||||
enable = config.frogeye.dev.python;
|
|
||||||
settings.plugins = {
|
|
||||||
black.enabled = true;
|
|
||||||
flake8 = {
|
|
||||||
enabled = true;
|
|
||||||
maxLineLength = 88; # Compatibility with Black
|
|
||||||
};
|
|
||||||
isort.enabled = true;
|
|
||||||
mccabe.enabled = true;
|
|
||||||
pycodestyle = {
|
|
||||||
enabled = true;
|
|
||||||
maxLineLength = 88; # Compatibility with Black
|
|
||||||
};
|
|
||||||
pyflakes.enabled = true;
|
|
||||||
pylint.enabled = true;
|
|
||||||
pylsp_mypy = {
|
|
||||||
enabled = true;
|
|
||||||
overrides = [
|
|
||||||
"--cache-dir=${config.xdg.cacheHome}/mypy"
|
|
||||||
"--ignore-missing-imports"
|
|
||||||
"--disallow-untyped-defs"
|
|
||||||
"--disallow-untyped-calls"
|
|
||||||
"--disallow-incomplete-defs"
|
|
||||||
"--disallow-untyped-decorators"
|
|
||||||
true
|
|
||||||
];
|
|
||||||
};
|
|
||||||
# TODO Could add some, could also remove some
|
|
||||||
};
|
|
||||||
};
|
|
||||||
phpactor.enable = config.frogeye.dev.php; # PHP
|
|
||||||
rnix-lsp.enable = true; # Nix
|
|
||||||
# TODO Something for SQL. sqls is deprecated, sqlls is not in Nixpkgs. Probably needs a DB connection configured anyways?
|
|
||||||
yamlls.enable = true; # YAML
|
|
||||||
# TODO Check out none-ls
|
|
||||||
};
|
|
||||||
onAttach = ''
|
|
||||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
|
||||||
''; # Seems needed for auto-completion with nvim-compe
|
|
||||||
};
|
|
||||||
nvim-lightbulb = {
|
|
||||||
# Shows a lightbulb whenever a codeAction is available under the cursor
|
|
||||||
enable = true;
|
|
||||||
autocmd.enabled = true;
|
|
||||||
};
|
|
||||||
lspkind.enable = true; # Add icons to LSP completions
|
|
||||||
|
|
||||||
# Treesitter
|
|
||||||
treesitter = {
|
|
||||||
# Allows for better syntax highlighting
|
|
||||||
enable = true;
|
|
||||||
incrementalSelection = {
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
# indent = true; # Not very working last time I tried apparently
|
|
||||||
};
|
|
||||||
# TODO Investigate https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
|
||||||
indent-blankline.enable = true; # TODO integrate with rainbow-delimiters and use more of the options
|
|
||||||
|
|
||||||
undotree.enable = true; # Navigate edition history
|
|
||||||
|
|
||||||
# Git
|
|
||||||
fugitive.enable = true; # Git basics
|
|
||||||
gitsigns.enable = true; # Show changed lines in the gutter
|
|
||||||
|
|
||||||
# Language-specific
|
|
||||||
# dap.enable = true; # Debug Adapter Protocol client # 23.11
|
|
||||||
nvim-colorizer.enable = true; # Display colors of color-codes
|
|
||||||
};
|
|
||||||
extraPlugins = with pkgs.vimPlugins; [
|
|
||||||
nvim-scrollview # Scroll bar
|
|
||||||
|
|
||||||
# Status line
|
|
||||||
feline-nvim # Customizable status line.
|
|
||||||
# TODO Abandonned. Maybe use lualine?
|
|
||||||
|
|
||||||
# Search/replace
|
|
||||||
vim-abolish # Regex for words, with case in mind
|
|
||||||
vim-easy-align # Aligning lines around a certain character
|
|
||||||
|
|
||||||
# Surrounding pairs
|
|
||||||
targets-vim # Better interaction with surrounding pairs
|
|
||||||
|
|
||||||
# f/F mode
|
|
||||||
vim-shot-f # Highlight relevant characters for f/F/t/T modes
|
|
||||||
quick-scope # Highlight relevant characters for f/F modes one per word but always
|
|
||||||
|
|
||||||
# Registers
|
|
||||||
registers-nvim # Show register content when pressing "
|
|
||||||
# TODO Doesn't work. Didn't work on Arch either
|
|
||||||
|
|
||||||
# Tags
|
|
||||||
vim-gutentags # Generate tags
|
|
||||||
symbols-outline-nvim # Show a symbol panel on the right
|
|
||||||
# TODO Fails on startup. Same on Arch. Config issue?
|
|
||||||
|
|
||||||
# Language server
|
|
||||||
lsp_signature-nvim # Show argument definition when typing a function
|
|
||||||
|
|
||||||
# Treesitter
|
|
||||||
nvim-ts-rainbow # Randomly color parenthesis pairs
|
|
||||||
# TODO Replace with plugins.rainbow-delimiters
|
|
||||||
|
|
||||||
# Snippets
|
|
||||||
vim-vsnip
|
|
||||||
vim-vsnip-integ
|
|
||||||
friendly-snippets
|
|
||||||
|
|
||||||
# Auto-completion
|
|
||||||
nvim-compe
|
|
||||||
# TODO Archived. Maybe use nvim-cmp and plugins instead?
|
|
||||||
|
|
||||||
# Git
|
|
||||||
fugitive-gitlab-vim # Open files in GitLab
|
|
||||||
# TODO Connect it!
|
|
||||||
|
|
||||||
# Language-specific
|
|
||||||
tcomment_vim # Language-aware (un)commenting
|
|
||||||
] ++ lib.optionals config.frogeye.extra [
|
|
||||||
vim-LanguageTool # Check grammar for human languages
|
|
||||||
] ++ lib.optionals config.programs.pandoc.enable [
|
|
||||||
vim-pandoc # Pandoc-specific stuff because there's no LSP for it
|
|
||||||
vim-pandoc-syntax
|
|
||||||
] ++ lib.optionals config.frogeye.dev.ansible [
|
|
||||||
ansible-vim # TODO Doesn't have snippets
|
|
||||||
];
|
|
||||||
extraConfigLua = lib.strings.concatMapStringsSep "\n" (f: builtins.readFile f) [
|
|
||||||
./vim/feline.lua
|
|
||||||
./vim/symbols-outline-nvim.lua
|
|
||||||
./vim/lsp_signature-nvim.lua
|
|
||||||
./vim/nvim-ts-rainbow.lua
|
|
||||||
./vim/nvim-compe.lua
|
|
||||||
];
|
|
||||||
extraConfigVim = ''
|
|
||||||
" GENERAL
|
|
||||||
|
|
||||||
" Avoid showing message extra message when using completion
|
|
||||||
set shortmess+=c
|
|
||||||
|
|
||||||
command Reload source $MYVIMRC
|
|
||||||
|
|
||||||
" PLUGINS
|
|
||||||
|
|
||||||
" vim-gutentags
|
|
||||||
let g:gutentags_cache_dir = expand('~/.cache/nvim/tags')
|
|
||||||
|
|
||||||
" nvim-compe
|
|
||||||
" Copy-pasted because I couldn't be bothered
|
|
||||||
set completeopt=menuone,noselect
|
|
||||||
|
|
||||||
inoremap <silent><expr> <C-Space> compe#complete()
|
|
||||||
inoremap <silent><expr> <CR> compe#confirm('<CR>')
|
|
||||||
inoremap <silent><expr> <C-e> compe#close('<C-e>')
|
|
||||||
inoremap <silent><expr> <C-f> compe#scroll({ 'delta': +4 })
|
|
||||||
inoremap <silent><expr> <C-d> compe#scroll({ 'delta': -4 })
|
|
||||||
|
|
||||||
'' + lib.optionalString config.frogeye.extra ''
|
|
||||||
" languagetool
|
|
||||||
let g:languagetool_cmd = "${pkgs.languagetool}/bin/languagetool-commandline"
|
|
||||||
" TODO Doesn't work
|
|
||||||
|
|
||||||
'' + lib.optionalString config.programs.pandoc.enable ''
|
|
||||||
" vim-pandox
|
|
||||||
let g:pandoc#modules#disabled = ["folding"]
|
|
||||||
let g:pandoc#spell#enabled = 0
|
|
||||||
let g:pandoc#syntax#conceal#use = 0
|
|
||||||
|
|
||||||
'';
|
|
||||||
autoCmd = [
|
|
||||||
# Turn off relativenumber only for insert mode
|
|
||||||
{ event = "InsertEnter"; pattern = "*"; command = "set norelativenumber"; }
|
|
||||||
{ event = "InsertLeave"; pattern = "*"; command = "set relativenumber"; }
|
|
||||||
|
|
||||||
# Additional extensions
|
|
||||||
{ event = "BufRead"; pattern = "*.jinja"; command = "set filetype=jinja2"; } # TODO Probably GH-specific?
|
|
||||||
{ event = "BufNewFile"; pattern = "*.jinja"; command = "set filetype=jinja2"; }
|
|
||||||
|
|
||||||
# vim-easy-align: Align Markdown tables
|
|
||||||
{ event = "FileType"; pattern = "markdown"; command = "vmap <Bar> :EasyAlign*<Bar><Enter>"; }
|
|
||||||
];
|
|
||||||
|
|
||||||
userCommands = {
|
|
||||||
# Reload = { command = "source $MYVIRMC"; };
|
|
||||||
# TODO Is not working, options is set to nil even though it shouldn't
|
|
||||||
};
|
|
||||||
|
|
||||||
keymaps = [
|
|
||||||
# GENERAL
|
|
||||||
|
|
||||||
# Allow saving of files as sudo when I forgot to start vim using sudo.
|
|
||||||
# From https://stackoverflow.com/a/7078429
|
|
||||||
{ mode = "c"; key = "w!!"; action = "w !sudo tee > /dev/null %"; }
|
|
||||||
|
|
||||||
{ mode = "i"; key = "jk"; action = "<Esc>"; }
|
|
||||||
{ mode = "v"; key = "<Enter>"; action = "<Esc>"; }
|
|
||||||
{ key = "<Enter>"; action = "o<Esc>"; }
|
|
||||||
|
|
||||||
# { key = "<C-H>"; action = ":bp<CR>"; }
|
|
||||||
# { key = "<C-L>"; action = ":bn<CR>"; }
|
|
||||||
{ key = "<C-K>"; action = "kkkkkkkkkkkkkkkkkkkkk"; }
|
|
||||||
{ key = "<C-J>"; action = "jjjjjjjjjjjjjjjjjjjjj"; }
|
|
||||||
|
|
||||||
# \s to replace globally the word under the cursor
|
|
||||||
{ key = "<Leader>s"; action = ":%s/\\<<C-r><C-w>\\>/"; }
|
|
||||||
|
|
||||||
# PLUGINS
|
|
||||||
|
|
||||||
# barbar
|
|
||||||
{ key = "<C-H>"; action = "<Cmd>BufferPrevious<CR>"; options = { silent = true; }; }
|
|
||||||
{ key = "<C-L>"; action = "<Cmd>BufferNext<CR>"; options = { silent = true; }; }
|
|
||||||
# TODO https://www.reddit.com/r/neovim/comments/mbj8m5/how_to_setup_ctrlshiftkey_mappings_in_neovim_and/
|
|
||||||
{ key = "<Space><C-H>"; action = "<Cmd>BufferMovePrevious<CR>"; options = { silent = true; }; }
|
|
||||||
{ key = "<Space><C-L>"; action = "<Cmd>BufferMoveNext<CR>"; options = { silent = true; }; }
|
|
||||||
# TODO gotos don't work
|
|
||||||
{ key = "<C-1>"; action = "<Cmd>BufferGoto 1<CR>"; options = { silent = true; }; }
|
|
||||||
{ key = "<C-2>"; action = "<Cmd>BufferGoto 2<CR>"; options = { silent = true; }; }
|
|
||||||
{ key = "<C-3>"; action = "<Cmd>BufferGoto 3<CR>"; options = { silent = true; }; }
|
|
||||||
{ key = "<C-4>"; action = "<Cmd>BufferGoto 4<CR>"; options = { silent = true; }; }
|
|
||||||
{ key = "<C-5>"; action = "<Cmd>BufferGoto 5<CR>"; options = { silent = true; }; }
|
|
||||||
{ key = "<C-6>"; action = "<Cmd>BufferGoto 6<CR>"; options = { silent = true; }; }
|
|
||||||
{ key = "<C-7>"; action = "<Cmd>BufferGoto 7<CR>"; options = { silent = true; }; }
|
|
||||||
{ key = "<C-8>"; action = "<Cmd>BufferGoto 8<CR>"; options = { silent = true; }; }
|
|
||||||
{ key = "<C-9>"; action = "<Cmd>BufferGoto 9<CR>"; options = { silent = true; }; }
|
|
||||||
{ key = "<C-0>"; action = "<Cmd>BufferLast<CR>"; options = { silent = true; }; }
|
|
||||||
{ key = "gb"; action = "<Cmd>BufferPick<CR>"; options = { silent = true; }; }
|
|
||||||
# TODO Other useful options?
|
|
||||||
|
|
||||||
# symbols-outline-nvim
|
|
||||||
{ key = "<Space>s"; action = "<Cmd>SymbolsOutline<CR>"; options = { silent = true; }; }
|
|
||||||
|
|
||||||
# undotree
|
|
||||||
{ key = "<Space>u"; action = "<Cmd>UndotreeToggle<CR>"; options = { silent = true; }; }
|
|
||||||
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
395
hm/vim/default.nix
Normal file
395
hm/vim/default.nix
Normal file
|
@ -0,0 +1,395 @@
|
||||||
|
{ pkgs, lib, config, ... }:
|
||||||
|
let
|
||||||
|
vim-shot-f = pkgs.vimUtils.buildVimPlugin {
|
||||||
|
pname = "vim-shot-f";
|
||||||
|
version = "2016-02-05";
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "deris";
|
||||||
|
repo = "vim-shot-f";
|
||||||
|
rev = "eea71d2a1038aa87fe175de9150b39dc155e5e7f";
|
||||||
|
sha256 = "iAPvIs/lhW+w5kFTZKaY97D/kfCGtqKrJVFvZ8cHu+c=";
|
||||||
|
};
|
||||||
|
meta.homepage = "https://github.com/deris/vim-shot-f";
|
||||||
|
};
|
||||||
|
quick-scope = pkgs.vimUtils.buildVimPlugin rec {
|
||||||
|
pname = "quick-scope";
|
||||||
|
version = "2.6.1";
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "unblevable";
|
||||||
|
repo = "quick-scope";
|
||||||
|
rev = "v${version}";
|
||||||
|
sha256 = "TcA4jZIdnQd06V+JrXGiCMr0Yhm9gB6OMiTSdzMt/Qw=";
|
||||||
|
};
|
||||||
|
meta.homepage = "https://github.com/unblevable/quick-scope";
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
# config = lib.mkIf config.programs.nixvim.enable { # Somehow this is infinite recursion?
|
||||||
|
config = {
|
||||||
|
programs.nixvim = {
|
||||||
|
# Setting a custom base16 theme via nixvim is required so feline works, and
|
||||||
|
# because stylix makes a config that otherwise only works with dark
|
||||||
|
# polarity.
|
||||||
|
colorschemes.base16.colorscheme = "solarized-${config.frogeye.polarity}";
|
||||||
|
options = {
|
||||||
|
# From https://www.hillelwayne.com/post/intermediate-vim/
|
||||||
|
title = true;
|
||||||
|
number = true;
|
||||||
|
relativenumber = true;
|
||||||
|
scrolloff = 10;
|
||||||
|
lazyredraw = true; # Do not redraw screen in the middle of a macro. Makes them complete faster.
|
||||||
|
cursorcolumn = true;
|
||||||
|
|
||||||
|
ignorecase = true;
|
||||||
|
smartcase = true;
|
||||||
|
gdefault = true;
|
||||||
|
|
||||||
|
tabstop = 4;
|
||||||
|
shiftwidth = 4;
|
||||||
|
expandtab = true;
|
||||||
|
|
||||||
|
splitbelow = true;
|
||||||
|
visualbell = true;
|
||||||
|
|
||||||
|
updatetime = 250;
|
||||||
|
undofile = true;
|
||||||
|
|
||||||
|
# From http://stackoverflow.com/a/5004785/2766106
|
||||||
|
list = true;
|
||||||
|
listchars = "tab:╾╌,trail:·,extends:↦,precedes:↤,nbsp:_";
|
||||||
|
showbreak = "↪";
|
||||||
|
|
||||||
|
wildmode = "longest:full,full";
|
||||||
|
wildmenu = true;
|
||||||
|
};
|
||||||
|
globals = {
|
||||||
|
netrw_fastbrowse = 0; # Close the file explorer once you select a file
|
||||||
|
};
|
||||||
|
plugins = {
|
||||||
|
# Catches attention when cursor changed position
|
||||||
|
# TODO Unmapped, do I still want to use it?
|
||||||
|
specs = {
|
||||||
|
enable = true;
|
||||||
|
min_jump = 5;
|
||||||
|
fader = { builtin = "pulse_fader"; };
|
||||||
|
resizer = { builtin = "shrink_resizer"; };
|
||||||
|
};
|
||||||
|
|
||||||
|
# Tabline
|
||||||
|
barbar.enable = true;
|
||||||
|
|
||||||
|
# Go to whatever
|
||||||
|
telescope = {
|
||||||
|
enable = true;
|
||||||
|
keymaps = {
|
||||||
|
gF = "find_files";
|
||||||
|
gf = "git_files";
|
||||||
|
gB = "buffers";
|
||||||
|
gl = "current_buffer_fuzzy_find";
|
||||||
|
gL = "live_grep";
|
||||||
|
gT = "tags";
|
||||||
|
gt = "treesitter";
|
||||||
|
gm = "marks";
|
||||||
|
gh = "oldfiles";
|
||||||
|
gH = "command_history";
|
||||||
|
gS = "search_history";
|
||||||
|
gC = "commands";
|
||||||
|
gr = "lsp_references";
|
||||||
|
ge = "diagnostics";
|
||||||
|
# ga = "lsp_code_actions";
|
||||||
|
# gE = "lsp_workspace_diagnostics";
|
||||||
|
# TODO Above makes nvim crash on startup, action is not provided
|
||||||
|
gd = "lsp_definitions";
|
||||||
|
gs = "lsp_document_symbols";
|
||||||
|
};
|
||||||
|
defaults = {
|
||||||
|
vimgrep_arguments = [
|
||||||
|
"${pkgs.ripgrep}/bin/rg"
|
||||||
|
"--color=never"
|
||||||
|
"--no-heading"
|
||||||
|
"--with-filename"
|
||||||
|
"--line-number"
|
||||||
|
"--column"
|
||||||
|
"--smart-case"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
extensions.fzf-native = {
|
||||||
|
enable = true;
|
||||||
|
caseMode = "smart_case";
|
||||||
|
fuzzy = true;
|
||||||
|
overrideFileSorter = true;
|
||||||
|
overrideGenericSorter = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Surrounding pairs
|
||||||
|
surround.enable = true; # Change surrounding pairs (e.g. brackets, quotes)
|
||||||
|
|
||||||
|
# Language Server
|
||||||
|
lsp = {
|
||||||
|
enable = true;
|
||||||
|
keymaps = {
|
||||||
|
silent = true;
|
||||||
|
diagnostic = {
|
||||||
|
"<Space>e" = "open_float";
|
||||||
|
"[e" = "goto_prev";
|
||||||
|
"]e" = "goto_next";
|
||||||
|
};
|
||||||
|
lspBuf = {
|
||||||
|
"gD" = "declaration";
|
||||||
|
"K" = "hover";
|
||||||
|
"gi" = "implementation";
|
||||||
|
"<C-S-k>" = "signature_help";
|
||||||
|
"<space>wa" = "add_workspace_folder";
|
||||||
|
"<space>wr" = "remove_workspace_folder";
|
||||||
|
# "<space>wl" = "list_workspace_folder";
|
||||||
|
# TODO Full thing was function() print(vim.inspect(vim.lsp.buf.list_workspace_folder())) end but not sure I'm ever really using this
|
||||||
|
# Also makes nvim crash like this, so uncommented
|
||||||
|
"<space>D" = "type_definition";
|
||||||
|
"<space>rn" = "rename";
|
||||||
|
"<space>f" = "format";
|
||||||
|
# TODO Full thing was function() vim.lsp.buf.format { async = true } end, so async while this isn't
|
||||||
|
# Maybe replace this with lsp-format?
|
||||||
|
};
|
||||||
|
};
|
||||||
|
servers = {
|
||||||
|
ansiblels.enable = config.frogeye.dev.ansible; # Ansible
|
||||||
|
bashls.enable = true; # Bash
|
||||||
|
jsonls.enable = true; # JSON
|
||||||
|
lua-ls.enable = true; # Lua (for Neovim debugging)
|
||||||
|
perlpls.enable = config.frogeye.dev.perl; # Perl
|
||||||
|
pylsp = {
|
||||||
|
# Python
|
||||||
|
enable = config.frogeye.dev.python;
|
||||||
|
settings.plugins = {
|
||||||
|
black.enabled = true;
|
||||||
|
flake8 = {
|
||||||
|
enabled = true;
|
||||||
|
maxLineLength = 88; # Compatibility with Black
|
||||||
|
};
|
||||||
|
isort.enabled = true;
|
||||||
|
mccabe.enabled = true;
|
||||||
|
pycodestyle = {
|
||||||
|
enabled = true;
|
||||||
|
maxLineLength = 88; # Compatibility with Black
|
||||||
|
};
|
||||||
|
pyflakes.enabled = true;
|
||||||
|
pylint.enabled = true;
|
||||||
|
pylsp_mypy = {
|
||||||
|
enabled = true;
|
||||||
|
overrides = [
|
||||||
|
"--cache-dir=${config.xdg.cacheHome}/mypy"
|
||||||
|
"--ignore-missing-imports"
|
||||||
|
"--disallow-untyped-defs"
|
||||||
|
"--disallow-untyped-calls"
|
||||||
|
"--disallow-incomplete-defs"
|
||||||
|
"--disallow-untyped-decorators"
|
||||||
|
true
|
||||||
|
];
|
||||||
|
};
|
||||||
|
# TODO Could add some, could also remove some
|
||||||
|
};
|
||||||
|
};
|
||||||
|
phpactor.enable = config.frogeye.dev.php; # PHP
|
||||||
|
rnix-lsp.enable = true; # Nix
|
||||||
|
# TODO Something for SQL. sqls is deprecated, sqlls is not in Nixpkgs. Probably needs a DB connection configured anyways?
|
||||||
|
yamlls.enable = true; # YAML
|
||||||
|
# TODO Check out none-ls
|
||||||
|
};
|
||||||
|
onAttach = ''
|
||||||
|
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||||
|
''; # Seems needed for auto-completion with nvim-compe
|
||||||
|
};
|
||||||
|
nvim-lightbulb = {
|
||||||
|
# Shows a lightbulb whenever a codeAction is available under the cursor
|
||||||
|
enable = true;
|
||||||
|
autocmd.enabled = true;
|
||||||
|
};
|
||||||
|
lspkind.enable = true; # Add icons to LSP completions
|
||||||
|
|
||||||
|
# Treesitter
|
||||||
|
treesitter = {
|
||||||
|
# Allows for better syntax highlighting
|
||||||
|
enable = true;
|
||||||
|
incrementalSelection = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
# indent = true; # Not very working last time I tried apparently
|
||||||
|
};
|
||||||
|
# TODO Investigate https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
||||||
|
indent-blankline.enable = true; # TODO integrate with rainbow-delimiters and use more of the options
|
||||||
|
|
||||||
|
undotree.enable = true; # Navigate edition history
|
||||||
|
|
||||||
|
# Git
|
||||||
|
fugitive.enable = true; # Git basics
|
||||||
|
gitsigns.enable = true; # Show changed lines in the gutter
|
||||||
|
|
||||||
|
# Language-specific
|
||||||
|
# dap.enable = true; # Debug Adapter Protocol client # 23.11
|
||||||
|
nvim-colorizer.enable = true; # Display colors of color-codes
|
||||||
|
};
|
||||||
|
extraPlugins = with pkgs.vimPlugins; [
|
||||||
|
nvim-scrollview # Scroll bar
|
||||||
|
|
||||||
|
# Status line
|
||||||
|
feline-nvim # Customizable status line.
|
||||||
|
# TODO Abandonned. Maybe use lualine?
|
||||||
|
|
||||||
|
# Search/replace
|
||||||
|
vim-abolish # Regex for words, with case in mind
|
||||||
|
vim-easy-align # Aligning lines around a certain character
|
||||||
|
|
||||||
|
# Surrounding pairs
|
||||||
|
targets-vim # Better interaction with surrounding pairs
|
||||||
|
|
||||||
|
# f/F mode
|
||||||
|
vim-shot-f # Highlight relevant characters for f/F/t/T modes
|
||||||
|
quick-scope # Highlight relevant characters for f/F modes one per word but always
|
||||||
|
|
||||||
|
# Registers
|
||||||
|
registers-nvim # Show register content when pressing "
|
||||||
|
# TODO Doesn't work. Didn't work on Arch either
|
||||||
|
|
||||||
|
# Tags
|
||||||
|
vim-gutentags # Generate tags
|
||||||
|
symbols-outline-nvim # Show a symbol panel on the right
|
||||||
|
# TODO Fails on startup. Same on Arch. Config issue?
|
||||||
|
|
||||||
|
# Language server
|
||||||
|
lsp_signature-nvim # Show argument definition when typing a function
|
||||||
|
|
||||||
|
# Treesitter
|
||||||
|
nvim-ts-rainbow # Randomly color parenthesis pairs
|
||||||
|
# TODO Replace with plugins.rainbow-delimiters
|
||||||
|
|
||||||
|
# Snippets
|
||||||
|
vim-vsnip
|
||||||
|
vim-vsnip-integ
|
||||||
|
friendly-snippets
|
||||||
|
|
||||||
|
# Auto-completion
|
||||||
|
nvim-compe
|
||||||
|
# TODO Archived. Maybe use nvim-cmp and plugins instead?
|
||||||
|
|
||||||
|
# Git
|
||||||
|
fugitive-gitlab-vim # Open files in GitLab
|
||||||
|
# TODO Connect it!
|
||||||
|
|
||||||
|
# Language-specific
|
||||||
|
tcomment_vim # Language-aware (un)commenting
|
||||||
|
] ++ lib.optionals config.frogeye.extra [
|
||||||
|
vim-LanguageTool # Check grammar for human languages
|
||||||
|
] ++ lib.optionals config.programs.pandoc.enable [
|
||||||
|
vim-pandoc # Pandoc-specific stuff because there's no LSP for it
|
||||||
|
vim-pandoc-syntax
|
||||||
|
] ++ lib.optionals config.frogeye.dev.ansible [
|
||||||
|
ansible-vim # TODO Doesn't have snippets
|
||||||
|
];
|
||||||
|
extraConfigLua = lib.strings.concatMapStringsSep "\n" (f: builtins.readFile f) [
|
||||||
|
./feline.lua
|
||||||
|
./symbols-outline-nvim.lua
|
||||||
|
./lsp_signature-nvim.lua
|
||||||
|
./nvim-ts-rainbow.lua
|
||||||
|
./nvim-compe.lua
|
||||||
|
];
|
||||||
|
extraConfigVim = ''
|
||||||
|
" GENERAL
|
||||||
|
|
||||||
|
" Avoid showing message extra message when using completion
|
||||||
|
set shortmess+=c
|
||||||
|
|
||||||
|
command Reload source $MYVIMRC
|
||||||
|
|
||||||
|
" PLUGINS
|
||||||
|
|
||||||
|
" vim-gutentags
|
||||||
|
let g:gutentags_cache_dir = expand('~/.cache/nvim/tags')
|
||||||
|
|
||||||
|
" nvim-compe
|
||||||
|
" Copy-pasted because I couldn't be bothered
|
||||||
|
set completeopt=menuone,noselect
|
||||||
|
|
||||||
|
inoremap <silent><expr> <C-Space> compe#complete()
|
||||||
|
inoremap <silent><expr> <CR> compe#confirm('<CR>')
|
||||||
|
inoremap <silent><expr> <C-e> compe#close('<C-e>')
|
||||||
|
inoremap <silent><expr> <C-f> compe#scroll({ 'delta': +4 })
|
||||||
|
inoremap <silent><expr> <C-d> compe#scroll({ 'delta': -4 })
|
||||||
|
|
||||||
|
'' + lib.optionalString config.frogeye.extra ''
|
||||||
|
" languagetool
|
||||||
|
let g:languagetool_cmd = "${pkgs.languagetool}/bin/languagetool-commandline"
|
||||||
|
" TODO Doesn't work
|
||||||
|
|
||||||
|
'' + lib.optionalString config.programs.pandoc.enable ''
|
||||||
|
" vim-pandox
|
||||||
|
let g:pandoc#modules#disabled = ["folding"]
|
||||||
|
let g:pandoc#spell#enabled = 0
|
||||||
|
let g:pandoc#syntax#conceal#use = 0
|
||||||
|
|
||||||
|
'';
|
||||||
|
autoCmd = [
|
||||||
|
# Turn off relativenumber only for insert mode
|
||||||
|
{ event = "InsertEnter"; pattern = "*"; command = "set norelativenumber"; }
|
||||||
|
{ event = "InsertLeave"; pattern = "*"; command = "set relativenumber"; }
|
||||||
|
|
||||||
|
# vim-easy-align: Align Markdown tables
|
||||||
|
{ event = "FileType"; pattern = "markdown"; command = "vmap <Bar> :EasyAlign*<Bar><Enter>"; }
|
||||||
|
];
|
||||||
|
|
||||||
|
userCommands = {
|
||||||
|
# Reload = { command = "source $MYVIRMC"; };
|
||||||
|
# TODO Is not working, options is set to nil even though it shouldn't
|
||||||
|
};
|
||||||
|
|
||||||
|
keymaps = [
|
||||||
|
# GENERAL
|
||||||
|
|
||||||
|
# Allow saving of files as sudo when I forgot to start vim using sudo.
|
||||||
|
# From https://stackoverflow.com/a/7078429
|
||||||
|
{ mode = "c"; key = "w!!"; action = "w !sudo tee > /dev/null %"; }
|
||||||
|
|
||||||
|
{ mode = "i"; key = "jk"; action = "<Esc>"; }
|
||||||
|
{ mode = "v"; key = "<Enter>"; action = "<Esc>"; }
|
||||||
|
{ key = "<Enter>"; action = "o<Esc>"; }
|
||||||
|
|
||||||
|
# { key = "<C-H>"; action = ":bp<CR>"; }
|
||||||
|
# { key = "<C-L>"; action = ":bn<CR>"; }
|
||||||
|
{ key = "<C-K>"; action = "kkkkkkkkkkkkkkkkkkkkk"; }
|
||||||
|
{ key = "<C-J>"; action = "jjjjjjjjjjjjjjjjjjjjj"; }
|
||||||
|
|
||||||
|
# \s to replace globally the word under the cursor
|
||||||
|
{ key = "<Leader>s"; action = ":%s/\\<<C-r><C-w>\\>/"; }
|
||||||
|
|
||||||
|
# PLUGINS
|
||||||
|
|
||||||
|
# barbar
|
||||||
|
{ key = "<C-H>"; action = "<Cmd>BufferPrevious<CR>"; options = { silent = true; }; }
|
||||||
|
{ key = "<C-L>"; action = "<Cmd>BufferNext<CR>"; options = { silent = true; }; }
|
||||||
|
# TODO https://www.reddit.com/r/neovim/comments/mbj8m5/how_to_setup_ctrlshiftkey_mappings_in_neovim_and/
|
||||||
|
{ key = "<Space><C-H>"; action = "<Cmd>BufferMovePrevious<CR>"; options = { silent = true; }; }
|
||||||
|
{ key = "<Space><C-L>"; action = "<Cmd>BufferMoveNext<CR>"; options = { silent = true; }; }
|
||||||
|
# TODO gotos don't work
|
||||||
|
{ key = "<C-1>"; action = "<Cmd>BufferGoto 1<CR>"; options = { silent = true; }; }
|
||||||
|
{ key = "<C-2>"; action = "<Cmd>BufferGoto 2<CR>"; options = { silent = true; }; }
|
||||||
|
{ key = "<C-3>"; action = "<Cmd>BufferGoto 3<CR>"; options = { silent = true; }; }
|
||||||
|
{ key = "<C-4>"; action = "<Cmd>BufferGoto 4<CR>"; options = { silent = true; }; }
|
||||||
|
{ key = "<C-5>"; action = "<Cmd>BufferGoto 5<CR>"; options = { silent = true; }; }
|
||||||
|
{ key = "<C-6>"; action = "<Cmd>BufferGoto 6<CR>"; options = { silent = true; }; }
|
||||||
|
{ key = "<C-7>"; action = "<Cmd>BufferGoto 7<CR>"; options = { silent = true; }; }
|
||||||
|
{ key = "<C-8>"; action = "<Cmd>BufferGoto 8<CR>"; options = { silent = true; }; }
|
||||||
|
{ key = "<C-9>"; action = "<Cmd>BufferGoto 9<CR>"; options = { silent = true; }; }
|
||||||
|
{ key = "<C-0>"; action = "<Cmd>BufferLast<CR>"; options = { silent = true; }; }
|
||||||
|
{ key = "gb"; action = "<Cmd>BufferPick<CR>"; options = { silent = true; }; }
|
||||||
|
# TODO Other useful options?
|
||||||
|
|
||||||
|
# symbols-outline-nvim
|
||||||
|
{ key = "<Space>s"; action = "<Cmd>SymbolsOutline<CR>"; options = { silent = true; }; }
|
||||||
|
|
||||||
|
# undotree
|
||||||
|
{ key = "<Space>u"; action = "<Cmd>UndotreeToggle<CR>"; options = { silent = true; }; }
|
||||||
|
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue