{ pkgs, ... }: let customPlugins = { vim-zettel = pkgs.vimUtils.buildVimPlugin { name = "vim-zettel"; src = pkgs.fetchFromGitHub { owner = "michal-h21"; repo = "vim-zettel"; rev = "929d90eec62e6f693c2702d2b6f76a93f2f1689d"; sha256 = "1fzKmknfVlEYwqeXgbKITbb2/PJ023iJyMz6vak3qh4="; }; }; lsp-format = pkgs.vimUtils.buildVimPlugin { name = "lsp-format"; src = pkgs.fetchFromGitHub { owner = "lukas-reineke"; repo = "lsp-format.nvim"; rev = "84e117b99bb2bc0d0c8122e2b256046f046f8aff"; sha256 = "rs3NTZwWdsmBGXnrgUeVxUiNjbN/ULxJHifPYJD9mT4="; }; }; vimwiki-sync = pkgs.vimUtils.buildVimPlugin { name = "vimwiki-sync"; src = pkgs.fetchFromGitHub { owner = "michal-h21"; repo = "vimwiki-sync"; rev = "f362dcf0c9ab2a9ad4def899d95390289053c04d"; sha256 = "1fzKmknfVlEYwqeXgbKITbb2/PJ023iJyMz6vak3qh4="; #TODO }; }; vim-tidal = pkgs.vimUtils.buildVimPluginFrom2Nix { name = "vim-tidal"; src = pkgs.fetchgit { url = "https://github.com/tidalcycles/vim-tidal"; # version 1.4.6 rev = "52134979252757a5736ae09cb9fc6ae3cc04daef"; sha256 = "c12v9+s/JspQ9Am291RFI7eg0UAeXGDvJ5lK+7ukOb0="; }; dependencies = [ ]; }; tidal = pkgs.stdenv.mkDerivation { name = "tidal"; src = pkgs.fetchgit { url = "https://github.com/tidalcycles/vim-tidal"; # version 1.4.6 rev = "52134979252757a5736ae09cb9fc6ae3cc04daef"; sha256 = "c12v9+s/JspQ9Am291RFI7eg0UAeXGDvJ5lK+7ukOb0="; }; preConfigure = '' mkdir -p $out/bin substituteInPlace Makefile \ --replace '/usr/local' "$out" \ ''; }; }; my-python-packages = python-packages: with python-packages; [ tasklib pynvim six python-lsp-server python-lsp-black pylsp-mypy black # other python packages you want ]; python-with-my-packages = pkgs.python3.withPackages my-python-packages; in { home.sessionVariables.EDITOR = "nvim"; home.shellAliases = { k = "cd ~/kitaab/vimwiki; vim -c :VimwikiIndex; cd $OLDPWD"; kz = "cd ~/kitaab/vimwiki; vim -c :VimwikiIndex -c :ZettelNew; cd $OLDPWD"; }; #environment.systemPackages = with customPlugins; [ tidal ]; programs.neovim = { enable = true; extraConfig = '' set tabstop=2 set showmatch set shiftwidth=2 set noexpandtab set autoindent set undofile set signcolumn=auto:4 set title " set foldmethod=indent " fold based on indent set number set nocompatible set relativenumber set showtabline=2 set noexpandtab set autowriteall syntax on set list lcs=tab:\|\ filetype plugin on " include - in word to move across easier in lisp / clojure set iskeyword+=- set termguicolors colorscheme ayu-mirage " set spell set spelllang=en_gb set ignorecase set smartcase set incsearch " if hidden is not set, TextEdit might fail. set hidden " Some servers have issues with backup files, see #649 set nobackup set nowritebackup " Better display for messages set cmdheight=2 " You will have bad experience for diagnostic messages when it's default 4000. set updatetime=300 " don't give |ins-completion-menu| messages. set shortmess+=c " always show signcolumns set signcolumn=yes " window nmap wh :topleft vnew nmap wl :botright vnew nmap wk :topleft new nmap wj :botright new " tabs nmap rt :retab! vmap rt :retab! let mapleader = "\" let maplocalleader = "," " moving splits with vim movements. :tnoremap h :tnoremap j :tnoremap k :tnoremap l :inoremap h :inoremap j :inoremap k :inoremap l :nnoremap h :nnoremap j :nnoremap k :nnoremap l :nnoremap "=strftime("%Y-%m-%d %H:%M") :inoremap =strftime("%Y-%m-%d %H:%M") :inoremap =strftime("%H:%M") " tidal nvim terminal let g:tidal_target = "terminal" " telescope " Find files using Telescope command-line sugar. nnoremap ff Telescope find_files nnoremap fg Telescope live_grep nnoremap fb Telescope buffers nnoremap fh Telescope help_tags nnoremap ft Telescope tags " exit normal mode in terminal :tnoremap " Sexp in Conjure (since it's fennel) let g:sexp_filetypes = "fennel" let g:conjure#filetype#fennel = "conjure.client.fennel.stdio" let g:rainbow_active = 0 autocmd BufReadPost,BufNewFile c,clj,cljs RainbowParenthesesToggleAll " general commands map t :NERDTreeToggle map s :w map q :q map r :RainbowParenthesesToggleAll map :noh map Q nnoremap Y y$ " center moving nnoremap n nzzzv nnoremap N Nzzzv nnoremap J mzJ'z " undo points inoremap , ,u inoremap . .u inoremap ? ?u inoremap ! !u inoremap ) )u inoremap [ [u inoremap ] ]u inoremap { {u inoremap ( (u inoremap } }u " moving text vnoremap J :m '>+1gv=gv vnoremap K :m '>-2gv=gv inoremap :m .+1== inoremap :m .-2== nnoremap j :m .+1== nnoremap k :m .-2== " Pasting :map sy :!xclip -i :vmap sy "*y :map sp :r!xclip -o " barbar nnoremap gT :BufferPrevious nnoremap gt :BufferNext nnoremap gj :BufferPick nnoremap gq :BufferClose " git nnoremap ga :G fetch --all nmap gs :G nmap gl :diffget //3 nmap gh :diffget //2 nmap gb :GBranches nnoremap gp :Git! push nnoremap gd :Gdiff nnoremap gc :G commit -v -q %:p " kitaab map cz :VimwikiIndex:ZettelNew map zs :ZettelSearch map zo :ZettelOpen map zn :ZettelNew map zf :Telescope oldfiles only_cwd=true map wt :VimwikiMakeTomorrowDiaryNote map wd :VimwikiMakeYesterdayDiaryNote map zd :Goyo:lua require('cmp').setup.buffer { enabled = false } let g:vimwiki_list = [{ 'path': '~/kitaab/vimwiki', 'auto_tags': 1, 'auto_diary_index': 1, 'auto_generate_links': 1 }] let g:sync_taskwarrior = 0 let g:zettel_format = "%y%m%d-%H%M" let g:mapleader="\" " fzf " not sure we even use this let g:fzf_layout = { 'window': { 'width': 0.8, 'height': 0.8 } } " lsp commands nnoremap vd :lua vim.lsp.buf.definition() nnoremap vi :lua require('telescope.builtin').lsp_implementation() nnoremap vsh :lua vim.lsp.buf.signature_help() nnoremap vrr :lua require('telescope.builtin').lsp_references() nnoremap vrn :lua vim.lsp.buf.rename() nnoremap vh :lua vim.lsp.buf.hover() nnoremap vca :lua vim.lsp.buf.code_action() nnoremap vsd :lua rim.lsp.diagnostic.show_line_diagnostics(); vim.lsp.util.show_line_diagnostics() nnoremap vn :lua vim.lsp.diagnostic.goto_next() nnoremap vll :call LspLocationList() nnoremap va :lua require('telescope.builtin').lsp_code_actions(require('telescope.themes').get_cursor()) " dashboard let g:dashboard_custom_header = [ \' ', \' ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣤⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀', \'⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⣿⠁⠀⠀⠀⠀⠀⠀⠀⢠⣿⣶⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ', \'⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣧⠀⠀⠀⠀⠀⠀⠀⠀⢻⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ', \'⠀⠀⠀⠀⠀⠀⠀⢴⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⡀⠀⠀⠀⠀⠀⠀⠀⠘⠀⠀⠀⠀⠀⠀⠀⠀⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⡆⠀⠀⠀⠀⠀⠀ ', \'⠀⠀⠀⠀⠀⠀⠀⠈⢿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣿⠟⠉⠀⠀⠀⠀⠀⠀⠀ ', \'⠀⠀⠀⠀⠀⠀⠀⠀⠀⠻⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠶⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ', \'⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ', \'⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ', \'⠀⠀⠀⠀⠀⠀⠀⢀⣀⡤⠤⠤⠖⣒⠒⡖⠲⡦⣤⣄⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣤⣤⣤⣤⣤⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ', \'⠀⠀⠀⠀⠀⣠⢶⠉⠩⢀⣠⡤⠤⠯⠬⠥⣼⣅⡃⠸⠉⠛⡷⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⢶⢻⢻⢹⣃⣨⣧⣤⣴⣹⣉⠛⢶⣄⠀⠀⠀⠀⠀⠀ ', \'⠀⠀⠀⣰⠞⠁⢈⡤⠚⠉⠀⠀⠘⣆⡀⠀⡀⠀⠉⠙⠲⢼⣰⢡⣟⢶⣄⠀⠀⠀⠀⠀⠀⠀⢀⣠⠶⡟⣇⣺⠾⠋⠉⠁⠀⠀⠀⠀⠀⠉⠙⠳⢿⣷⣄⠀⠀⠀⠀ ', \'⠀⢀⡼⡁⢸⣰⠏⠀⠀⠀⠀⠀⠀⠘⡞⠀⠀⠀⠀⠀⠀⠀⠉⠻⣿⡞⡼⣷⣄⠀⠀⠀⣠⣾⠛⠄⣷⠟⠋⠀⠀⠀⠀⠀⠀⠀⢀⣀⠀⠀⠀⢠⠀⠈⠻⣧⠀⠀⠀ ', \'⠀⡼⠁⢀⡼⠁⠀⠀⠀⣀⠤⠖⠛⠛⠛⠛⠓⠲⠤⣄⡀⠀⠀⠀⠀⠻⢷⣿⣿⣷⣤⣾⠹⢌⡷⠛⠁⠀⠀⠀⠀⣀⡤⠔⠛⠉⠉⠈⠉⠛⠲⣄⣇⠀⠀⠙⣷⠀⠀ ', \'⢰⠷⣀⡜⠁⠀⠀⢀⠞⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠲⣤⡀⢀⡤⠚⢻⣿⣿⢣⢈⡴⠋⠀⠀⠀⠀⣠⠔⠋⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢻⡇⠀⠀⠘⣇⠀ ', \'⣾⣇⣹⢃⡀⠀⢀⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣷⣾⣞⡇⢹⡼⠋⠀⠀⠀⢠⡴⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⠀⠀⠀⢹⠀ ', \'⢹⢀⣿⠘⡇⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⢟⢱⢹⡾⠋⠀⠀⠀⣠⣾⣿⣦⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⢸⡀ ', \'⢸⣅⣯⠀⣆⠀⢸⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⢻⣹⢸⡼⠋⠀⠀⠀⢀⡼⢻⣻⣿⡽⡹⠳⢤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡾⠀⠀⠀⢸⠀ ', \'⠈⣿⣿⡀⠘⠀⠈⣿⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⢾⢻⢿⣿⠟⠋⠀⠀⠀⠀⣠⣟⠘⣿⡏⠋⠻⢥⣃⡎⣽⠻⢦⣄⣀⠀⠀⠀⠀⠀⣀⡴⣾⠃⠀⠀⠀⡼⠀ ', \'⠀⠙⣎⣧⠀⠀⠀⠈⢻⣍⠓⠲⣶⣶⣶⣶⡖⢋⣿⣏⡧⠞⠋⠁⠀⠀⠀⢀⣤⠞⠁⠈⠻⣷⣧⠀⡀⠀⠉⠓⢧⣇⢰⢈⠙⢻⠒⡖⢲⠚⣍⡴⠃⠀⠀⠀⣴⠃⠀ ', \'⠀⠀⠙⢾⣷⡀⠀⠀⠀⠈⠙⠓⠾⠿⠾⠿⠿⠚⠉⠁⠀⠀⠀⠀⠀⣠⡴⠛⠁⠀⠀⠀⠀⠀⠙⠷⣝⠣⠀⠀⠀⠈⠉⠒⠶⠾⠤⠧⠼⠚⠉⠀⠀⠀⢀⡴⠃⠀⠀ ', \'⠀⠀⠀⠀⠙⠿⣦⣀⠀⠀⠀⠀⠀⡄⠀⠀⠀⠀⠀⠀⠀⢀⣠⡴⠞⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⠶⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠄⢀⡴⠟⠁⠀⠀⠀ ', \'⠀⠀⠀⠀⠀⠀⠀⠈⠛⠒⠤⠤⣄⣀⣀⣀⣠⠤⠤⠶⠛⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠒⠦⠤⢤⣀⣀⣠⡤⠤⠟⠋⠀⠀⠀⠀⠀⠀ ', \'⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ', \'⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ', \'⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡶⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⢷⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ', \'⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡾⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠻⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀ ', \'⠀⠀⠀⠀⠀⠀⢀⣴⡾⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣦⣀⠀⠀⠀⠀⠀⠀ ', \'⠀⠀⠀⠀⠀⠘⠻⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⠏⠀⠀⠀⠀⠀⠀⠀⠀⠰⡆⠀⠀⠀⠀⠀⠀⠀⠀⠹⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠽⠟⠁⠀⠀⠀⠀⠀ ', \'⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣷⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ', \'⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠿⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ', \'⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⠓⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ', \] let g:dashboard_default_executive = 'telescope' nmap ss :SessionSave nmap sl :SessionLoad nnoremap fh :DashboardFindHistory nnoremap ff :DashboardFindFile nnoremap fm :DashboardJumpMark nnoremap cn :DashboardNewFile autocmd FileType dashboard set showtabline=0 | autocmd WinLeave set showtabline=2 let g:dashboard_custom_footer = ["Run wild"] let g:dashboard_custom_section={ \ 'create_zettel': { \ 'description': [' Create Zettel SPC c z'], \ 'command': ':VimwikiIndex' }, \ 'load_session': { \ 'description': [' Load Session SPC s l'], \ 'command': 'SessionLoad' } \ } " lua config lua <vt', ':call v:lua.toggle_diagnostics()', {noremap = true, silent = true}) -- autopairs require('nvim-autopairs').setup{} -- marks require('marks').setup{} -- Setup nvim-cmp. local has_words_before = function() local line, col = unpack(vim.api.nvim_win_get_cursor(0)) return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil end local luasnip = require("luasnip") local cmp = require('cmp') local cmp_autopairs = require('nvim-autopairs.completion.cmp') local t = function(str) return vim.api.nvim_replace_termcodes(str, true, true, true) end local check_back_space = function() local col = vim.fn.col(".") - 1 return col == 0 or vim.fn.getline("."):sub(col, col):match("%s") ~= nil end cmp.setup { formatting = { format = lspkind.cmp_format({ mode = 'symbol_text', -- show only symbol annotations maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) -- The function below will be called before any actual modifications from lspkind -- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30)) before = function (entry, vim_item) ... return vim_item end -- old format -- format = function(entry, vim_item) -- -- fancy icons and a name of kind -- vim_item.kind = require("lspkind").presets.default[vim_item.kind] .. -- " " .. vim_item.kind -- -- set a name for each source -- vim_item.menu = ({ -- buffer = "[Buffer]", -- nvim_lsp = "[LSP]", -- look = "[Look]", -- path = "[Path]", -- spell = "[Spell]", -- calc = "[Calc]", -- })[entry.source.name] -- return vim_item -- end }, mapping = { [''] = cmp.mapping.select_prev_item(), [''] = cmp.mapping.select_next_item(), [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete(), [''] = cmp.mapping.close(), [''] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true }), [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() elseif luasnip.expand_or_jumpable() then luasnip.expand_or_jump() elseif has_words_before() then cmp.complete() else fallback() end end, {"i", "s"}), [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() elseif luasnip.jumpable(-1) then luasnip.jump(-1) else fallback() end end, { "i", "s" }), }, snippet = { expand = function(args) require'luasnip'.lsp_expand(args.body) end }, sources = { {name = 'buffer'}, {name = 'nvim_lsp'}, {name = "look"}, {name = "path"}, {name = "calc"}, {name = "spell"}, {name = 'cmp-conjure'}, {name = "luasnip"} }, completion = {completeopt = 'menu,menuone,noinsert'} } cmp.event:on( 'confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = ' ' } })) require("luasnip.loaders.from_vscode").lazy_load() -- null-ls local null_ls = require "null-ls" local pyright = { cmd = { "pyright" }, filetypes = { "python", }, debounce = 250, debug = false, default_timeout = 5000, args = { "-p", "$FILENAME", "--skipunannotated" } } local sources = { pyright, null_ls.builtins.code_actions.statix, null_ls.builtins.diagnostics.shellcheck, -- null_ls.builtins.diagnostics.clj_kondo, -- null_ls.builtins.formatting.black, null_ls.builtins.code_actions.proselint, -- null_ls.builtins.diagnostics.mypy, } -- Setup lspconfig require("lsp-format").setup {} local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) require('lspconfig').clojure_lsp.setup {on_attach = require "lsp-format".on_attach} require('lspconfig').rnix.setup {on_attach = require "lsp-format".on_attach} require('lspconfig').pylsp.setup {on_attach = require "lsp-format".on_attach, settings = { pylsp = { configurationSources = { "flake8", "mypy", "black" }, plugins = { black = {enabled = true}, jedi_signature_help = {enabled = true}, jedi_completion = { include_params = true }, pylsp_mypy={ enabled = true }, pycodestyle={ enabled=true, ignore={'E501', 'E231'}, maxLineLength=120, }, }, }, }, } require('lspconfig').terraform_lsp.setup {on_attach = require "lsp-format".on_attach} require('gitsigns').setup { sign_priority=80 } -- treesitter require('nvim-treesitter.configs').setup { ensure_installed={'nix', 'clojure', 'python', 'fennel', 'lua', 'html', 'css'}} -- 'glsl' needs c++ compiler lol -- lualine require('nvim-gps').setup {} local gps = require('nvim-gps') require('lualine').setup { options = { theme = 'ayu' }, sections = { lualine_c = { 'filename', { gps.get_location, condition=gps.is_available }, }, lualine_y = { function() local msg = 'No Active Lsp' local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') local clients = vim.lsp.get_active_clients() if next(clients) == nil then return msg end for _, client in ipairs(clients) do local filetypes = client.config.filetypes if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then return client.name end end return msg end }, } } -- nvim-lint -- require('lint').linters_by_ft = { -- markdown = {'vale'}, -- } -- f_term local map = vim.api.nvim_set_keymap local opts = { noremap = true, silent = true } map('n', '', 'lua require("FTerm").toggle()', opts) map('t', '', 'lua require("FTerm").toggle()', opts) -- Custom functions -- updateDate = function() -- for line in file.lines() -- if line.is_empty() -- line = os.time() -- return -- auto session require('auto-session').setup { log_level = 'info', auto_session_suppress_dirs = {'~/', '~/kitaab/vimwiki'} } vim.o.sessionoptions="blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal" EOF ''; extraPackages = with pkgs // customPlugins; [ # used to compile tree-sitter grammar tree-sitter python-with-my-packages nodejs clojure-lsp rnix-lsp terraform-lsp clj-kondo gcc nodePackages.pyright shellcheck proselint statix # installs different langauge servers for neovim-lsp # have a look on the link below to figure out the ones for your languages # https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md nodePackages.typescript nodePackages.typescript-language-server ]; plugins = with pkgs.vimPlugins // customPlugins; [ # ui vim-which-key fzf-vim nerdtree neovim-ayu goyo-vim rainbow_parentheses-vim vim-surround vim-devicons nvim-web-devicons vim-peekaboo undotree telescope-nvim plenary-nvim lualine-nvim nvim-gps nvim-treesitter nvim-treesitter-context dashboard-nvim FTerm-nvim barbar-nvim auto-session marks-nvim lightspeed-nvim # language vim-nix vim-elixir python-syntax emmet-vim csv-vim direnv-vim # kitaab stuff vimwiki taskwiki vim-zettel # lsp stuff # nvim-lint null-ls-nvim nvim-lspconfig nvim-cmp cmp-nvim-lsp cmp-treesitter nvim-lsp-ts-utils cmp-conjure cmp-buffer cmp-path cmp-spell nvim-autopairs cmp_luasnip luasnip lsp-format friendly-snippets lspkind-nvim # git stuff vim-fugitive gitsigns-nvim fzf-checkout-vim # Clojure stuff conjure vim-sexp vim-sexp-mappings-for-regular-people fennel-vim # experimental vim-tidal vimwiki-sync # vim-processing ]; withPython3 = true; extraPython3Packages = pkgs: with pkgs; [ tasklib six ]; vimAlias = true; }; }