nixpkgs/home/programs/neovim.nix

313 lines
8.5 KiB
Nix
Raw Normal View History

{ pkgs }:
let
2022-03-15 08:41:41 +01:00
# The folder contains the expected `~/.config/nvim/` structure
# This structure is the same for plugins.
# I therefore just load this folder as plugin.
configuration = pkgs.vimUtils.buildVimPlugin {
name = "configuration";
src = ./neovim/configuration;
};
colorscheme-smyckblue = pkgs.vimUtils.buildVimPlugin {
name = "colorscheme-smyckblue";
src = pkgs.fetchgit {
url = "https://gitea.daniel-siepmann.de/danielsiepmann/vim-colorscheme-smyckblue.git";
2022-03-16 09:03:19 +01:00
rev = "v1.0.1";
sha256 = "bBX3dzqKz6kTACfyAU4HH0UFVDYdyqLTvQdYTgWw8Jg=";
};
};
neotags = pkgs.vimUtils.buildVimPlugin {
name = "neotags";
src = pkgs.fetchgit {
url = "https://gitea.daniel-siepmann.de/danielsiepmann/neotags.git";
rev = "v0.3.0";
sha256 = "uJ7cl+1Ngff0FKzjmh1i7O/PkNjPvPT+ZEHgceeZcz0=";
};
};
# TODO: Update, compare with other forks, move to Gitea
syntax-typoscript = pkgs.vimUtils.buildVimPlugin {
name = "syntax-typoscript";
src = pkgs.fetchFromGitHub {
owner = "DanielSiepmann";
repo = "vim.typoscript";
rev = "286bc376b55b0d0d0adc6e7ccfa6a75719437120";
sha256 = "BPvKwcTo/OL9VkNJ9dv8hs4nlVkxMI6pdkZXXAKBMWs=";
};
};
syntax-nix = pkgs.vimUtils.buildVimPlugin {
name = "syntax-nix";
src = pkgs.fetchFromGitHub {
owner = "LnL7";
repo = "vim-nix";
rev = "63b47b39c8d481ebca3092822ca8972e08df769b";
sha256 = "wQzNXfE7JFalgiCQ2ksPAUyFKacmJV7mNKmKDe9jySI=";
};
};
syntax-php = pkgs.vimUtils.buildVimPlugin {
name = "syntax-php";
src = pkgs.fetchFromGitHub {
owner = "StanAngeloff";
repo = "php.vim";
rev = "2ec2ab9fcc65bfc47c7ba6b3846903528188ceea";
sha256 = "lgsaCU6Rzzynkd9SID0chjKaxgEWznrmEl133Syc6cY=";
};
};
syntax-fluid = pkgs.vimUtils.buildVimPlugin {
name = "syntax-fluid";
src = pkgs.fetchFromGitHub {
owner = "mipmip";
repo = "vim-fluid";
rev = "cedc4ad871941e8f7134d1d71f9434f1bc3d93d5";
sha256 = "LiS2Dqw1K1Fu5VfHQnxIBDxDzEarmSAUUavQcwHRDsQ=";
};
};
syntax-mustache = pkgs.vimUtils.buildVimPlugin {
name = "syntax-mustahce";
src = pkgs.fetchFromGitHub {
owner = "mustache";
repo = "vim-mustache-handlebars";
rev = "0153fe03a919add2d6cf2d41b2d5b6e1188bc0e0";
sha256 = "lmYt+GKuXhbOhu3HufqIFE2DvzUYlk5vGqU6tpJ2yjY=";
};
};
ag = pkgs.vimUtils.buildVimPlugin {
name = "ag";
src = pkgs.fetchFromGitHub {
owner = "rking";
repo = "ag.vim";
rev = "c478f7973074f15bbf82c298a1678b4e23f1767a";
sha256 = "jlR8NFG7IRCYiQ7ocQQCI2npAPujgQFZ6RpFX8zwTAA=";
};
};
vdebug = pkgs.vimUtils.buildVimPlugin {
name = "vdebug";
src = pkgs.fetchFromGitHub {
owner = "joonty";
repo = "vdebug";
rev = "v2.0.0";
sha256 = "kobMC6TRFZcEbgFdOaBgXUzoeWQUrVzUKylN1N9nEnc=";
};
};
sqlformat = pkgs.vimUtils.buildVimPlugin {
name = "sqlformat";
src = pkgs.fetchFromGitHub {
owner = "mpyatishev";
repo = "vim-sqlformat";
rev = "2a2a57d75865526f85d94bf769f4fd54d61c426b";
sha256 = "LPnHcuh+jxEL8CZ1wizHqi3uzYYtIxzMqnE7y7mTrbE=";
};
};
diff-fold = pkgs.vimUtils.buildVimPlugin {
name = "diff-fold";
src = pkgs.fetchFromGitHub {
owner = "sgeb";
repo = "vim-diff-fold";
rev = "48b4505c1b6f14ceb4e4be732aad337147ef36cd";
sha256 = "M3CAUueEhLD0J6sLUpRkFv+vK4aGYO+Xnokxmn+VxqU=";
};
};
phpactor = pkgs.vimUtils.buildVimPlugin {
name = "phpactor";
src = pkgs.fetchzip {
url = "https://daniel-siepmann.de/fileadmin/phpactor-0.18.0.tar.gz";
sha256 = "1XHqKxBXcFPt2P/N2drr8EkBsg0Hu94Vjq0my+aj614=";
};
};
neoterm = pkgs.vimUtils.buildVimPlugin {
name = "neoterm";
src = pkgs.fetchFromGitHub {
owner = "kassio";
repo = "neoterm";
rev = "e78179a9ceb98de8d0c37bdda435a5deab4d5e71";
sha256 = "0w962xfcgigdw41wblrv1l55xki0kl5vwkdbm6jlr44hzii0nhgz";
};
patches = [
./neovim/patches/disable_neoterm_repl.patch
];
};
tagbar = pkgs.vimUtils.buildVimPlugin {
name = "tagbar";
src = pkgs.fetchFromGitHub {
owner = "majutsushi";
repo = "tagbar";
rev = "v2.7";
sha256 = "Eg6xRwisopmBexqkWjRbSi9aQC4uCXbFO6SCK1LY+Ow=";
};
};
test = pkgs.vimUtils.buildVimPlugin {
name = "test";
src = pkgs.fetchFromGitHub {
owner = "vim-test";
repo = "vim-test";
rev = "16a3b6da1bab42473d42d7e02d89d549d7a5e138";
sha256 = "CVSTy/FeBgyzRK8NWDMiIynz7DRlFenruiCOjowYnMI=";
};
patches = [
./neovim/patches/disable_test_paratest.patch
];
};
in {
enable = true;
extraConfig = pkgs.lib.concatMapStringsSep "\n" (file: pkgs.lib.fileContents file) [
./neovim/init.vim
./neovim/config/functions.vim
./neovim/config/indentation.vim
./neovim/config/mappings.vim
./neovim/config/searching.vim
./neovim/config/statusline.vim
./neovim/config/undo.vim
./neovim/config/wildignore.vim
./neovim/config/autocommands/basics.vim
./neovim/config/autocommands/gitdiff.vim
./neovim/config/autocommands/typo3.vim
./neovim/config/autocommands/vdebug.vim
./neovim/config/folderspecific/reuter.vim
./neovim/config/folderspecific/sac.vim
];
extraPython3Packages = (ps: with ps; [
2022-03-15 08:41:41 +01:00
# Dependency of sqlformat
sqlparse
]);
# TODO: Check out these plugins as additions / replacements:
#
# - https://github.com/rhysd/conflict-marker.vim/ (check out while resolving next merge conflict)
# - https://github.com/sindrets/diffview.nvim/ (check out while reviewing PR next time?!)
# - https://github.com/ray-x/lsp_signature.nvim/ (Show signature hint while adding parameters to call)
# - https://github.com/folke/trouble.nvim (Prettier lists like quickfix, loclist, is it worth it?)
# - https://github.com/weilbith/nvim-code-action-menu/ Check with phpactor and lsp
# - https://github.com/RishabhRD/nvim-lsputils/
#
# - https://github.com/hrsh7th/nvim-cmp (due to actual help of each parameter while adding values to function call)
#
# Alternatives:
# - https://github.com/ms-jpq/chadtree/ (due to visual mode, is it worth it?)
# - https://github.com/mfussenegger/nvim-dap Alternative to Vdebug, more modern and should work with firefox as well? But needs node …)
#
# Reviewed plugins until: https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vim/plugins/generated.nix#L5810
plugins = with pkgs.vimPlugins; [
# My own plugins
colorscheme-smyckblue
neotags
configuration
syntax-typoscript
# More UI related
{
plugin = nerdtree;
config = pkgs.lib.fileContents ./neovim/plugins/nerdtree.vim;
}
{
plugin = undotree;
config = pkgs.lib.fileContents ./neovim/plugins/undotree.vim;
}
{
# Use pinned to 2.7 as I don't need any of the new features.
# Instead they make it hard to only show what I'm interested in within PHP files.
# As they changed the building with nested structures.
plugin = tagbar;
config = pkgs.lib.fileContents ./neovim/plugins/tagbar.vim;
}
{
Migrate Neovim CtrlP to FinderF Way faster and matches my own preferences. Has a preview and pop up in the center of the screen. Comes with many other modes like colorscheme, help, line, etc. diff --git a/home/programs/neovim.nix b/home/programs/neovim.nix index 55783de..dda525c 100644 --- a/home/programs/neovim.nix +++ b/home/programs/neovim.nix @@ -239,8 +239,8 @@ in { } { - plugin = ctrlp-vim; - config = pkgs.lib.fileContents ./neovim/plugins/ctrlp.vim; + plugin = LeaderF; + config = pkgs.lib.fileContents ./neovim/plugins/leaderf.vim; } # Syntax diff --git a/home/programs/neovim/config/functions.vim b/home/programs/neovim/config/functions.vim index 24e0c00..fea577b 100644 --- a/home/programs/neovim/config/functions.vim +++ b/home/programs/neovim/config/functions.vim @@ -113,7 +113,7 @@ function! StartProfiling() execute(':profile file *') endfunc -function! CtrlPCurrentComposerPackage() +function! LeaderfCurrentComposerPackage() let l:filePath = split(expand('%:p:h'), '/') while !filereadable('/' . join(l:filePath + ['composer.json'], '/')) && len(l:filePath) @@ -121,7 +121,7 @@ function! CtrlPCurrentComposerPackage() endwhile if len(l:filePath) - execute(':CtrlP /' . join(l:filePath, '/')) + execute(':LeaderfFile /' . join(l:filePath, '/')) else echom 'No composer package detected.' endif diff --git a/home/programs/neovim/config/mappings.vim b/home/programs/neovim/config/mappings.vim index bd3aee9..7b7ad7d 100644 --- a/home/programs/neovim/config/mappings.vim +++ b/home/programs/neovim/config/mappings.vim @@ -10,10 +10,11 @@ nnoremap <leader>v :set paste!<cr> nnoremap <leader>nh :nohlsearch<cr> " Configure navigation, e.g. go to buffer, file, ... -nnoremap <leader>p :CtrlP<cr> -nnoremap <leader>l :CtrlPBuffer<cr> -nnoremap <leader>r :CtrlPBufTag<cr> -nnoremap <silent> <leader>c :call CtrlPCurrentComposerPackage()<cr> +nnoremap <leader>pp :LeaderfSelf<cr> +nnoremap <leader>pf :LeaderfFile<cr> +nnoremap <leader>pb :LeaderfBuffer<cr> +nnoremap <leader>pt :LeaderfBufTag<cr> +nnoremap <silent> <leader>pc :call LeaderfCurrentComposerPackage()<cr> nnoremap <leader>k :NERDTreeToggle<cr> nnoremap <leader>f :NERDTreeFind<cr> diff --git a/home/programs/neovim/plugins/ctrlp.vim b/home/programs/neovim/plugins/ctrlp.vim deleted file mode 100644 index c45b87e..0000000 --- a/home/programs/neovim/plugins/ctrlp.vim +++ /dev/null @@ -1,26 +0,0 @@ -let g:ctrlp_follow_symlinks = 2 -" Default to regex mode -let g:ctrlp_regexp = 1 -let g:ctrlp_match_window = 'top,order:ttb,min:1,max:10' -" let g:ctrlp_open_new_file = '0' -" let g:ctrlp_lazy_update = 1 -let g:ctrlp_show_hidden = 1 - -let g:ctrlp_types = ['fil', 'buf', 'buftag'] - -let g:ctrlp_working_path_mode = 'w' -let g:ctrlp_max_files = 0 -let g:ctrlp_clear_cache_on_exit = 0 - -" Configure completion for tags in buffer, -" e.g. configure which kinds to complete for css. -let g:ctrlp_buftag_types = { - \ 'css' : '--css-types=vcit', - \ 'typescript' : '--typescript-types=cnfvmitesod', - \ 'xml' : '--xml-types=ci', - \ 'rst' : '--reStructuredText-types=csSt', - \ 'markdown' : '--Markdown-types=csStT', - \ 'fluid' : '--xml-types=si', - \ 'apache' : '--apache-types=s', - \ 'yaml' : '--yaml-types=t', -\ } diff --git a/home/programs/neovim/plugins/leaderf.vim b/home/programs/neovim/plugins/leaderf.vim new file mode 100644 index 0000000..7627b07 --- /dev/null +++ b/home/programs/neovim/plugins/leaderf.vim @@ -0,0 +1,213 @@ +let g:Lf_WorkingDirectoryMode = 'c' + +let g:Lf_FollowLinks = 1 +let g:Lf_ShowHidden = 1 + +let g:Lf_WindowPosition = 'popup' +let g:Lf_HideHelp = 1 + +let g:Lf_GtagsAutoUpdate = 0 + +let g:Lf_IgnoreCurrentBufferName = 1 + +let g:Lf_ShowDevIcons = 0 + +" TODO: Try to port to existing colorscheme, does it work with load order? +let g:Lf_PopupPalette = { + \ 'dark': { + \ 'Lf_hl_popup_inputText': { + \ 'cterm': 'none', + \ 'ctermfg': 'blue', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_popup_window': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_popup_blank': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_popup_cursor': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_popup_prompt': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_popup_spin': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_popup_normalMode': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_popup_inputMode': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_popup_category': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_popup_nameOnlyMode': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_popup_fullPathMode': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_popup_fuzzyMode': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_popup_regexMode': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_popup_cwd': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_popup_lineInfo': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_popup_total': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_cursorline': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': '235', + \ }, + \ 'Lf_hl_selection': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_match0': { + \ 'cterm': 'none', + \ 'ctermfg': 'blue', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_match1': { + \ 'cterm': 'none', + \ 'ctermfg': 'blue', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_match2': { + \ 'cterm': 'none', + \ 'ctermfg': 'blue', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_match3': { + \ 'cterm': 'none', + \ 'ctermfg': 'blue', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_match4': { + \ 'cterm': 'none', + \ 'ctermfg': 'blue', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_match': { + \ 'cterm': 'none', + \ 'ctermfg': 'blue', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_lineLocation': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_previewTitle': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_winNumber': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_winIndicators': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_winModified': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_winNomodifiable': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_winDirname': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_quickfixFileName': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_quickfixLineNumber': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_quickfixColumnNumber': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_loclistFileName': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_loclistLineNumber': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': 'none', + \ }, + \ 'Lf_hl_loclistColumnNumber': { + \ 'cterm': 'none', + \ 'ctermfg': 'none', + \ 'ctermbg': 'none', + \ }, + \ } + \ } + +let g:Lf_PreviewInPopup = 1 +let g:Lf_PreviewHorizontalPosition = 'center' +let g:Lf_PreviewCode = 0 +let g:Lf_PreviewResult = { + \ 'File': 1, + \ 'Buffer': 1, + \ 'BufTag': 1, + \}
2022-03-16 09:05:13 +01:00
plugin = LeaderF;
config = pkgs.lib.fileContents ./neovim/plugins/leaderf.vim;
}
# Syntax
syntax-nix
syntax-mustache
2022-03-16 09:03:51 +01:00
i3config-vim
syntax-fluid
{
plugin = syntax-php;
config = pkgs.lib.fileContents ./neovim/plugins/php.vim;
}
# Adding features
ag
sqlformat
diff-fold
{
plugin = vim-snipmate;
2022-03-15 08:41:41 +01:00
# I didn't migrate snippets to new format, yet.
config = ''
let g:snipMate = { 'snippet_version' : 0 }
'';
}
vim-fugitive
vim-commentary
vim-indent-object
vim-textobj-comment
{
plugin = vdebug;
config = pkgs.lib.fileContents ./neovim/plugins/vdebug.vim;
}
{
# Seems to be broken: https://github.com/kassio/neoterm/issues/338
# Therefore I install my own version where this bug is disabled
plugin = neoterm;
config = pkgs.lib.fileContents ./neovim/plugins/neoterm.vim;
}
{
plugin = phpactor;
config = ''
let g:phpactorOmniError = v:true
let g:phpactorPhpBin = "${pkgs.php80}/bin/php"
'';
}
# More related to testing, linting, …
{
plugin = ale;
config = pkgs.lib.fileContents ./neovim/plugins/ale.vim;
}
{
plugin = test;
config = pkgs.lib.fileContents ./neovim/plugins/test.vim;
}
# Dependencies for other plugins
vim-addon-mw-utils
vim-textobj-user
];
}