@@ -154,7 +154,7 @@ vim.opt.inccommand = 'split'
154154vim .opt .cursorline = true
155155
156156-- Minimal number of screen lines to keep above and below the cursor.
157- vim .opt .scrolloff = 10
157+ vim .opt .scrolloff = 28
158158
159159-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
160160-- instead raise a dialog asking if you wish to save the current file(s)
@@ -168,6 +168,9 @@ vim.opt.confirm = true
168168-- See `:help hlsearch`
169169vim .keymap .set (' n' , ' <Esc>' , ' <cmd>nohlsearch<CR>' )
170170
171+ -- Save file
172+ vim .keymap .set (' n' , ' <leader>w' , ' <cmd>w<CR>' , { desc = ' Save file' })
173+
171174-- Diagnostic keymaps
172175vim .keymap .set (' n' , ' <leader>q' , vim .diagnostic .setloclist , { desc = ' Open diagnostic [Q]uickfix list' })
173176
@@ -291,14 +294,14 @@ require('lazy').setup({
291294 -- optional, but required for fuzzy finder support
292295 dependencies = {
293296 ' nvim-telescope/telescope-fzf-native.nvim' ,
294- build = ' make'
297+ build = ' make' ,
295298 },
296299 config = function ()
297- local dropbar_api = require ( ' dropbar.api' )
300+ local dropbar_api = require ' dropbar.api'
298301 vim .keymap .set (' n' , ' <Leader>;' , dropbar_api .pick , { desc = ' Pick symbols in winbar' })
299302 vim .keymap .set (' n' , ' [;' , dropbar_api .goto_context_start , { desc = ' Go to start of current context' })
300303 vim .keymap .set (' n' , ' ];' , dropbar_api .select_next_context , { desc = ' Select next context' })
301- end
304+ end ,
302305 },
303306 -- --NOTE: Kanso Theme - FQ
304307 -- {
@@ -582,6 +585,18 @@ require('lazy').setup({
582585 -- If you're wondering about lsp vs treesitter, you can check out the wonderfully
583586 -- and elegantly composed help section, `:help lsp-vs-treesitter`
584587
588+ -- LSP Hover and Signature Help Border (set before LspAttach)
589+ vim .lsp .handlers [' textDocument/hover' ] = vim .lsp .with (vim .lsp .handlers .hover , {
590+ border = ' rounded' ,
591+ })
592+ vim .lsp .handlers [' textDocument/signatureHelp' ] = vim .lsp .with (vim .lsp .handlers .signature_help , {
593+ border = ' rounded' ,
594+ })
595+
596+ -- Lighten LSP popup background
597+ vim .api .nvim_set_hl (0 , ' NormalFloat' , { bg = ' #15171c' })
598+ vim .api .nvim_set_hl (0 , ' FloatBorder' , { bg = ' #15171c' , fg = ' #6a6a6a' })
599+
585600 -- This function gets run when an LSP attaches to a particular buffer.
586601 -- That is to say, every time a new file is opened that is associated with
587602 -- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this
@@ -636,6 +651,25 @@ require('lazy').setup({
636651 -- the definition of its *type*, not where it was *defined*.
637652 map (' grt' , require (' telescope.builtin' ).lsp_type_definitions , ' [G]oto [T]ype Definition' )
638653
654+ -- Follow file:// links in LSP hover popup
655+ vim .keymap .set (' n' , ' gx' , function ()
656+ local line = vim .api .nvim_get_current_line ()
657+ local url = line :match (' file://([^)]+)' )
658+ if url then
659+ local file = url :match (' ([^#]+)' )
660+ local lnum = url :match (' #L(%d+)' )
661+ if file then
662+ vim .cmd (' edit ' .. vim .fn .fnameescape (file ))
663+ if lnum then
664+ vim .cmd (' normal! ' .. lnum .. ' Gzz' )
665+ end
666+ end
667+ else
668+ -- Fallback to default gx behavior
669+ vim .ui .open (vim .fn .expand (' <cfile>' ))
670+ end
671+ end , { buffer = event .buf , desc = ' LSP: Open file:// link' })
672+
639673 -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
640674 --- @param client vim.lsp.Client
641675 --- @param method vim.lsp.protocol.Method
@@ -748,6 +782,12 @@ require('lazy').setup({
748782 local servers = {
749783 -- clangd = {},
750784 -- gopls = {},
785+ zls = {
786+ cmd = { ' zls' },
787+ settings = {
788+ zig_exe_path = ' /Users/fq/.zvm/bin/zig' ,
789+ },
790+ },
751791 pyright = {
752792 cmd = { ' pyright-langserver' , ' --stdio' },
753793 settings = {
@@ -812,9 +852,9 @@ require('lazy').setup({
812852 -- for you, so that they are available from within Neovim.
813853 -- Filter out servers that aren't available through Mason
814854 local mason_servers = vim .tbl_filter (function (server_name )
815- return server_name ~= ' sourcekit' -- sourcekit-lsp comes with Xcode, not Mason
855+ return server_name ~= ' sourcekit' and server_name ~= ' zls ' -- sourcekit-lsp comes with Xcode, zls using custom version
816856 end , vim .tbl_keys (servers or {}))
817-
857+
818858 local ensure_installed = mason_servers
819859 vim .list_extend (ensure_installed , {
820860 ' stylua' , -- Used to format Lua code
@@ -832,17 +872,23 @@ require('lazy').setup({
832872 -- by the server configuration above. Useful when disabling
833873 -- certain features of an LSP (for example, turning off formatting for ts_ls)
834874 server .capabilities = vim .tbl_deep_extend (' force' , {}, capabilities , server .capabilities or {})
835- require (' lspconfig' )[server_name ].setup (server )
875+
876+ -- Use new vim.lsp.config API for Neovim 0.11+
877+ vim .lsp .config (server_name , server )
878+ vim .lsp .enable (server_name )
836879 end ,
837880 },
838881 }
839882
840883 -- Setup LSP servers that aren't managed by Mason
841- local non_mason_servers = { ' sourcekit' }
884+ local non_mason_servers = { ' sourcekit' , ' zls ' }
842885 for _ , server_name in ipairs (non_mason_servers ) do
843886 local server = servers [server_name ] or {}
844887 server .capabilities = vim .tbl_deep_extend (' force' , {}, capabilities , server .capabilities or {})
845- require (' lspconfig' )[server_name ].setup (server )
888+
889+ -- Use new vim.lsp.config API for Neovim 0.11+
890+ vim .lsp .config (server_name , server )
891+ vim .lsp .enable (server_name )
846892 end
847893 end ,
848894 },
@@ -1133,6 +1179,7 @@ require('lazy').setup({
11331179 -- Or use telescope!
11341180 -- In normal mode type `<space>sh` then write `lazy.nvim-plugin`
11351181 -- you can continue same window with `<space>sr` which resumes last telescope search
1182+
11361183}, {
11371184 ui = {
11381185 -- If you are using a Nerd Font: set icons to an empty table which will use the
0 commit comments