From 895b1985f582d38d3cd66585ed86189a4a8e98e6 Mon Sep 17 00:00:00 2001 From: Ricard Illa Date: Fri, 3 Feb 2023 17:42:08 +0100 Subject: [PATCH] changes to neovim config --- home/neovim/common.nix | 19 ------------------- home/neovim/default.nix | 25 ++++++++++++++++++++----- home/neovim/init.vim | 7 ++++--- 3 files changed, 24 insertions(+), 27 deletions(-) delete mode 100644 home/neovim/common.nix diff --git a/home/neovim/common.nix b/home/neovim/common.nix deleted file mode 100644 index a92f8ee..0000000 --- a/home/neovim/common.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ config, pkgs, ... }: - -{ - home.packages = with pkgs; [ - black - jq - # sqlfluff - nixfmt - shfmt - hlint - ]; - programs.neovim = { - enable = true; - viAlias = true; - vimAlias = true; - vimdiffAlias = true; - withPython3 = true; - }; -} diff --git a/home/neovim/default.nix b/home/neovim/default.nix index 82b5fa8..8c93f77 100644 --- a/home/neovim/default.nix +++ b/home/neovim/default.nix @@ -1,8 +1,23 @@ { config, pkgs, ... }: { - imports = [ ./common.nix ]; programs.neovim = { + enable = true; + viAlias = true; + vimAlias = true; + vimdiffAlias = true; + withPython3 = true; + extraPackages = with pkgs; [ + black + jq + # sqlfluff + nixfmt + shfmt + hlint + pylint + nodePackages.pyright + ]; + extraPython3Packages = pyPkgs: with pyPkgs; [ pylint ]; plugins = with pkgs.vimPlugins; # find sha256 with: # nix-prefetch-url --unpack https://github.com/${owner}/${repo}/archive/${rev}.tar.gz @@ -75,14 +90,14 @@ }; meta.homepage = "https://github.com/lambdalisue/fern-hijack.vim"; }; - black-vim = pkgs.vimUtils.buildVimPlugin { + black-vim = pkgs.vimUtils.buildVimPlugin rec { pname = "black-vim"; - version = "git"; + version = "23.1.0"; src = pkgs.fetchFromGitHub { owner = "psf"; repo = "black"; - rev = "f1d4e742c91dd5179d742b0db9293c4472b765f8"; - sha256 = "124a76cpl3xx9v2kbcprsajr149f93nib4hgacqii798m3mzm1x9"; + rev = "refs/tags/${version}"; + sha256 = "08rvk15mrvpmmjw7zw1ixcgh3sx2knadzrpp21q8kamvbizbjp5f"; }; meta.homepage = "https://github.com/psf/black"; }; diff --git a/home/neovim/init.vim b/home/neovim/init.vim index 3b722e7..ad0c6ae 100644 --- a/home/neovim/init.vim +++ b/home/neovim/init.vim @@ -166,9 +166,9 @@ let g:airline#extensions#ale#enabled = 1 let g:ale_linters ={ \ 'haskell': ['hlint', 'hdevtools', 'hfmt'], \} -let g:ale_python_auto_pipenv=1 " see ale-integrations-local-executables +" let g:ale_python_auto_pipenv=1 " see ale-integrations-local-executables "let g:ale_python_pylint_auto_pipenv=1 -let g:ale_python_pylint_executable="pipenv" +" let g:ale_python_pylint_executable="pipenv" let g:ale_python_pylint_change_directory=1 autocmd! User GoyoEnter Limelight @@ -222,9 +222,10 @@ let g:UltiSnipsExpandTrigger="" let g:UltiSnipsJumpForwardTrigger="" let g:UltiSnipsJumpBackwardTrigger="" -autocmd FileType python nnoremap :Black autocmd FileType sql nnoremap :%!sqlfluff fix - autocmd FileType sh nnoremap :Shfmt autocmd FileType json nnoremap :%!jq --indent 4 . autocmd FileType terraform nnoremap :TerraformFmt autocmd FileType nix nnoremap :%!nixfmt < % +" autocmd FileType python nnoremap :Black +autocmd FileType python nnoremap :!black %