gopls configured, but cmp broken
This commit is contained in:
		
							parent
							
								
									7fab1f798c
								
							
						
					
					
						commit
						0709b64a71
					
				|  | @ -16,6 +16,15 @@ | |||
| (nvim.opt :showtabline 2) | ||||
| (nvim.opt :expandtab true) | ||||
| (nvim.opt :autowriteall true) | ||||
| (nvim.opt :cmdheight 2) | ||||
| (nvim.opt :spelllang "en_gb") | ||||
| (nvim.opt :ignorecase true) | ||||
| (nvim.opt :smartcase true) | ||||
| (nvim.opt :incsearch true) | ||||
| (nvim.opt :updatetime 300) ; Diagnostics response time | ||||
| (nvim.opt :signcolumn "yes") | ||||
| (nvim.opt :cursorline true) | ||||
| 
 | ||||
| 
 | ||||
| (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 | ||||
|  | @ -26,4 +35,6 @@ | |||
| (require :conf.plugins) | ||||
| (require :conf.mappings) | ||||
| (require :conf.lsp) | ||||
| (require :conf.formatting) | ||||
| (require :conf.plugins.cmp) | ||||
| ; (require :conf.formatting) | ||||
| ; (require :conf.kitaab) | ||||
|  |  | |||
|  | @ -1,7 +1,118 @@ | |||
| ; (local lspfuzzy (require :lspfuzzy)) | ||||
| (local lspkind (require :lspkind)) | ||||
| (local lspconfig (require :lspconfig)) | ||||
| (local cmp (require :cmp)) | ||||
| (local nvim (require :lib/nvim)) | ||||
| ; (local sg (require :sg)) | ||||
| ; (local lsputil (require :lspconfig/util)) | ||||
| 
 | ||||
| (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 | ||||
|                     {:focusable false :border "rounded"})) | ||||
| 
 | ||||
| (local capabilities (let [cmp_nvim_lsp (require :cmp_nvim_lsp)] | ||||
|                       (cmp_nvim_lsp.default_capabilities))) | ||||
| 
 | ||||
| (local formatting-augroup (nvim.augroup :LspFormatting)) | ||||
| 
 | ||||
| (fn goimports [wait-ms] | ||||
|   (let [params (vim.lsp.util.make_range_params)  | ||||
|          result (do | ||||
|                  (tset params :context {:only [:source.organizeImports]}) | ||||
|                  (vim.lsp.buf_request_sync 0 :textDocument/codeAction params wait-ms))] | ||||
|        (each [_ res (pairs (or result {}))] | ||||
|          (each [_ r (pairs (or res.result {}))] | ||||
|            (if r.edit | ||||
|                (vim.lsp.util.apply_workspace_edit r.edit "utf-16") | ||||
|                (vim.lsp.buf.execute_command r.command)))) | ||||
|    (vim.lsp.buf.format))) | ||||
| 
 | ||||
| (fn on-attach [client bufnr] | ||||
|               (let [filetype (vim.api.nvim_buf_get_option 0 "filetype")] | ||||
|                 (if (client.supports_method "textDocument/formatting") | ||||
|                     (do (nvim.autocmd "BufWritePre" | ||||
|                                       {:group formatting-augroup | ||||
|                                        :buffer bufnr | ||||
|                                        :callback (fn [_] (if (= filetype "go") | ||||
|                                                              (goimports 2000) | ||||
|                                                              (vim.lsp.buf.format {:bufnr bufnr})))}))))) | ||||
| 
 | ||||
| (lspconfig.gopls.setup  | ||||
|   {:capabilities capabilities | ||||
|    :codelens {:generate true :gc_details true} | ||||
|    :semanticTokens true | ||||
|    :flags { :debounce_text_changes 200} | ||||
|    :analyses {:unusedparams true | ||||
|               :unusedvariables true | ||||
|               :unusedwrite true | ||||
|               :nilness true | ||||
|               :unusedwrite true | ||||
|               :useany true} | ||||
|    :completeUnimported true | ||||
|    :staticcheck true | ||||
|    :experimentalPostfixCompletions true | ||||
|    :hints {:constantValues true | ||||
|            :functionTypeParameters true    | ||||
|            :assignVariablesTypes true | ||||
|            :compositeLiteralTypes true | ||||
|            :compositeLiteralFields true | ||||
|            :parameterNames true | ||||
|            :rangeVariableTypes true} | ||||
|    :on_attach on-attach}) | ||||
| 
 | ||||
| 
 | ||||
| ;  #    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) | ||||
| ;; Diagnostics Config I don't yet understand | ||||
| ; Set Diagnostics | ||||
| ; local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " } | ||||
| ; for type, icon in pairs(signs) do | ||||
| ; local hl = "DiagnosticSign" .. type | ||||
| ; vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl}) | ||||
| ; end | ||||
| 
 | ||||
| ; vim.g.diagnostics_active = true | ||||
| ; function _G.toggle_diagnostics() | ||||
| ;   if vim.g.diagnostics_active then | ||||
| ;     vim.g.diagnostics_active = false | ||||
| ;     vim.lsp.diagnostic.clear(0) | ||||
| ;     vim.lsp.handlers["textDocument/publishDiagnostics"] = function() end | ||||
| ;   else | ||||
| ;     vim.g.diagnostics_active = true | ||||
| ;     vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( | ||||
| ;       vim.lsp.diagnostic.on_publish_diagnostics, { | ||||
| ;         virtual_text = true, | ||||
| ;         signs = true, | ||||
| ;         underline = true, | ||||
| ;         update_in_insert = false, | ||||
| ;       } | ||||
| ;     ) | ||||
| ;   end | ||||
| ; end | ||||
| ; | ||||
| ; vim.diagnostic.config({ | ||||
| ;   signs = true, | ||||
| ;   update_in_insert = false, | ||||
| ;   underline = false, | ||||
| ;   severity_sort = true, | ||||
| ;   float = { | ||||
| ;     focusable = false, | ||||
| ;     style = 'minimal', | ||||
| ;     border = 'rounded', | ||||
| ;     source = 'always', | ||||
| ;   }, | ||||
| ; }) | ||||
|  |  | |||
|  | @ -5,13 +5,33 @@ | |||
| (nvim.keymap [:v] "<" "<gv" {:noremap true}) | ||||
| (nvim.keymap [:v] ">" ">gv" {:noremap true}) | ||||
| (nvim.keymap [:n] "<space>" "<NOP>" {:noremap true :silent true}) | ||||
| ;; Convenient way to move stuff in visual mode | ||||
| (nvim.keymap [:v] "J" ":m '>+1<CR>gv=gv" {:noremap true}) | ||||
| (nvim.keymap [:v] "K" ":m '>-2<CR>gv=gv" {:noremap true}) | ||||
| ;; Convientent screen shifting  | ||||
| (nvim.keymap [:n] "n" "nzzzv" {:noremap true}) | ||||
| (nvim.keymap [:n] "N" "Nzzzv" {:noremap true}) | ||||
| (nvim.keymap [:n] "J" "mzJ'z" {:noremap true}) | ||||
| ; Fix Y | ||||
| (nvim.keymap [:n] "Y" "y$") | ||||
| ; Unmap Q | ||||
| (nvim.keymap [] "Q" "<Nop>") | ||||
| 
 | ||||
| ; FTerm | ||||
| (vim.api.nvim_create_user_command "FTermToggle" (fn [_]  | ||||
|                                                   ((-> (require :FTerm)  | ||||
|                                                       (. :toggle))))  | ||||
|                                   {:bang true}) | ||||
| (nvim.keymap [:t] "<TAB>" "<cmd>:FTermToggle<CR>") | ||||
| (nvim.keymap [:n] "<TAB>" "<cmd>:FTermToggle<CR>" {:nnoremap true}) | ||||
| (nvim.keymap [:n] "<TAB>" "<cmd>:FTermToggle<CR>" {:noremap true}) | ||||
| 
 | ||||
| ; Buffer Movement | ||||
| (nvim.keymap [:n] "gT" ":BufferPrevious<CR>" {:silent true :noremap true})  | ||||
| (nvim.keymap [:n] "gt" ":BufferNext<CR>" {:silent true :noremap true})  | ||||
| (nvim.keymap [:n] "gj" ":BufferPick<CR>" {:silent true :noremap true})  | ||||
| (nvim.keymap [:n] "gb" ":Telescope buffers<CR>" {:silent true :noremap true})  | ||||
| (nvim.keymap [:n] "gq" ":BufferClosoe<CR>" {:silent true :noremap true})  | ||||
| 
 | ||||
| 
 | ||||
| (local | ||||
|   normal-map-leader | ||||
|  | @ -23,6 +43,8 @@ | |||
|         "Quit"] | ||||
|    "r" [":RainbowParenthesesToggleAll<CR>" | ||||
|         "Toggle Rainbow Parens"] | ||||
|    "u" [":UndotreeToggle<CR>" | ||||
|         "Toggle Undo Tree"] | ||||
|    ; Telescope  | ||||
|    "f" {:name "Files" | ||||
|         :f ["<cmd>Telescope find_files<cr>" | ||||
|  | @ -51,16 +73,17 @@ | |||
|               "Git Diff"] | ||||
|          "h" ["" | ||||
|               "Commit Hunk under Cursor"]} | ||||
|    ;     nmap <leader>gl :diffget //3<CR> | ||||
|    ;     nmap <leader>gh :diffget //2<CR> | ||||
|    ;     nnoremap <leader>gc :G commit -v -q %:p<CR> | ||||
|          ; For handling merges | ||||
|          ;     nmap <leader>gl :diffget //3<CR> | ||||
|          ;     nmap <leader>gh :diffget //2<CR> | ||||
|          ;     nnoremap <leader>gc :G commit -v -q %:p<CR> | ||||
|    ; Buffers | ||||
|    "b" {:name "Buffer" | ||||
|         :a ["" | ||||
|              "Buffer Add"] | ||||
|         :q ["" | ||||
|         :b ["<cmd>:Telescope buffers<CR>" | ||||
|             "Buffer List"] | ||||
|         :q ["<cmd>:BufferClose<CR>" | ||||
|              "Buffer Quit"] | ||||
|         :n ["" | ||||
|         :n ["<cmd>:BufferNext<CR>" | ||||
|             "Buffer Next"] | ||||
|         :N ["<cmd>:tabp<CR>" | ||||
|             "Buffer Previous"] | ||||
|  | @ -89,8 +112,16 @@ | |||
|         :h [":Lspsaga hover_doc<CR>" | ||||
|             "Hover doc"] | ||||
|         :o [":LSoutlineToggle<CR>" | ||||
|             "Outline"]} | ||||
|             "Outline"] | ||||
|         :t [":call v:lua.toggle_diagnostics()<CR>"]} | ||||
|    ; Kitaab | ||||
|    "z" {:name "Kitaab"}}) | ||||
|    "z" {:name "Kitaab" | ||||
|         :n [":ZettelNew<CR>" | ||||
|             "Zettel New"]} | ||||
|    "v" {:name "Tabs" | ||||
|         :v [":vnew<CR>" | ||||
|             "Vertical Split"] | ||||
|         :h [":new<CR>" | ||||
|             "Horizontal Split"]}}) | ||||
| 
 | ||||
| (wk.register normal-map-leader {:prefix "<leader>"}) | ||||
|  |  | |||
|  | @ -0,0 +1,4 @@ | |||
| (local nvim (require :lib/nvim)) | ||||
| 
 | ||||
| (nvim.g :tidal_target "terminal") | ||||
| (nvim.g :scnvim_snippet_format "luasnip") | ||||
|  | @ -1,7 +1,5 @@ | |||
| (local nvim (require :lib/nvim)) | ||||
| 
 | ||||
| (nvim.g :tidal_target "terminal") | ||||
| 
 | ||||
| (local navic (require :nvim-navic)) | ||||
| 
 | ||||
| (let  [lualine (require :lualine)] | ||||
|  | @ -9,6 +7,7 @@ | |||
|                   :sections {:lualine_c [:filename {1 navic.get_location  | ||||
|                                                     :cond navic.is_available}] | ||||
|                              :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)] | ||||
|  |  | |||
							
								
								
									
										57
									
								
								home/profiles/nvim/config/fnl/conf/plugins/cmp.fnl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								home/profiles/nvim/config/fnl/conf/plugins/cmp.fnl
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,57 @@ | |||
| (local cmp (require :cmp)) | ||||
| 
 | ||||
| (fn has-words-before [] | ||||
|   (let [(line col) (unpack (vim.api.nvim_win_get_cursor 0)) | ||||
|         cur-line (. (vim.api.nvim_buf_get_lines 0 | ||||
|                                           (- line 1) | ||||
|                                           line | ||||
|                                           true | ||||
|                       1))] | ||||
|     (and (not= col 0) | ||||
|          (= (: (: cur-line :sub col col) :match "%s") | ||||
|             nil)))) | ||||
| 
 | ||||
| (fn tab [fallback] | ||||
|   (let [cmp (require :cmp) | ||||
|         luasnip (require :luasnip)] | ||||
|     (if (cmp.visible) | ||||
|         (cmp.select_next_item) | ||||
|         (let [available (luasnip.expand_or_jumpable)] | ||||
|           (if (= (available) true) | ||||
|               (luasnip.expand_or_jump) | ||||
|               (if (has-words-before) | ||||
|                   (cmp.complete) | ||||
|                   (fallback))))))) | ||||
| 
 | ||||
| (fn stab [fallback] | ||||
|   (let [cmp (require :cmp) | ||||
|         luasnip (require :luasnip)] | ||||
|     (if (cmp.visible) | ||||
|         (cmp.select_prev_item) | ||||
|         (let [available (luasnip.jumpable -1)] | ||||
|           (if (= (available) true) | ||||
|               (luasnip.jump -1) | ||||
|               (if (has-words-before) | ||||
|                   (cmp.complete) | ||||
|                   (fallback))))))) | ||||
| 
 | ||||
| (let [lspkind (require :lspkind) | ||||
|       luasnip_loaders (require :luasnip.loaders.from_vscode)] | ||||
|   (luasnip_loaders.lazy_load) | ||||
|   (cmp.setup {:formatting {:format lspkind.cmp_format} | ||||
|               :snippet {:expand (fn [args] | ||||
|                                   (let [luasnip (require :luasnip)] | ||||
|                                     (luasnip.lsp_expand args.body)))} | ||||
|               :sources [{:name "buffer"}      {:name "nvim_lsp"}  | ||||
|                         {:name "look"}        {:name "path"} | ||||
|                         {:name "calc"}        {:name "spell"} | ||||
|                         {:name "cmp-conjure"} {:name "luasnip"} | ||||
|                         {:name "tags"}] | ||||
|               :mapping {"<C-d>" (cmp.mapping.scroll_docs -4) | ||||
|                         "<C-u>" (cmp.mapping.scroll_docs 4) | ||||
|                         "<Up>" (cmp.mapping (cmp.mapping.select_prev_item) [:i :c]) | ||||
|                         "<Down>" (cmp.mapping (cmp.mapping.select_next_item) [:i :c])  | ||||
|                         "<C-g>" (cmp.mapping.close) | ||||
|                         "<CR>" (cmp.mapping.confirm {:select true}) | ||||
|                         "<Tab>" (cmp.mapping tab [:i :s]) | ||||
|                         "<S-Tab>" (cmp.mapping stab [:i :s])}})) | ||||
							
								
								
									
										11
									
								
								home/profiles/nvim/config/fnl/conf/plugins/kitaab.fnl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								home/profiles/nvim/config/fnl/conf/plugins/kitaab.fnl
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | |||
| (local nvim (require :lib/nvim)) | ||||
| 
 | ||||
| (nvim.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"}}]) | ||||
| (nvim.g :zettel_format "%y%m%d-%H%M") | ||||
|  | @ -8,13 +8,13 @@ | |||
| 
 | ||||
| (fn augroup [name ?opts] | ||||
|   "Create autocommand group" | ||||
|   (vim.api.nvim_create_augroup name (or opts {}))) | ||||
|   (vim.api.nvim_create_augroup name (or ?opts {}))) | ||||
| 
 | ||||
| (fn keymap [mode lhs rhs ?opts] | ||||
|   "Sets a global mapping for the given mode. | ||||
|   Ex: `(keymap [:n :i] ...)`" | ||||
|   (let [string-mode (table.concat mode)] | ||||
|     (vim.api.nvim_set_keymap string-mode lhs rhs (or opts {})))) | ||||
|     (vim.api.nvim_set_keymap string-mode lhs rhs (or ?opts {})))) | ||||
| 
 | ||||
| (fn opt [key value] | ||||
|   "Set a vim option" | ||||
|  |  | |||
|  | @ -28,13 +28,17 @@ | |||
|     # 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"; | ||||
|   }; | ||||
|   # Add %update to the highlight clause for vimwiki files | ||||
|   home.file.".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 | ||||
|   ''; | ||||
| 
 | ||||
|   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; | ||||
|   }; | ||||
| 
 | ||||
|   #environment.systemPackages = with customPlugins; [ tidal ]; | ||||
|   programs.neovim = { | ||||
|  | @ -43,138 +47,17 @@ | |||
|     # 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 | ||||
| 
 | ||||
|   #    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 <localleader>lt :ConjureLogToggle<CR> | ||||
| 
 | ||||
|   #    let g:rainbow_active = 0 | ||||
|   #    autocmd BufReadPost,BufNewFile c,clj,cljs RainbowParenthesesToggleAll | ||||
| 
 | ||||
|   #    " general commands | ||||
|   #    nnoremap <BS> :noh<CR> | ||||
|   #    map Q <Nop> | ||||
|   #    nnoremap Y y$ | ||||
|   #    nnoremap <leader>n :vnew<CR> | ||||
|   #    " center moving | ||||
|   #    nnoremap n nzzzv | ||||
|   #    nnoremap N Nzzzv | ||||
|   #    nnoremap J mzJ'z | ||||
|   #    " undo points | ||||
|   #    inoremap , ,<c-g>u | ||||
|   #    inoremap . .<c-g>u | ||||
|   #    inoremap ? ?<c-g>u | ||||
|   #    inoremap ! !<c-g>u | ||||
|   #    inoremap ) )<c-g>u | ||||
|   #    inoremap [ [<c-g>u | ||||
|   #    inoremap ] ]<c-g>u | ||||
|   #    inoremap { {<c-g>u | ||||
|   #    inoremap ( (<c-g>u | ||||
|   #    inoremap } }<c-g>u | ||||
|   #    " moving text | ||||
|   #    vnoremap J :m '>+1<CR>gv=gv | ||||
|   #    vnoremap K :m '>-2<CR>gv=gv | ||||
|   #    inoremap <c-j> <esc>:m .+1<CR>== | ||||
|   #    inoremap <c-k> <esc>:m .-2<CR>== | ||||
|   #    nnoremap <leader>j <esc>:m .+1<CR>== | ||||
|   #    nnoremap <leader>k <esc>:m .-2<CR>== | ||||
|   #    " Pasting  | ||||
|   #    :map <leader>sy :!xclip -i<CR><CR> | ||||
|   #    :vmap <leader>sy "*y | ||||
|   #    :map <leader>sp :r!xclip -o<CR> | ||||
| 
 | ||||
|   #    " barbar | ||||
|   #    nnoremap <silent> gT :BufferPrevious<CR> | ||||
|   #    nnoremap <silent> gt :BufferNext<CR> | ||||
|   #    nnoremap <silent> gj :BufferPick<CR> | ||||
|   #    nnoremap <silent> gq :BufferClose<CR> | ||||
| 
 | ||||
|   #    " kitaab | ||||
|   #    map <leader>cz :VimwikiIndex<CR>:ZettelNew | ||||
|   #    map <leader>zs :ZettelSearch<CR> | ||||
|   #    map <leader>zn :ZettelNew<CR> | ||||
|   #    map <leader>zo :ZettelOpen<CR> | ||||
|   #    map <leader>zf :Telescope oldfiles only_cwd=true<CR> | ||||
|   #    map <leader>wt :VimwikiMakeTomorrowDiaryNote | ||||
|   #    map <leader>wd :VimwikiMakeYesterdayDiaryNote | ||||
|   #    map <leader>zm :ZenMode<CR>:setlocal nospell<CR> | ||||
|   #    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" | ||||
| 
 | ||||
| 
 | ||||
|   #    " lua config  | ||||
|   #    lua <<EOF | ||||
|   #    vim.g.diagnostics_active = true | ||||
|   #    function _G.toggle_diagnostics() | ||||
|   #      if vim.g.diagnostics_active then | ||||
|   #        vim.g.diagnostics_active = false | ||||
|   #        vim.lsp.diagnostic.clear(0) | ||||
|   #        vim.lsp.handlers["textDocument/publishDiagnostics"] = function() end | ||||
|   #      else | ||||
|   #        vim.g.diagnostics_active = true | ||||
|   #        vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( | ||||
|   #          vim.lsp.diagnostic.on_publish_diagnostics, { | ||||
|   #            virtual_text = true, | ||||
|   #            signs = true, | ||||
|   #            underline = true, | ||||
|   #            update_in_insert = false, | ||||
|   #          } | ||||
|   #        ) | ||||
|   #      end | ||||
|   #    end | ||||
| 
 | ||||
|   #    vim.diagnostic.config({ | ||||
|   #      signs = true, | ||||
|   #      update_in_insert = false, | ||||
|   #      underline = false, | ||||
|   #      severity_sort = true, | ||||
|   #      float = { | ||||
|   #        focusable = false, | ||||
|   #        style = 'minimal', | ||||
|   #        border = 'rounded', | ||||
|   #        source = 'always', | ||||
|   #      }, | ||||
|   #    }) | ||||
| 
 | ||||
|   #    vim.lsp.handlers['textDocument/hover'] = vim.lsp.with( | ||||
|   #      vim.lsp.handlers.hover, | ||||
|   #      { | ||||
|   #        border = 'rounded', | ||||
|   #      } | ||||
|   #    ) | ||||
| 
 | ||||
|   #    vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with( | ||||
|   #      vim.lsp.handlers.signature_help, | ||||
|   #      { | ||||
|   #        border = 'rounded', | ||||
|   #      } | ||||
|   #    ) | ||||
| 
 | ||||
|   #    local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview | ||||
|   #    function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...) | ||||
|  | @ -184,8 +67,6 @@ | |||
|   #    end | ||||
| 
 | ||||
| 
 | ||||
|   #    vim.api.nvim_set_keymap('n', '<leader>vt', ':call v:lua.toggle_diagnostics()<CR>',  {noremap = true, silent = true}) | ||||
| 
 | ||||
|   #    -- autopairs | ||||
|   #    require('nvim-autopairs').setup{} | ||||
| 
 | ||||
|  | @ -193,15 +74,9 @@ | |||
|   #    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 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 | ||||
|  | @ -209,61 +84,6 @@ | |||
|   #        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 = { | ||||
|   #            ['<C-p>'] = cmp.mapping.select_prev_item(), | ||||
|   #            ['<C-n>'] = cmp.mapping.select_next_item(), | ||||
|   #            ['<C-d>'] = cmp.mapping.scroll_docs(-4), | ||||
|   #            ['<C-f>'] = cmp.mapping.scroll_docs(4), | ||||
|   #            ['<C-Space>'] = cmp.mapping.complete(), | ||||
|   #            ['<C-e>'] = cmp.mapping.close(), | ||||
|   #            ['<CR>'] = cmp.mapping.confirm({ | ||||
|   #                behavior = cmp.ConfirmBehavior.Insert, | ||||
|   #                select = true | ||||
|   #            }), | ||||
|   #            ["<Tab>"] = 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"}), | ||||
|   #            ["<S-Tab>"] = 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 | ||||
|  | @ -320,7 +140,6 @@ | |||
|   #      }, | ||||
|   #    }) | ||||
| 
 | ||||
|   #    capabilities = require('cmp_nvim_lsp').default_capabilities() | ||||
| 
 | ||||
|   #    -- fennel-ls is bleeding edge | ||||
|   #    local lspconfig = require('lspconfig') | ||||
|  | @ -333,16 +152,6 @@ | |||
|   #      } | ||||
|   #    } | ||||
| 
 | ||||
|   #    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 { | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue