From d623b212349aa720ac1b452673d6cd4b654b3f9f Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sun, 25 Aug 2024 00:46:03 -0700 Subject: [PATCH] nvim: tested fnl install, working fterm --- home/profiles/nvim/config/conf/plugins.fnl | 3 - .../nvim/config/{ => fnl}/conf/formatting.fnl | 0 .../nvim/config/{ => fnl}/conf/init.fnl | 22 +- .../nvim/config/{ => fnl}/conf/lsp.fnl | 0 .../mappingns.fnl => fnl/conf/mappings.fnl} | 34 +- home/profiles/nvim/config/fnl/conf/music.fnl | 0 .../profiles/nvim/config/fnl/conf/plugins.fnl | 22 + .../nvim/config/{ => fnl}/lib/nvim.fnl | 0 home/profiles/nvim/config/init.lua | 11 - home/profiles/nvim/default.nix | 948 +++++++++--------- 10 files changed, 529 insertions(+), 511 deletions(-) delete mode 100644 home/profiles/nvim/config/conf/plugins.fnl rename home/profiles/nvim/config/{ => fnl}/conf/formatting.fnl (100%) rename home/profiles/nvim/config/{ => fnl}/conf/init.fnl (50%) rename home/profiles/nvim/config/{ => fnl}/conf/lsp.fnl (100%) rename home/profiles/nvim/config/{conf/mappingns.fnl => fnl/conf/mappings.fnl} (72%) create mode 100644 home/profiles/nvim/config/fnl/conf/music.fnl create mode 100644 home/profiles/nvim/config/fnl/conf/plugins.fnl rename home/profiles/nvim/config/{ => fnl}/lib/nvim.fnl (100%) diff --git a/home/profiles/nvim/config/conf/plugins.fnl b/home/profiles/nvim/config/conf/plugins.fnl deleted file mode 100644 index d1d2a49e..00000000 --- a/home/profiles/nvim/config/conf/plugins.fnl +++ /dev/null @@ -1,3 +0,0 @@ -(local nvim (require :lib/nvim)) - -(nvim.g :tidal_target "terminal") diff --git a/home/profiles/nvim/config/conf/formatting.fnl b/home/profiles/nvim/config/fnl/conf/formatting.fnl similarity index 100% rename from home/profiles/nvim/config/conf/formatting.fnl rename to home/profiles/nvim/config/fnl/conf/formatting.fnl diff --git a/home/profiles/nvim/config/conf/init.fnl b/home/profiles/nvim/config/fnl/conf/init.fnl similarity index 50% rename from home/profiles/nvim/config/conf/init.fnl rename to home/profiles/nvim/config/fnl/conf/init.fnl index e52fb287..ab48e1b7 100644 --- a/home/profiles/nvim/config/conf/init.fnl +++ b/home/profiles/nvim/config/fnl/conf/init.fnl @@ -2,22 +2,22 @@ (nvim.g :mapleader " ") -(nvim.opt :runtimepath (.. vim.opt.runtimepath "/home/anish/.config/nvim/,")) +; (nvim.opt :runtimepath (.. vim.opt.runtimepath "/home/anish/.config/nvim/,")) (nvim.opt :tabstop 2) -(nvim.opt :showmatch) +(nvim.opt :showmatch true) (nvim.opt :shiftwidth 2) -(nvim.opt :autoindent) -(nvim.opt :undofile) +(nvim.opt :autoindent true) +(nvim.opt :undofile true) (nvim.opt :signcolumn "auto:4") -(nvim.opt :title) -(nvim.opt :number) -(nvim.opt :nocompatible) -(nvim.opt :relativenumber) +(nvim.opt :title true) +(nvim.opt :number true) +; (nvim.opt :nocompatible) +(nvim.opt :relativenumber true) (nvim.opt :showtabline 2) -(nvim.opt :expandtab) -(nvim.opt :autowriteall) +(nvim.opt :expandtab true) +(nvim.opt :autowriteall true) -(nvim.opt :lisp) ; include - in word to move better in snake-case) +(nvim.opt :lisp true) ; include - in word to move better in snake-case) (nvim.g :sexp_filetypes "clojure,scheme,lisp,janet,fennel,yuck") ; include the lisps I use (nvim.opt :termguicolors) diff --git a/home/profiles/nvim/config/conf/lsp.fnl b/home/profiles/nvim/config/fnl/conf/lsp.fnl similarity index 100% rename from home/profiles/nvim/config/conf/lsp.fnl rename to home/profiles/nvim/config/fnl/conf/lsp.fnl diff --git a/home/profiles/nvim/config/conf/mappingns.fnl b/home/profiles/nvim/config/fnl/conf/mappings.fnl similarity index 72% rename from home/profiles/nvim/config/conf/mappingns.fnl rename to home/profiles/nvim/config/fnl/conf/mappings.fnl index e739149c..b21806a4 100644 --- a/home/profiles/nvim/config/conf/mappingns.fnl +++ b/home/profiles/nvim/config/fnl/conf/mappings.fnl @@ -1,9 +1,21 @@ (local nvim (require :lib/nvim)) (local wk (require :which-key)) +;; Convenient way to indent stuff in visual mode +(nvim.keymap [:v] "<" "" ">gv" {:noremap true}) +(nvim.keymap [:n] "" "" {:noremap true :silent true}) + +(vim.api.nvim_create_user_command "FTermToggle" (fn [_] + ((-> (require :FTerm) + (. :toggle)))) + {:bang true}) +(nvim.keymap [:t] "" ":FTermToggle") +(nvim.keymap [:n] "" ":FTermToggle" {:nnoremap true}) + (local normal-map-leader - {"t" ["" + {"t" [":Neotree toggle" "Toggle neo-tree"] "w" [":w" "Write file"] @@ -12,7 +24,7 @@ "r" [":RainbowParenthesesToggleAll" "Toggle Rainbow Parens"] ; Telescope - "f" {:Name "Files" + "f" {:name "Files" :f ["Telescope find_files" "Find Files (in Telescope)"] :g ["Telescope live_grep" @@ -26,16 +38,16 @@ :r ["Telescope oldfiles" "Recent files"]} ; Git - "g" {:Name "Git" + "g" {:name "Git" "s" [":G" "Git Status"] - "f" [":G fetch --all" + "f" [":G fetch --all" "Git Fetch"] - "b" [":GBranches" + "b" [":GBranches" "Git Branch"] - "p" [":Git! push" + "p" [":Git! push" "Git Push"] - "d" [":GDiff" + "d" [":GDiff" "Git Diff"] "h" ["" "Commit Hunk under Cursor"]} @@ -43,7 +55,7 @@ ; nmap gh :diffget //2 ; nnoremap gc :G commit -v -q %:p ; Buffers - "b" {:Name "Buffer" + "b" {:name "Buffer" :a ["" "Buffer Add"] :q ["" @@ -55,7 +67,7 @@ :p [":tabp" "Buffer Previous"]} ; Search - "s" {:Name "Search" + "s" {:name "Search" :b ["Telescope current_buffer_fuzzy_find" "Search in current buffer"] :s ["Telescope live_grep" @@ -65,7 +77,7 @@ :c ["let @/ = \"\":echo 'Search highlight cleared'" "Clear search"]} ; Code - "c" {:Name "Code" + "c" {:name "Code" :d [":lua vim.lsp.buf.definition()" "Go to Definition"] :i [":lua require('telescope.builtin').lsp_implementation()" @@ -79,6 +91,6 @@ :o [":LSoutlineToggle" "Outline"]} ; Kitaab - "z" {:Name "Kitaab"}}) + "z" {:name "Kitaab"}}) (wk.register normal-map-leader {:prefix ""}) diff --git a/home/profiles/nvim/config/fnl/conf/music.fnl b/home/profiles/nvim/config/fnl/conf/music.fnl new file mode 100644 index 00000000..e69de29b diff --git a/home/profiles/nvim/config/fnl/conf/plugins.fnl b/home/profiles/nvim/config/fnl/conf/plugins.fnl new file mode 100644 index 00000000..c2f7003a --- /dev/null +++ b/home/profiles/nvim/config/fnl/conf/plugins.fnl @@ -0,0 +1,22 @@ +(local nvim (require :lib/nvim)) + +(nvim.g :tidal_target "terminal") + +(local navic (require :nvim-navic)) + +(let [lualine (require :lualine)] + (lualine.setup {:options {:theme "ayu"} + :sections {:lualine_c [:filename {1 navic.get_location + :cond navic.is_available}] + :lualine_y [(fn [] + (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))] + :lualine_x [:filetype]}})) + +(require :neo-tree) diff --git a/home/profiles/nvim/config/lib/nvim.fnl b/home/profiles/nvim/config/fnl/lib/nvim.fnl similarity index 100% rename from home/profiles/nvim/config/lib/nvim.fnl rename to home/profiles/nvim/config/fnl/lib/nvim.fnl diff --git a/home/profiles/nvim/config/init.lua b/home/profiles/nvim/config/init.lua index 986fcf3e..b0bbd641 100644 --- a/home/profiles/nvim/config/init.lua +++ b/home/profiles/nvim/config/init.lua @@ -1,10 +1,3 @@ --- A function that applies passes the output of string.format to the print --- function ----@param string string #template string -local function fprint(string, ...) - print(string.format(string, ...)) -end - if pcall(require, "hotpot") then -- Setup hotpot.nvim require("hotpot").setup({ @@ -31,7 +24,3 @@ if pcall(require, "hotpot") then else print("Unable to require hotpot") end - --- vim.cmd[[colorscheme tokyonight]] --- -- vim.cmd[[colorscheme lumona]] --- vim.cmd[[packadd cfilter]] diff --git a/home/profiles/nvim/default.nix b/home/profiles/nvim/default.nix index 1fb93446..65182a55 100644 --- a/home/profiles/nvim/default.nix +++ b/home/profiles/nvim/default.nix @@ -40,517 +40,512 @@ programs.neovim = { enable = true; - extraConfig = '' - filetype plugin on + # extraConfig = '' + # filetype plugin on - " 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 - " highlight row - set cursorline + # " 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 + # " highlight row + # set cursorline - let g:conjure#filetype#fennel = "conjure.client.fennel.stdio" - " we only use fennel with love; no we don't... - let g:conjure#client#fennel#stdio#command = "fennel" - " let g:conjure#extract#tree_sitter#enabled = true - map lt :ConjureLogToggle + # let g:conjure#filetype#fennel = "conjure.client.fennel.stdio" + # " we only use fennel with love; no we don't... + # let g:conjure#client#fennel#stdio#command = "fennel" + # " let g:conjure#extract#tree_sitter#enabled = true + # map lt :ConjureLogToggle - let g:rainbow_active = 0 - autocmd BufReadPost,BufNewFile c,clj,cljs RainbowParenthesesToggleAll + # let g:rainbow_active = 0 + # autocmd BufReadPost,BufNewFile c,clj,cljs RainbowParenthesesToggleAll - " general commands - nnoremap :noh - map Q - nnoremap Y y$ - nnoremap n :vnew - " 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 + # " general commands + # nnoremap :noh + # map Q + # nnoremap Y y$ + # nnoremap n :vnew + # " 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 + # " barbar + # nnoremap gT :BufferPrevious + # nnoremap gt :BufferNext + # nnoremap gj :BufferPick + # nnoremap gq :BufferClose - " kitaab - map cz :VimwikiIndex:ZettelNew - map zs :ZettelSearch - map zn :ZettelNew - map zo :ZettelOpen - map zf :Telescope oldfiles only_cwd=true - map wt :VimwikiMakeTomorrowDiaryNote - map wd :VimwikiMakeYesterdayDiaryNote - map zm :ZenMode:setlocal nospell - let g:vimwiki_list = [{ 'path': '~/kitaab/vimwiki', 'auto_tags': 1, 'auto_diary_index': 1, 'auto_generate_links': 0, 'nested_syntaxes': {'python': 'python', 'c++': 'cpp', 'nix': 'nix', 'bash': 'sh'} }] - let g:sync_taskwarrior = 0 - let g:zettel_format = "%y%m%d-%H%M" + # " kitaab + # map cz :VimwikiIndex:ZettelNew + # map zs :ZettelSearch + # map zn :ZettelNew + # map zo :ZettelOpen + # map zf :Telescope oldfiles only_cwd=true + # map wt :VimwikiMakeTomorrowDiaryNote + # map wd :VimwikiMakeYesterdayDiaryNote + # map zm :ZenMode:setlocal nospell + # let g:vimwiki_list = [{ 'path': '~/kitaab/vimwiki', 'auto_tags': 1, 'auto_diary_index': 1, 'auto_generate_links': 0, 'nested_syntaxes': {'python': 'python', 'c++': 'cpp', 'nix': 'nix', 'bash': 'sh'} }] + # let g:sync_taskwarrior = 0 + # let g:zettel_format = "%y%m%d-%H%M" - let g:scnvim_snippet_format = "luasnip" + # let g:scnvim_snippet_format = "luasnip" - " lua config - lua <vt', ':call v:lua.toggle_diagnostics()', {noremap = true, silent = true}) + # vim.api.nvim_set_keymap('n', 'vt', ':call v:lua.toggle_diagnostics()', {noremap = true, silent = true}) - -- autopairs - require('nvim-autopairs').setup{} + # -- autopairs + # require('nvim-autopairs').setup{} - -- marks - require('marks').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 + # -- 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 lspkind = require("lspkind") - 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', - maxwidth = 50, - }) - }, - 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"}, - {name = 'tags'} - }, - 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() + # local luasnip = require("luasnip") + # local lspkind = require("lspkind") + # 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', + # maxwidth = 50, + # }) + # }, + # 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"}, + # {name = 'tags'} + # }, + # 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 - -- being very janky - local null_ls = require("null-ls") - null_ls.setup({ - sources = { - null_ls.builtins.diagnostics.shellcheck, - null_ls.builtins.diagnostics.proselint.with({ filetypes = { "vimwiki", "mail", }, }), - null_ls.builtins.diagnostics.commitlint, - null_ls.builtins.diagnostics.jsonlint, - -- null_ls.builtins.code_actions.statix, - -- null_ls.builtins.diagnostics.clj_kondo, - -- null_ls.builtins.formatting.isort, - -- null_ls.builtins.formatting.black, - }, - }) + # -- null-ls + # -- being very janky + # local null_ls = require("null-ls") + # null_ls.setup({ + # sources = { + # null_ls.builtins.diagnostics.shellcheck, + # null_ls.builtins.diagnostics.proselint.with({ filetypes = { "vimwiki", "mail", }, }), + # null_ls.builtins.diagnostics.commitlint, + # null_ls.builtins.diagnostics.jsonlint, + # -- null_ls.builtins.code_actions.statix, + # -- null_ls.builtins.diagnostics.clj_kondo, + # -- null_ls.builtins.formatting.isort, + # -- null_ls.builtins.formatting.black, + # }, + # }) - -- Setup lspconfig - require("lsp-format").setup {} - require("nvim-navic").setup {} - local format = require("lsp-format") - local navic = require("nvim-navic") + # -- Setup lspconfig + # require("lsp-format").setup {} + # require("nvim-navic").setup {} + # local format = require("lsp-format") + # local navic = require("nvim-navic") - -- lspsaga, code_action lightbulb is annoying - local saga = require('lspsaga') - saga.init_lsp_saga({ - border_style = "rounded", - code_action_icon = "", - code_action_num_shortcut = true, - code_action_lightbulb = { - enable = false, - enable_in_insert = false, - cache_code_action = true, - sign = true, - update_time = 150, - sign_priority = 20, - virtual_text = false, - }, - code_action_keys = { - quit = 'q', - exec = '', - }, - -- show outline - show_outline = { - win_position = 'right', - --set special filetype win that outline window split.like NvimTree neotree - -- defx, db_ui - auto_enter = true, - auto_preview = true, - virt_text = '┃', - jump_key = 'o', - -- auto refresh when change buffer - auto_refresh = true, - }, - }) + # -- lspsaga, code_action lightbulb is annoying + # local saga = require('lspsaga') + # saga.init_lsp_saga({ + # border_style = "rounded", + # code_action_icon = "", + # code_action_num_shortcut = true, + # code_action_lightbulb = { + # enable = false, + # enable_in_insert = false, + # cache_code_action = true, + # sign = true, + # update_time = 150, + # sign_priority = 20, + # virtual_text = false, + # }, + # code_action_keys = { + # quit = 'q', + # exec = '', + # }, + # -- show outline + # show_outline = { + # win_position = 'right', + # --set special filetype win that outline window split.like NvimTree neotree + # -- defx, db_ui + # auto_enter = true, + # auto_preview = true, + # virt_text = '┃', + # jump_key = 'o', + # -- auto refresh when change buffer + # auto_refresh = true, + # }, + # }) - capabilities = require('cmp_nvim_lsp').default_capabilities() + # capabilities = require('cmp_nvim_lsp').default_capabilities() - -- fennel-ls is bleeding edge - local lspconfig = require('lspconfig') - require("lspconfig.configs")["fennel-ls"] = { - default_config = { - cmd = {"fennel-ls"}, - filetypes = {"fennel"}, - root_dir = function(dir) return lspconfig.util.find_git_ancestor(dir) end, - settings = {} - } - } + # -- fennel-ls is bleeding edge + # local lspconfig = require('lspconfig') + # require("lspconfig.configs")["fennel-ls"] = { + # default_config = { + # cmd = {"fennel-ls"}, + # filetypes = {"fennel"}, + # root_dir = function(dir) return lspconfig.util.find_git_ancestor(dir) end, + # settings = {} + # } + # } - local servers = { 'clojure_lsp', 'terraform_lsp', 'zls', 'pyright', 'rust_analyzer', 'tsserver', 'lua_ls', 'nil_ls', 'gopls'} - for _, lsp in ipairs(servers) do - lspconfig[lsp].setup { - on_attach = function(client, bufnr) - format.on_attach(client) - navic.attach(client, bufnr) - end, - capabilities = capabilities, - } - end + # local servers = { 'clojure_lsp', 'terraform_lsp', 'zls', 'pyright', 'rust_analyzer', 'tsserver', 'lua_ls', 'nil_ls', 'gopls'} + # for _, lsp in ipairs(servers) do + # lspconfig[lsp].setup { + # on_attach = function(client, bufnr) + # format.on_attach(client) + # navic.attach(client, bufnr) + # end, + # capabilities = capabilities, + # } + # end - -- fennel-ls doesn't support gps - lspconfig['fennel-ls'].setup { - on_attach = function(client, bufnr) - format.on_attach(client) - end, - capabilities = capabilities, - } + # -- fennel-ls doesn't support gps + # lspconfig['fennel-ls'].setup { + # on_attach = function(client, bufnr) + # format.on_attach(client) + # end, + # capabilities = capabilities, + # } - -- deprecated pylsp - -- require('lspconfig').pylsp.setup { - -- on_attach = function(client, bufnr) - -- format.on_attach(client) - -- navic.attach(client, bufnr) - -- end, - -- capabilities = capabilities, - -- 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, - -- }, - -- }, - -- }, - -- }, - -- } + # -- deprecated pylsp + # -- require('lspconfig').pylsp.setup { + # -- on_attach = function(client, bufnr) + # -- format.on_attach(client) + # -- navic.attach(client, bufnr) + # -- end, + # -- capabilities = capabilities, + # -- 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('gitsigns').setup { sign_priority=80 } + # require('gitsigns').setup { sign_priority=80 } - -- treesitter - require('nvim-treesitter.configs').setup { - -- parser_install_dir = "~/.local/share/nvim/site/parser/", - -- ensure_installed={'nix', 'clojure', 'python', 'fennel', 'lua', 'html', 'css', 'regex', 'supercollider', 'beancount', 'janet'}, - highlight = { enabled = true, additional_vim_regex_highting = true, }, - textobjects = { enabled = true }, - } - -- 'glsl' needs c++ compiler lol + # -- treesitter + # require('nvim-treesitter.configs').setup { + # -- parser_install_dir = "~/.local/share/nvim/site/parser/", + # -- ensure_installed={'nix', 'clojure', 'python', 'fennel', 'lua', 'html', 'css', 'regex', 'supercollider', 'beancount', 'janet'}, + # highlight = { enabled = true, additional_vim_regex_highting = true, }, + # textobjects = { enabled = true }, + # } + # -- 'glsl' needs c++ compiler lol - -- lualine - local navic = require("nvim-navic") - require('lualine').setup { - options = { theme = 'ayu' }, - sections = { - lualine_c = { - 'filename', { navic.get_location, condition=navic.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 - }, - lualine_x = {'filetype'} - } - } + # -- lualine + # local navic = require("nvim-navic") + # require('lualine').setup { + # options = { theme = 'ayu' }, + # sections = { + # lualine_c = { + # 'filename', { navic.get_location, condition=navic.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 + # }, + # lualine_x = {'filetype'} + # } + # } - -- nvim-lint - -- require('lint').linters_by_ft = { - -- markdown = {'vale'}, - -- } + # -- 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 - function update_date() - local time = os.date("%Y-%m-%d %H:%M") - local message = "%update " .. time - local lines = vim.api.nvim_buf_get_lines(0, 0,4,false) - for i=1,4,1 do - if (lines[i]:len() == 0) then - vim.api.nvim_buf_set_lines(0, i-1, i, false, {message, ""}) - return - end - end - if (lines[4]:len() ~= 0) then - vim.api.nvim_buf_set_lines(0, 3, 4, false, {message}) - end - return - end + # -- Custom functions + # function update_date() + # local time = os.date("%Y-%m-%d %H:%M") + # local message = "%update " .. time + # local lines = vim.api.nvim_buf_get_lines(0, 0,4,false) + # for i=1,4,1 do + # if (lines[i]:len() == 0) then + # vim.api.nvim_buf_set_lines(0, i-1, i, false, {message, ""}) + # return + # end + # end + # if (lines[4]:len() ~= 0) then + # vim.api.nvim_buf_set_lines(0, 3, 4, false, {message}) + # end + # return + # end - vim.api.nvim_create_autocmd( - "BufWritePre", - { pattern = { "*.wiki" }, callback = update_date} - ) + # vim.api.nvim_create_autocmd( + # "BufWritePre", + # { pattern = { "*.wiki" }, callback = update_date} + # ) - -- set spelling for text files - vim.api.nvim_create_autocmd( - { "BufRead", "BufNewFile" }, - { pattern = { "*.wiki", "*.txt", "*.md", "*.tex" }, - command = "setlocal spell" } - ) - vim.api.nvim_create_autocmd( - "FileType", - { pattern = { "mail" }, - command = "setlocal spell" } - ) + # -- set spelling for text files + # vim.api.nvim_create_autocmd( + # { "BufRead", "BufNewFile" }, + # { pattern = { "*.wiki", "*.txt", "*.md", "*.tex" }, + # command = "setlocal spell" } + # ) + # vim.api.nvim_create_autocmd( + # "FileType", + # { pattern = { "mail" }, + # command = "setlocal spell" } + # ) - -- auto session - require('auto-session').setup { - log_level = 'info', - auto_session_suppress_dirs = {'~/'} - } - vim.o.sessionoptions="blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal" + # -- auto session + # require('auto-session').setup { + # log_level = 'info', + # auto_session_suppress_dirs = {'~/'} + # } + # vim.o.sessionoptions="blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal" - require("which-key").setup{} - require('leap').set_default_keymaps() - - -- supercollider - local scnvim = require 'scnvim' - local map = scnvim.map - local map_expr = scnvim.map_expr - scnvim.setup { - keymaps = { - ['e'] = map('editor.send_line', {'i', 'n'}), - ['s'] = map_expr('CmdPeriod.run', {'i', 'n'}), - ['t'] = { - map('editor.send_block', {'i', 'n'}), - map('editor.send_selection', 'x'), - }, - [''] = map('postwin.toggle'), - [''] = map('postwin.toggle', 'i'), - [''] = map('postwin.clear', {'n', 'i'}), - [''] = map('signature.show', {'n', 'i'}), - [''] = map('sclang.hard_stop', {'n', 'x', 'i'}), - ['st'] = map('sclang.start'), - ['sk'] = map('sclang.recompile'), - [''] = map_expr('s.boot'), - [''] = map_expr('s.meter'), - } - } - -- You gotta run :SCNvimGenerateAssets for this first - -- require("luasnip").add_snippets("supercollider", require("scnvim/utils").get_snippets()) + # require("which-key").setup{} + # require('leap').set_default_keymaps() + # + # -- supercollider + # local scnvim = require 'scnvim' + # local map = scnvim.map + # local map_expr = scnvim.map_expr + # scnvim.setup { + # keymaps = { + # ['e'] = map('editor.send_line', {'i', 'n'}), + # ['s'] = map_expr('CmdPeriod.run', {'i', 'n'}), + # ['t'] = { + # map('editor.send_block', {'i', 'n'}), + # map('editor.send_selection', 'x'), + # }, + # [''] = map('postwin.toggle'), + # [''] = map('postwin.toggle', 'i'), + # [''] = map('postwin.clear', {'n', 'i'}), + # [''] = map('signature.show', {'n', 'i'}), + # [''] = map('sclang.hard_stop', {'n', 'x', 'i'}), + # ['st'] = map('sclang.start'), + # ['sk'] = map('sclang.recompile'), + # [''] = map_expr('s.boot'), + # [''] = map_expr('s.meter'), + # } + # } + # -- You gotta run :SCNvimGenerateAssets for this first + # -- require("luasnip").add_snippets("supercollider", require("scnvim/utils").get_snippets()) - -- 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{} + # -- 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{} - -- hologram - require('hologram').setup{ - auto_display = false -- WIP automatic markdown image display, may be prone to breaking - } + # -- hologram + # require('hologram').setup{ + # auto_display = false -- WIP automatic markdown image display, may be prone to breaking + # } - EOF + # EOF - ''; + # ''; extraPackages = with pkgs; [ # used to compile tree-sitter grammar # python-with-my-packages @@ -568,19 +563,22 @@ nodePackages.typescript-language-server luajitPackages.lua-lsp fennel-ls - starpls-bin + # starpls-bin # TODO find this!! ]; plugins = with pkgs.vimPlugins; [ + #hotpot + hotpot-nvim # ui lualine-nvim + neo-tree-nvim fzf-vim vim-devicons nvim-web-devicons telescope-nvim plenary-nvim nvim-navic - fterm + FTerm-nvim barbar-nvim # TODO @@ -620,7 +618,7 @@ cmp-nvim-lsp cmp-treesitter nvim-lsp-ts-utils - lspsaga + lspsaga-nvim cmp-conjure cmp-buffer cmp-path @@ -628,7 +626,7 @@ nvim-autopairs cmp_luasnip luasnip - lsp-format + lsp-format-nvim friendly-snippets lspkind-nvim @@ -647,11 +645,11 @@ # experimental nvim-luapad scnvim - leap + leap-nvim vim-beancount # vimtex # custom - nvim-parinfer + # nvim-parinfer # vim-processing ]; # withPython3 = true;