Must-change Zed Settings

Must-change Zed Settings

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

Roman Zipp, October 10th, 2024

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

{
  // First things first, you can set the theme.mode to system in order to
  // automatically change between dark & light themes based on your system theme.
  "theme": {
    "mode": "system",
    "light": "Github Light (custom)",
    "dark": "Github Dark Dimmed (custom)"
  },
    
  // Remove the < > buttons from the tab bar
  "tab_bar": {
    "show": true,
    "show_nav_history_buttons": false
  },
    
  // Show file type icons in the tab bar. Also color them according to the
  // git status.
  "tabs": {
    "file_icons": true,
    "git_status": true
  },
    
  // Decrease the horizontal indent size of files & folders in the project
  // panel to avoid horizontal scrolling
  "project_panel": {
    "indent_size": 16
  },
    
  // Set a preferred line lenth, showing a vertical gutter bar
  "preferred_line_length": 160,
    
  // Set global tab size to 4, you could also make this language-specific but 4 
  // spaces works for me
  "tab_size": 4,
}

Language specific configuration

Markdown

{
  "languages": {
    "Markdown": {
      
      // Wrap text according to the previously defined preferred line length.
      "soft_wrap": "preferred_line_length",
        
      // do not remove any trailing whitespace since line breaks in
      // lists (without adding a new punctuation) rely on whitespaces.
      "remove_trailing_whitespace_on_save": false
    }
  }
}

LaTeX

{
  "languages": {
    "LaTeX": {
      
      // Disable AI completions, it's latex...
      "show_inline_completions": false,
        
      // Same as in Markdown
      "soft_wrap": "preferred_line_length",
        
      // Just a matter of linking. I like more compact fluent text-
      "preferred_line_length": 110
    }
  }
}

PHP

{
  "languages": {
    "PHP": {

      // In my experience, the Intelephense LS works better then phpactor.
      // Adding a leading ! will exclude the entry.
      "language_servers": ["intelephense", "!phpactor"],

      "format_on_save": "on",
      "formatter": {
        "external": {
          "command": "bash",
            
          // Use the program STDIN file contents to call PHP-CS-Fixer. You should
          // move this part in the project-specific settings file.
          "arguments": [
            "-c",
            "temp=$(mktemp) && cat > $temp && ./vendor/bin/php-cs-fixer fix --quiet $temp 2>&1 && cat $temp"
          ]
        }
      }
    }
  },
    
  "lsp": {
    "intelephense": {
      "files": {
        
        // Increase the max file size. Large projects easily cause composer autoload
        // files to increase over 1 MB (default)
        "maxSize": 3000000 
      }
    }
  }
}

Vim Mode

{
  // Enable Vim mode. You probably found this already if you care.
  "vim_mode": true,

  // Use relative line numbers.
  "relative_line_numbers": true,
 
   // Allow f and t motions to extend across multiple lines.
  "use_multiline_find": true,

  // Scroll the whole view if your cursor is less than 20 horizontal lines
  // away from either part of your file viewport.
  "vertical_scroll_margin": 20,
}