From ac06734c3b08c00d93ee544a316dae8c21706238 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Tue, 27 Aug 2024 19:18:33 -0700 Subject: [PATCH] =?UTF-8?q?it's=20finished=20now=20=F0=9F=98=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nvim/config/fnl/after/syntax/vimwiki.vim | 4 + home/profiles/nvim/config/fnl/conf/lsp.fnl | 34 +- .../profiles/nvim/config/fnl/conf/plugins.fnl | 37 +-- .../nvim/config/fnl/conf/plugins/cmp.fnl | 22 +- home/profiles/nvim/default.nix | 298 +++++++++--------- 5 files changed, 199 insertions(+), 196 deletions(-) create mode 100644 home/profiles/nvim/config/fnl/after/syntax/vimwiki.vim diff --git a/home/profiles/nvim/config/fnl/after/syntax/vimwiki.vim b/home/profiles/nvim/config/fnl/after/syntax/vimwiki.vim new file mode 100644 index 00000000..1813a1f6 --- /dev/null +++ b/home/profiles/nvim/config/fnl/after/syntax/vimwiki.vim @@ -0,0 +1,4 @@ +" match with %update +syntax match VimwikiPlaceholder /^\s*%update\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite +" match with %link +syntax match VimwikiPlaceholder /^\s*%link\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite diff --git a/home/profiles/nvim/config/fnl/conf/lsp.fnl b/home/profiles/nvim/config/fnl/conf/lsp.fnl index 8bb37ce2..03192fdb 100644 --- a/home/profiles/nvim/config/fnl/conf/lsp.fnl +++ b/home/profiles/nvim/config/fnl/conf/lsp.fnl @@ -7,31 +7,29 @@ ; (local lspfuzzy (require :lspfuzzy)) ; Not available on Nix ; (local sg (require :sg)) ; (local lsputil (require :lspconfig/util)) -; (local navic (require :nvim-navic)) (lspsaga.setup {:border_style "rounded" - :code_action_icon "" - :code_action_num_shortcut true - :code_action_lightbulb { - :enable false - } - ; show outline - :show_outline { - :win_position "right" - :auto_enter true - :auto_preview true - :virt_text "┃" - :jump_key "o" - ; auto refresh when change buffer - :auto_refresh true - } - }) + :code_action_icon "" + :code_action_num_shortcut true + :code_action_lightbulb { :enable false} + :show_outline { :enable false}}) + +(nvim.opt :winbar "%f") + +(local signs {:Error " " + :Warn " " + :Hint " " + :Info " "}) +(each [t icon (pairs signs)] + (let [hl (.. "DiagnosticSign" t)] + (vim.fn.sign_define hl {:text icon + :texthl hl + :numhl hl}))) (tset vim.lsp.handlers :textDocument/hover (vim.lsp.with vim.lsp.handlers.hover {:focusable false :border "rounded"})) - (tset vim.lsp.handlers :textDocument/signatureHelp (vim.lsp.with vim.lsp.handlers.signature_help diff --git a/home/profiles/nvim/config/fnl/conf/plugins.fnl b/home/profiles/nvim/config/fnl/conf/plugins.fnl index 4bbdce26..94a264d3 100644 --- a/home/profiles/nvim/config/fnl/conf/plugins.fnl +++ b/home/profiles/nvim/config/fnl/conf/plugins.fnl @@ -5,29 +5,30 @@ (let [lualine (require :lualine)] (lualine.setup {:options {:theme "ayu"} - :sections {:lualine_c [:filename {1 navic.get_location - :cond navic.is_available}] + :sections {:lualine_c [:filename (fn [] + (let [lspsaga (require :lspsaga.symbol.winbar)] + (lspsaga.get_bar)))] :lualine_y [(fn [] - ; TODO broken - (let [msg "No Active Lsp" - buf_ft (vim.api.nvim_buf_get_option 0 "filetype") - clients (vim.lsp.get_active_clients)] - (if (= (next clients) nil) msg) - (each [_ client (ipairs clients)] - (let [filetypes (. client :config :filetypes)] - (if (and filetypes (vim.fn.index filetypes buf_ft)) client.name))) - msg))] + (var msg "No Active LSP") + (let [buf_ft (vim.api.nvim_buf_get_option 0 "filetype") + clients (vim.lsp.get_active_clients)] + (each [_ client (ipairs clients)] + (let [filetypes (. client :config :filetypes)] + (if (and filetypes (vim.fn.index filetypes buf_ft)) (set msg client.name)))) + msg))] :lualine_x [:filetype]}})) (require :neo-tree) (do-req :gitsigns :setup) (do-req :marks :setup) -(do-req :mini.pairs :setup) +; (do-req :mini.pairs :setup) (do-req :mini.diff :setup) (do-req :mini.ai :setup) -;TODO (do-req :mini.surround :setup) +(do-req :mini.surround :setup {:mappings {:add "ys" + :delete "ds" + :replace "cs"}}) (do-req :todo-comments :setup) -(do-req :ibl :setup) +(do-req :ibl :setup {:exclude {:language ["fennel" "clojure" "janet"]}}) (do-req :nvim-treesitter.configs :setup {:highlight {:enable true} :textobjects {:enable true} @@ -38,7 +39,7 @@ :auto_session_suppress_dirs ["~/"]}) (nvim.opt :sessionoptions "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal") -(do-req :aerial :setup {:on_attach (fn [bufnr] - (do - (vim.keymap.set "n" "{" "AerialPrev" { :buffer bufnr}) - (vim.keymap.set "n" "}" "AerialNext" { :buffer bufnr})))}) +(do-req :aerial :setup {}) ;{:on_attach (fn [bufnr] + ; (do + ; (vim.keymap.set "n" "{" "AerialPrev" { :buffer bufnr}) + ; (vim.keymap.set "n" "}" "AerialNext" { :buffer bufnr})) diff --git a/home/profiles/nvim/config/fnl/conf/plugins/cmp.fnl b/home/profiles/nvim/config/fnl/conf/plugins/cmp.fnl index 51a60d5f..556b30d4 100644 --- a/home/profiles/nvim/config/fnl/conf/plugins/cmp.fnl +++ b/home/profiles/nvim/config/fnl/conf/plugins/cmp.fnl @@ -12,20 +12,24 @@ nil)))) (let [lspkind (require :lspkind)] - (cmp.setup {:formatting {:format lspkind.cmp_format + (cmp.setup {:formatting {:format (lspkind.cmp_format {:mode "symbol_text" + :maxwidth 50}) :show_labelDetails true} - ;:snippet {:expand (fn [args] - ; (let [luasnip (require :luasnip)] - ; (luasnip.lsp_expand args.body)) + :snippet {:expand (fn [args] (vim.snippet.expand args.body))} :sources [{:name "buffer"} {:name "nvim_lsp"} {:name "look"} {:name "path"} {:name "calc"} {:name "spell"} {:name "tags"}] :mapping {"" (cmp.mapping.scroll_docs -4) "" (cmp.mapping.scroll_docs 4) - "" (cmp.mapping (cmp.mapping.select_prev_item) [:i :c]) - "" (cmp.mapping (cmp.mapping.select_next_item) [:i :c]) "" (cmp.mapping.close) - "" (cmp.mapping.confirm {:select true})}})) - ; "" (cmp.mapping tab [:i :s]) - ; "" (cmp.mapping stab [:i :s])}})) + "" (cmp.mapping.confirm {:select true}) + "" (cmp.mapping (fn [fallback] + (if (cmp.visible) (cmp.select_next_item) + (has-words-before) (cmp.complete) + (fallback))) + [:i :s]) + "" (cmp.mapping (fn [fallback] + (if (cmp.visible) (cmp.select_prev_item) + (fallback))) + [:i :s])}})) diff --git a/home/profiles/nvim/default.nix b/home/profiles/nvim/default.nix index 00821c6e..66a0254a 100644 --- a/home/profiles/nvim/default.nix +++ b/home/profiles/nvim/default.nix @@ -9,95 +9,75 @@ # kitaab zettel kz = "cd ~/kitaab/vimwiki; vim -c :VimwikiIndex -c :ZettelNew; cd $OLDPWD"; # kitaab get by tagged - kt = "cd /home/anish/kitaab/vimwiki; eza *_index.wiki | fzf --preview 'bat --style=numbers --color=always --terminal-width -1 ./{}';cd $OLDPWD"; + kt = + "cd /home/anish/kitaab/vimwiki; eza *_index.wiki | fzf --preview 'bat --style=numbers --color=always --terminal-width -1 ./{}';cd $OLDPWD"; }; - home.file = { - # Add %update to the highlight clause for vimwiki files - # ".config/nvim/after/syntax/vimwiki.vim".text = '' - # " match with %update - # syntax match VimwikiPlaceholder /^\s*%update\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite - # " match with %link - # syntax match VimwikiPlaceholder /^\s*%link\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite - # ''; - ".config/nvim".source = ./config; - }; + home.file.".config/nvim".source = ./config; #environment.systemPackages = with customPlugins; [ tidal ]; programs.neovim = { enable = true; # extraConfig = '' - # filetype plugin on - # set shortmess+=c + # filetype plugin on + # set shortmess+=c - # " Pasting - # :map sy :!xclip -i - # :vmap sy "*y - # :map sp :r!xclip -o + # " Pasting + # :map sy :!xclip -i + # :vmap sy "*y + # :map sp :r!xclip -o - # " lua config - # lua < 1 + # -- * a percentage of the width / height of the editor when <= 1 + # -- * a function that returns the width or the height + # width = 120, -- width of the Zen window + # height = 1, -- height of the Zen window + # -- by default, no options are changed for the Zen window + # -- uncomment any of the options below, or add other vim.wo options you want to apply + # options = { + # signcolumn = "no", -- disable signcolumn + # number = false, -- disable number column + # relativenumber = false, -- disable relative numbers + # cursorline = false, -- disable cursorline + # cursorcolumn = false, -- disable cursor column + # foldcolumn = "0", -- disable fold column + # list = false, -- disable whitespace characters + # }, + # }, + # plugins = { + # -- disable some global vim options (vim.o...) + # -- comment the lines to not apply the options + # options = { + # enabled = true, + # ruler = false, -- disables the ruler text in the cmd line area + # showcmd = false, -- disables the command in the last line of the screen + # }, + # twilight = { enabled = true }, -- enable to start Twilight when zen mode opens + # gitsigns = { enabled = false }, -- disables git signs + # tmux = { enabled = false }, -- disables the tmux statusline + # -- this will change the font size on kitty when in zen mode + # -- to make this work, you need to set the following kitty options: + # -- - allow_remote_control socket-only + # -- - listen_on unix:/tmp/kitty + # kitty = { + # enabled = true, + # font = "+2", -- font size increment + # }, + # }, + # } + # require('twilight').setup{} + # EOF + # ''; - # -- Setup lspconfig - # -- zen mode - # require('zen-mode').setup{ - # window = { - # backdrop = 1.0, -- shade the backdrop of the Zen window. Set to 1 to keep the same as Normal - # -- height and width can be: - # -- * an absolute number of cells when > 1 - # -- * a percentage of the width / height of the editor when <= 1 - # -- * a function that returns the width or the height - # width = 120, -- width of the Zen window - # height = 1, -- height of the Zen window - # -- by default, no options are changed for the Zen window - # -- uncomment any of the options below, or add other vim.wo options you want to apply - # options = { - # signcolumn = "no", -- disable signcolumn - # number = false, -- disable number column - # relativenumber = false, -- disable relative numbers - # cursorline = false, -- disable cursorline - # cursorcolumn = false, -- disable cursor column - # foldcolumn = "0", -- disable fold column - # list = false, -- disable whitespace characters - # }, - # }, - # plugins = { - # -- disable some global vim options (vim.o...) - # -- comment the lines to not apply the options - # options = { - # enabled = true, - # ruler = false, -- disables the ruler text in the cmd line area - # showcmd = false, -- disables the command in the last line of the screen - # }, - # twilight = { enabled = true }, -- enable to start Twilight when zen mode opens - # gitsigns = { enabled = false }, -- disables git signs - # tmux = { enabled = false }, -- disables the tmux statusline - # -- this will change the font size on kitty when in zen mode - # -- to make this work, you need to set the following kitty options: - # -- - allow_remote_control socket-only - # -- - listen_on unix:/tmp/kitty - # kitty = { - # enabled = true, - # font = "+2", -- font size increment - # }, - # }, - # } - # require('twilight').setup{} - # EOF - # ''; - - extraPackages = with pkgs; [ + extraPackages = with pkgs; [ # used to compile tree-sitter grammar # python-with-my-packages # nodejs @@ -109,6 +89,7 @@ gopls gcc shellcheck + shfmt proselint nixfmt # statix @@ -116,90 +97,105 @@ # nodePackages.typescript-language-server # luajitPackages.lua-lsp fennel-ls - unstable.starpls-bin + unstable.starpls-bin ]; - plugins = with pkgs.vimPlugins; [ - #hotpot - hotpot-nvim - # ui - lualine-nvim - neo-tree-nvim - fzf-vim - vim-devicons - nvim-web-devicons - telescope-nvim - plenary-nvim - FTerm-nvim - barbar-nvim - neovim-ayu - rainbow_parentheses-vim - auto-session - which-key-nvim - aerial-nvim - todo-comments-nvim - indent-blankline-nvim + plugins = with pkgs.unstable.vimPlugins; + [ + #hotpot + hotpot-nvim + nvim-navic + # ui + lualine-nvim + neo-tree-nvim + fzf-vim + vim-devicons + nvim-web-devicons + telescope-nvim + plenary-nvim + FTerm-nvim + barbar-nvim + neovim-ayu + rainbow_parentheses-vim + auto-session + which-key-nvim + aerial-nvim + todo-comments-nvim + indent-blankline-nvim + nvim-parinfer - # Tree sitter - (nvim-treesitter.withPlugins (p: [ p.nix p.clojure p.fennel p.lua p.html p.css p.regex p.supercollider p.beancount p.markdown_inline p.markdown p.glsl p.yaml p.toml p.dockerfile p.json p.go p.starlark ])) - nvim-treesitter-context - nvim-treesitter-textobjects + # Tree sitter + (nvim-treesitter.withPlugins (p: [ + p.nix + p.clojure + p.fennel + p.lua + p.html + p.css + p.regex + p.supercollider + p.beancount + p.markdown_inline + p.markdown + p.glsl + p.yaml + p.toml + p.dockerfile + p.json + p.go + p.starlark + ])) + nvim-treesitter-context + nvim-treesitter-textobjects - # TODO - nvim-navic - undotree - marks-nvim + # TODO + undotree + marks-nvim - # language - vim-nix - emmet-vim - csv-vim - direnv-vim - # conjure + # language + vim-nix + emmet-vim + csv-vim + direnv-vim + # conjure - # kitaab stuff - vimwiki - vim-zettel - hologram-nvim + # kitaab stuff + vimwiki + vim-zettel + hologram-nvim - # lsp stuff - nvim-lspconfig - nvim-cmp - cmp-nvim-lsp - cmp-treesitter - # cmp-conjure - cmp-buffer - cmp-path - cmp-spell - lspkind-nvim - conform-nvim - none-ls-nvim - mini-nvim - lspsaga-nvim - # nvim-lspfuzzy + # lsp stuff + nvim-lspconfig + nvim-cmp + cmp-nvim-lsp + cmp-treesitter + # cmp-conjure + cmp-buffer + cmp-path + cmp-spell + lspkind-nvim + conform-nvim + none-ls-nvim + mini-nvim + lspsaga-nvim + # nvim-lspfuzzy - # git stuff - vim-fugitive - gitsigns-nvim - fzf-checkout-vim + # git stuff + vim-fugitive + gitsigns-nvim + fzf-checkout-vim - # Clojure stuff - # conjure - vim-sexp - vim-sexp-mappings-for-regular-people - fennel-vim + # Clojure stuff + # conjure + vim-sexp + vim-sexp-mappings-for-regular-people + fennel-vim - vim-tidal - # experimental - nvim-luapad - scnvim - flash-nvim - vim-beancount - # vimtex - # custom - # nvim-parinfer - # vim-processing - ]; + # nvim-luapad + scnvim + flash-nvim + vim-beancount + ] ++ [ pkgs.vimPlugins.vim-tidal ]; # withPython3 = true; # extraPython3Packages = pkgs: with pkgs; [ tasklib six ]; # vimAlias = true;