From 346675f53f1db8e9fbd793c9c55c5f05d58f8d67 Mon Sep 17 00:00:00 2001 From: solidsnakedev Date: Fri, 24 Nov 2023 08:25:59 -0500 Subject: [PATCH] update mac neovim path --- home-manager/mac/home.nix | 2 +- home-manager/mac/local-modules/neovim.nix | 661 ---------------------- 2 files changed, 1 insertion(+), 662 deletions(-) delete mode 100644 home-manager/mac/local-modules/neovim.nix diff --git a/home-manager/mac/home.nix b/home-manager/mac/home.nix index f990086..0f9ae84 100644 --- a/home-manager/mac/home.nix +++ b/home-manager/mac/home.nix @@ -125,7 +125,7 @@ ./../../modules/git.nix ./../../modules/tmux.nix ./../../modules/bat.nix - ./local-modules/neovim.nix + ./../../modules/neovim.nix ]; } diff --git a/home-manager/mac/local-modules/neovim.nix b/home-manager/mac/local-modules/neovim.nix deleted file mode 100644 index 9559ede..0000000 --- a/home-manager/mac/local-modules/neovim.nix +++ /dev/null @@ -1,661 +0,0 @@ -{ pkgs, ... }: -let - aiken-vim = pkgs.vimUtils.buildVimPlugin { - pname = "aiken"; - version = "2023"; - src = pkgs.fetchFromGitHub { - owner = "aiken-lang"; - repo = "editor-integration-nvim"; - rev = "259203266da4ef367a4a41baa60fe49177d55598"; - sha256 = "sha256-vlhqunKmQTUGPCPq3sSW3QOKJgnAwQdFnGzWKEjGNzE="; - }; - }; - -in -{ - programs.neovim = { - enable = true; - defaultEditor = true; - viAlias = true; - vimAlias = true; - vimdiffAlias = true; - coc = { - enable = true; - settings = { - "suggest.noselect" = true; - "suggest.enablePreselect" = false; - "suggest.floatConfig.border" = true; - "suggest.floatConfig.rounded" = true; - "diagnostic.errorSign" = "✘"; - "diagnostic.hintSign" = ""; - "diagnostic.infoSign" = ""; - "diagnostic.warningSign" = "∆"; - "hover.floatConfig.border" = true; - "hover.floatConfig.rounded" = true; - "tsserver.useLocalTsdk" = true; - "tsserver.tsdk" = "$./node_modules/typescript/lib"; - languageserver = { - haskell = { - command = "haskell-language-server"; - args = [ "--lsp" ]; - rootPatterns = [ - "*.cabal" - "stack.yaml" - "cabal.project" - "package.yaml" - "hie.yaml" - ]; - filetypes = [ "haskell" "lhaskell" ]; - }; - aiken = { - command = "aiken"; - args = [ "lsp" ]; - trace.server = "verbose"; - rootPatterns = [ - "aiken.toml" - ]; - filetypes = [ "aiken" ]; - }; - nix = { - command = "nil"; - filetypes = [ "nix" ]; - rootPatterns = [ "flake.nix" ]; - settings = { - nil = { - formatting = { command = [ "nixpkgs-fmt" ]; }; - }; - }; - }; - }; - }; - }; - extraPackages = [ - pkgs.nodejs # coc requires nodejs - pkgs.ripgrep # telescope live_grep and grep_string requires ripgrep - pkgs.lazygit # lazygit-nvim requires lazygit - pkgs.watchman # coc-tsserver, requires watchman to rename imports on file rename - ]; - - plugins = with pkgs.vimPlugins; [ - # Basic settings - sensible - - # Git support - { - plugin = lazygit-nvim; - type = "lua"; - config = '' - nmap("gg", ":LazyGit") - ''; - } - - # Coc plugins - coc-tsserver - coc-json - coc-snippets - coc-eslint - coc-prettier - jsonc-vim - - #Markdown - markdown-preview-nvim - - - # Language syntax highlight - vim-nix - aiken-vim - { - plugin = haskell-vim; - config = '' - let g:haskell_enable_quantification = 1 " to enable highlighting of `forall` - let g:haskell_enable_recursivedo = 1 " to enable highlighting of `mdo` and `rec` - let g:haskell_enable_arrowsyntax = 1 " to enable highlighting of `proc` - let g:haskell_enable_pattern_synonyms = 1 " to enable highlighting of `pattern` - let g:haskell_enable_typeroles = 1 " to enable highlighting of type roles - let g:haskell_enable_static_pointers = 1 " to enable highlighting of `static` - ''; - } - - # direnv support - direnv-vim - - # tmux integration - vim-tmux-navigator - - # Sorround support - vim-surround - - # Comments - { - plugin = comment-nvim; - type = "lua"; - config = '' - require('Comment').setup { - pre_hook = require('ts_context_commentstring.integrations.comment_nvim').create_pre_hook(), - } - ''; - } - nvim-ts-context-commentstring - - { - plugin = todo-comments-nvim; - type = "lua"; - config = '' - require('todo-comments').setup {} - ''; - } - - # Autopair like VSCode - { - plugin = nvim-autopairs; - type = "lua"; - config = '' - require('nvim-autopairs').setup {} - ''; - } - - # Syntax Support - # (nvim-treesitter.withPlugins (_: pkgs.tree-sitter.allGrammars)) - { - plugin = nvim-treesitter.withAllGrammars; - type = "lua"; - config = '' - require("nvim-treesitter.configs").setup({ - highlight = { - enable = true, - disable = {"haskell"}, - additional_vim_regex_highlighting = false, - }, - context_commentstring = { - enable = true, - }, - }) - ''; - } - - # Buffer tabs - { - plugin = bufferline-nvim; - type = "lua"; - config = '' - require("bufferline").setup( { - options = { - mode = 'buffers', - themable = false, - numbers = 'ordinal', - offsets = { - {filetype = 'NvimTree'} - }, - separator_style = "slant", - } - }) - nmap("", ":BufferLineCycleNext") - nmap("", ":BufferLineCyclePrev") - nmap("bd", ":bd") - ''; - } - - # Icons Tree - nvim-web-devicons - - # File Tree - { - plugin = nvim-tree-lua; - type = "lua"; - config = '' - -- empty setup using defaults - require("nvim-tree").setup{ - actions = { - open_file = { - quit_on_open = true, - }, - }, - } - nmap("n", ":NvimTreeToggle") - ''; - } - - # File/Grep Search - { - plugin = telescope-nvim; - type = "lua"; - config = '' - nmap("ff", ":Telescope find_files") - nmap("fg", ":Telescope live_grep") - nmap("fb", ":Telescope buffers") - nmap("fh", ":Telescope help_tags") - ''; - } - - { - plugin = vim-easymotion; - config = '' - nmap s (easymotion-s) - ''; - } - - # WildMenu - { - plugin = wilder-nvim; - type = "lua"; - config = '' - local wilder = require('wilder') - wilder.setup({ - modes = {':', '/', '?'}, - accept_key = '', - reject_key = '', - }) - - wilder.set_option('renderer', wilder.popupmenu_renderer( - wilder.popupmenu_border_theme({ - highlighter = wilder.basic_highlighter(), - highlights = { - border = 'Normal', -- highlight to use for the border - accent = wilder.make_hl('WilderAccent', 'Pmenu', {{a = 1}, {a = 1}, {foreground = '#f4468f'}}), - }, - -- 'single', 'double', 'rounded' or 'solid' - -- can also be a list of 8 characters, see :h wilder#popupmenu_border_theme() for more details - border = 'rounded', - left = {' ', wilder.popupmenu_devicons()}, - right = {' ', wilder.popupmenu_scrollbar()}, - }) - )) - ''; - } - - # Dashboard - { - plugin = dashboard-nvim; - type = "lua"; - config = '' - require('dashboard').setup({ - config = { - week_header = { - enable = true, - }, - }, - }) - ''; - } - - # Tokyo Night Theme - { - plugin = tokyonight-nvim; - type = "lua"; - config = '' - require('tokyonight').setup({ - on_highlights = function(highlights, colors) - highlights.LineNr = { fg = colors.cyan, bold = false } - highlights.CursorLineNr = { fg = colors.orange, bold = true } - end, - }) - ''; - } - papercolor-theme - { - plugin = material-nvim; - type = "lua"; - config = '' - vim.g.material_style = "deep ocean" - require('material').setup({ - custom_highlights = { - LineNr = { fg = '#6E98EB'}, - CursorLineNr = { fg = '#89DDFF'}, - CocMenuSel = { fg = '#000000', bg = '#89DDFF' }, - Structure = { fg = '#89DDFF'}, - Identifier = { fg = '#F78C6C' }, - CurSearch = { fg = '#000000', bg = '#89DDFF' }, - Search = { fg = '#000000',bg = '#F78C6C' } - } - }) - vim.cmd("colorscheme material ") - ''; - } - - { - plugin = sonokai; - type = "lua"; - config = '' - vim.g.sonokai_diagnostic_text_highlight = 1 - -- vim.cmd[[colorscheme sonokai]] - ''; - } - - { - plugin = vim-monokai-pro; - config = '' - ''; - } - - # Dracula Theme - { - plugin = dracula-vim; - config = '' - ''; - } - - { - plugin = nightfox-nvim; - type = "lua"; - config = '' - require("nightfox").setup({ - groups = { - all = { - LineNr = { fg = "cyan" }, - CursorLineNr = { fg = "orange", style = "bold"}; - }, - }, - }) - -- vim.cmd("colorscheme carbonfox") - ''; - } - - # Airline theme - { - plugin = lualine-nvim; - type = "lua"; - config = '' - require('lualine').setup { - -- options = { - -- theme = 'powerline_dark' - -- }, - sections = { - lualine_a = { - { - 'filename', - path = 1, - } - }, - lualine_b = {'branch', 'diff', 'diagnostics','g:coc_status'} - }, - } - ''; - } - ]; - - extraLuaConfig = '' - -- https://github.com/JoosepAlviste/nvim-ts-context-commentstring - vim.opt.updatetime = 100 - -- disable netrw at the very start of your init.lua (strongly advised) - vim.g.loaded_netrw = 1 - vim.g.loaded_netrwPlugin = 1 - - -- set termguicolors to enable highlight groups - vim.opt.termguicolors = true - - function map (mode, shortcut, command) - vim.api.nvim_set_keymap(mode, shortcut, command, { noremap = true, silent = true }) - end - - function nmap(shortcut, command) - map('n', shortcut, command) - end - - function imap(shortcut, command) - map('i', shortcut, command) - end - - - ''; - - extraConfig = '' - - let mapleader=" " - - " Disable compatibility with vi which can cause unexpected issues. - set nocompatible - - " Enable type file detection. Vim will be able to try to detect the type of file in use. - filetype on - - " Enable plugins and load plugin for the detected file type. - filetype plugin on - - " Load an indent file for the detected file type. - filetype indent on - - " Turn syntax highlighting on. - syntax on - - " Add numbers to each line on the left-hand side. - set number - - " Add relativenumber - set relativenumber - - " Highlight cursor line underneath the cursor horizontally. - set cursorline - - " Set shift width to 2 spaces. - set shiftwidth=2 - - " Set tab width to 2 columns. - set tabstop=2 - - " Use space characters instead of tabs. - set expandtab - - " Do not save backup files. - set nobackup - - " Do not let cursor scroll below or above N number of lines when scrolling. - set scrolloff=10 - - " Do not wrap lines. Allow long lines to extend as far as the line goes. - set nowrap - - " While searching though a file incrementally highlight matching characters as you type. - set incsearch - - " Ignore capital letters during search. - set ignorecase - - " Override the ignorecase option if searching for capital letters. - " This will allow you to search specifically for capital letters. - set smartcase - - " Show partial command you type in the last line of the screen. - set showcmd - - " Show the mode you are on the last line. - set showmode - - " Show matching words during a search. - set showmatch - - " Use highlighting when doing a search. - set hlsearch - - " Set the commands to save in history default number is 20. - set history=1000 - - " Enable auto completion menu after pressing TAB. - set wildmenu - - " Disable swap - set noswapfile - - " Make wildmenu behave like similar to Bash completion. - " set wildmode=longest:list,full - - set softtabstop=2 " see multiple spaces as tabstops so does the right thing - set autoindent " indent a new line the same amount as the line just typed - set mouse=a " enable mouse click - set clipboard=unnamedplus " using system clipboard - set ttyfast " Speed up scrolling in Vim - set list listchars=tab:▸▸,trail:· - - " escape with key combination - inoremap jk - inoremap kj - - " allow to move blocks up or down with arrow key - nnoremap :m .+1== - nnoremap :m .-2== - vnoremap :m '>+1gv=gv - vnoremap :m '<-2gv=gv - - " toggle hlsearch - nnoremap h :nohl - - " -------------------------------------------------------- - " COC-VIM TAB SETTINGS START - - " Some servers have issues with backup files, see #649 - set nobackup - set nowritebackup - - " Having longer updatetime (default is 4000 ms = 4s) leads to noticeable - " delays and poor user experience - set updatetime=300 - - " Always show the signcolumn, otherwise it would shift the text each time - " diagnostics appear/become resolved - set signcolumn=yes - - " Use tab for trigger completion with characters ahead and navigate - " NOTE: There's always complete item selected by default, you may want to enable - " no select by `"suggest.noselect": true` in your configuration file - " NOTE: Use command ':verbose imap ' to make sure tab is not mapped by - " other plugin before putting this into your config - inoremap - \ coc#pum#visible() ? coc#pum#next(1) : - \ CheckBackspace() ? "\" : - \ coc#refresh() - inoremap coc#pum#visible() ? coc#pum#prev(1) : "\" - - " Make to accept selected completion item or notify coc.nvim to format - " u breaks current undo, please make your own choice - inoremap coc#pum#visible() ? coc#pum#confirm() - \: "\u\\=coc#on_enter()\" - - function! CheckBackspace() abort - let col = col('.') - 1 - return !col || getline('.')[col - 1] =~# '\s' - endfunction - - " Use to trigger completion - if has('nvim') - inoremap coc#refresh() - else - inoremap coc#refresh() - endif - - " Use `[g` and `]g` to navigate diagnostics - " Use `:CocDiagnostics` to get all diagnostics of current buffer in location list - nmap [g (coc-diagnostic-prev) - nmap ]g (coc-diagnostic-next) - - " GoTo code navigation - nmap gd (coc-definition) - nmap gy (coc-type-definition) - nmap gi (coc-implementation) - nmap gr (coc-references) - - " Use K to show documentation in preview window - nnoremap K :call ShowDocumentation() - - function! ShowDocumentation() - if CocAction('hasProvider', 'hover') - call CocActionAsync('doHover') - else - call feedkeys('K', 'in') - endif - endfunction - - " Highlight the symbol and its references when holding the cursor - autocmd CursorHold * silent call CocActionAsync('highlight') - - " Symbol renaming - nmap rn (coc-rename) - - " Formatting selected code - xmap f (coc-format-selected) - nmap f (coc-format-selected) - - augroup mygroup - autocmd! - " Setup formatexpr specified filetype(s) - autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') - " Update signature help on jump placeholder - autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') - augroup end - - " Applying code actions to the selected code block - " Example: `aap` for current paragraph - xmap a (coc-codeaction-selected) - nmap a (coc-codeaction-selected) - - " Remap keys for applying code actions at the cursor position - nmap ac (coc-codeaction-cursor) - " Remap keys for apply code actions affect whole buffer - nmap as (coc-codeaction-source) - " Apply the most preferred quickfix action to fix diagnostic on the current line - nmap qf (coc-fix-current) - - " Remap keys for applying refactor code actions - nmap re (coc-codeaction-refactor) - xmap r (coc-codeaction-refactor-selected) - nmap r (coc-codeaction-refactor-selected) - - " Run the Code Lens action on the current line - nmap cl (coc-codelens-action) - - " Map function and class text objects - " NOTE: Requires 'textDocument.documentSymbol' support from the language server - xmap if (coc-funcobj-i) - omap if (coc-funcobj-i) - xmap af (coc-funcobj-a) - omap af (coc-funcobj-a) - xmap ic (coc-classobj-i) - omap ic (coc-classobj-i) - xmap ac (coc-classobj-a) - omap ac (coc-classobj-a) - - " Remap and to scroll float windows/popups - if has('nvim-0.4.0') || has('patch-8.2.0750') - nnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" - nnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" - inoremap coc#float#has_scroll() ? "\=coc#float#scroll(1)\" : "\" - inoremap coc#float#has_scroll() ? "\=coc#float#scroll(0)\" : "\" - vnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" - vnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" - endif - - " Use CTRL-S for selections ranges - " Requires 'textDocument/selectionRange' support of language server - nmap (coc-range-select) - xmap (coc-range-select) - - " Add `:Format` command to format current buffer - command! -nargs=0 Format :call CocActionAsync('format') - - " Add `:Fold` command to fold current buffer - command! -nargs=? Fold :call CocAction('fold', ) - - " Add `:OR` command for organize imports of the current buffer - command! -nargs=0 OR :call CocActionAsync('runCommand', 'editor.action.organizeImport') - - " Mappings for CoCList - " Show all diagnostics - nnoremap a :CocList diagnostics - " Manage extensions - nnoremap e :CocList extensions - " Show commands - nnoremap c :CocList commands - " Find symbol of current document - nnoremap o :CocList outline - " Search workspace symbols - nnoremap s :CocList -I symbols - " Do default action for next item - nnoremap j :CocNext - " Do default action for previous item - nnoremap k :CocPrev - " Resume latest coc list - nnoremap p :CocListResume - - " COC-VIM TAB SETTINGS END - " -------------------------------------------------------- - ''; - }; -}