Must-change Zed Settings

Some inspiration on what configuration entries you could tweak to make Zed even more usefull!

Must-change Zed Settings
10 Oct 2024
|
1 min read

I recently started using Zed for full time development work and really fell in love. This post will show you some settings which helped me customizing the experience to my liking.

Style

 1{
 2  // First things first, you can set the theme.mode to system in order to
 3  // automatically change between dark & light themes based on your system theme.
 4  "theme": {
 5    "mode": "system",
 6    "light": "Github Light (custom)",
 7    "dark": "Github Dark Dimmed (custom)"
 8  },
 9    
10  // Remove the < > buttons from the tab bar
11  "tab_bar": {
12    "show": true,
13    "show_nav_history_buttons": false
14  },
15    
16  // Show file type icons in the tab bar. Also color them according to the
17  // git status.
18  "tabs": {
19    "file_icons": true,
20    "git_status": true
21  },
22    
23  // Decrease the horizontal indent size of files & folders in the project
24  // panel to avoid horizontal scrolling
25  "project_panel": {
26    "indent_size": 16
27  },
28    
29  // Set a preferred line lenth, showing a vertical gutter bar
30  "preferred_line_length": 160,
31    
32  // Set global tab size to 4, you could also make this language-specific but 4 
33  // spaces works for me
34  "tab_size": 4,
35}

Language specific configuration

Markdown

 1{
 2  "languages": {
 3    "Markdown": {
 4      
 5      // Wrap text according to the previously defined preferred line length.
 6      "soft_wrap": "preferred_line_length",
 7        
 8      // do not remove any trailing whitespace since line breaks in
 9      // lists (without adding a new punctuation) rely on whitespaces.
10      "remove_trailing_whitespace_on_save": false
11    }
12  }
13}

LaTeX

 1{
 2  "languages": {
 3    "LaTeX": {
 4      
 5      // Disable AI completions, it's latex...
 6      "show_inline_completions": false,
 7        
 8      // Same as in Markdown
 9      "soft_wrap": "preferred_line_length",
10        
11      // Just a matter of linking. I like more compact fluent text-
12      "preferred_line_length": 110
13    }
14  }
15}

PHP

 1{
 2  "languages": {
 3    "PHP": {
 4
 5      // In my experience, the Intelephense LS works better then phpactor.
 6      // Adding a leading ! will exclude the entry.
 7      "language_servers": ["intelephense", "!phpactor"],
 8
 9      "format_on_save": "on",
10      "formatter": {
11        "external": {
12          "command": "bash",
13            
14          // Use the program STDIN file contents to call PHP-CS-Fixer. You should
15          // move this part in the project-specific settings file.
16          "arguments": [
17            "-c",
18            "temp=$(mktemp) && cat > $temp && ./vendor/bin/php-cs-fixer fix --quiet $temp 2>&1 && cat $temp"
19          ]
20        }
21      }
22    }
23  },
24    
25  "lsp": {
26    "intelephense": {
27      "files": {
28        
29        // Increase the max file size. Large projects easily cause composer autoload
30        // files to increase over 1 MB (default)
31        "maxSize": 3000000 
32      }
33    }
34  }
35}

Vim Mode

 1{
 2  // Enable Vim mode. You probably found this already if you care.
 3  "vim_mode": true,
 4
 5  // Use relative line numbers.
 6  "relative_line_numbers": true,
 7 
 8   // Allow f and t motions to extend across multiple lines.
 9  "use_multiline_find": true,
10
11  // Scroll the whole view if your cursor is less than 20 horizontal lines
12  // away from either part of your file viewport.
13  "vertical_scroll_margin": 20,
14}

Read more...