{ 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="; }; }; vimwiki-dev = pkgs.vimUtils.buildVimPlugin { name = "vimwiki-dev"; src = pkgs.fetchFromGitHub { owner = "vimwiki"; repo = "vimwiki"; rev = "d035a3428c6343b4f218e51340ddf690ad8c57ee"; sha256 = "000000000000000000000000PJ023iJyMz6vak3qh4="; }; }; }; my-python-packages = python-packages: with python-packages; [ tasklib pynvim six python-lsp-server pylsp-mypy python-lsp-black pylint # other python packages you want ]; python-with-my-packages = pkgs.python3.withPackages my-python-packages; in { environment.variables.EDITOR = "nvim"; environment.shellAliases = { k = "vim -c :VimwikiIndex"; kz = "vim -c :VimwikiIndex -c :ZettelNew"; }; environment.systemPackages = with pkgs // customPlugins; [ nodejs python-with-my-packages clojure-lsp rnix-lsp terraform-lsp # Other LSPs ( neovim.override { vimAlias = true; withPython3 = true; extraPython3Packages = pkgs: with pkgs; [ tasklib six ]; configure = { packages.myPlugins = with pkgs.vimPlugins; { start = [ # general vim-nix fzf-vim vim-elixir emmet-vim nerdtree ayu-vim goyo-vim csv-vim rainbow_parentheses-vim vim-surround vim-devicons nvim-web-devicons direnv-vim telescope-nvim plenary-nvim bufferline-nvim lualine-nvim nvim-gps nvim-treesitter cmp-treesitter # kitaab stuff vimwiki taskwiki vim-zettel # lsp stuff ale nvim-lspconfig nvim-cmp cmp-nvim-lsp nvim-lsp-ts-utils cmp-conjure cmp-buffer cmp-tabnine lspkind-nvim cmp-path cmp-spell nvim-autopairs # git stuff vim-fugitive gitsigns-nvim fzf-checkout-vim # Clojure stuff conjure vim-sexp vim-sexp-mappings-for-regular-people # testing #vim-processing #vim-tidal ]; }; customRC = '' set tabstop=2 set showmatch set shiftwidth=2 set noexpandtab set autoindent set undofile set signcolumn=auto:4 " 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 set termguicolors let ayucolor="mirage" colorscheme ayu " 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! 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:") " 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:rainbow_active = 0 autocmd BufReadPost,BufNewFile c,clj,cljs RainbowParenthesesToggleAll " general commands map t :NERDTreeToggle map s :w map q :wq map r :RainbowParenthesesToggleAll map :noh 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 " git nnoremap ga :G fetch --all nmap gs :G nmap gh :diffget //3 nmap gl :diffget //2 nmap gc :GCheckout nnoremap gp :G push " kitaab map zs :ZettelSearch map zo :ZettelOpen map zn :ZettelNew " NERDTree " open on directory autocmd StdinReadPre * let s:std_in=1 " fzf let g:fzf_layout = { 'window': { 'width': 0.8, 'height': 0.8 } } " ALE let g:ale_linters = {'clojure': ['clj-kondo'], 'python': ['black', 'pylint']} " lsp commands nnoremap vd :lua vim.lsp.buf.definition() nnoremap vi :lua vim.lsp.buf.implementation() nnoremap vsh :lua vim.lsp.buf.signature_help() nnoremap vrr :lua vim.lsp.buf.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 vim.lsp.diagnostic.show_line_diagnostics(); vim.lsp.util.show_line_diagnostics() nnoremap vn :lua vim.lsp.diagnostic.goto_next() nnoremap vll :call LspLocationList() "bufferline " These commands will navigate through buffers in order regardless of which mode you are using nnoremap gt :BufferLineCycleNext nnoremap gT :BufferLineCyclePrev " lua config lua <'] = 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() else fallback() end end, {"i", "s"}), [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() else fallback() end end, { "i", "s" }), }, sources = { {name = 'buffer'}, {name = 'nvim_lsp'}, {name = "look"}, {name = "path"}, {name = 'cmp_tabnine'}, {name = "calc"}, {name = "spell"}, {name = 'cmp-conjure'} }, completion = {completeopt = 'menu,menuone,noinsert'} } cmp.event:on( 'confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = ' ' } })) -- TabNine cmp local tabnine = require('cmp_tabnine.config') tabnine:setup({max_lines = 1000, max_num_results = 20, sort = true}) -- Setup lspconfig. local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) require('lspconfig').clojure_lsp.setup {} require('lspconfig').rnix.setup {} require('lspconfig').pylsp.setup {} require('lspconfig').terraform_lsp.setup {} -- Bufferline require('bufferline').setup {} require('gitsigns').setup { sign_priority=80 } -- treesitter require('nvim-treesitter.configs').setup { ensure_installed={'nix', 'clojure', 'python', 'typescript'}} -- lualine require('nvim-gps').setup {} local gps = require('nvim-gps') require('lualine').setup { 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 }, } } EOF ''; }; } )]; }