Top Related Projects
Markdown Vim Mode
Vim script for text filtering and alignment
Quick Overview
vim-markdown is a Vim plugin that provides syntax highlighting, folding, and other features for Markdown files. It enhances the editing experience for Markdown documents within Vim, offering improved readability and navigation.
Pros
- Comprehensive syntax highlighting for Markdown elements
- Folding support for headers and code blocks
- Automatic detection of Markdown file types
- Integrates well with other Vim plugins and workflows
Cons
- May conflict with other Markdown-related plugins
- Some users report occasional performance issues with large files
- Limited customization options compared to more complex Markdown plugins
- Requires manual installation and configuration for some features
Code Examples
- Enabling the plugin in your .vimrc file:
" Add vim-markdown to your plugin manager (e.g., vim-plug)
Plug 'tpope/vim-markdown'
" Enable folding
let g:markdown_folding = 1
- Setting custom file extensions for Markdown:
" Recognize additional file extensions as Markdown
autocmd BufNewFile,BufReadPost *.md,*.markdown set filetype=markdown
- Configuring syntax concealing:
" Enable syntax concealing
set conceallevel=2
" Disable syntax concealing for specific elements
let g:markdown_syntax_conceal = 0
Getting Started
To get started with vim-markdown:
- Install the plugin using your preferred Vim plugin manager (e.g., vim-plug, Vundle).
- Add the following to your .vimrc file:
" Add vim-markdown to your plugin manager
Plug 'tpope/vim-markdown'
" Enable folding (optional)
let g:markdown_folding = 1
" Set Markdown file extensions (optional)
autocmd BufNewFile,BufReadPost *.md,*.markdown set filetype=markdown
" Reload Vim configuration
:source $MYVIMRC
- Open a Markdown file in Vim, and you should see improved syntax highlighting and folding.
Competitor Comparisons
Markdown Vim Mode
Pros of vim-markdown (preservim)
- More comprehensive feature set, including syntax highlighting for code blocks and LaTeX math
- Active development with frequent updates and bug fixes
- Extensive configuration options for customizing behavior
Cons of vim-markdown (preservim)
- Potentially slower performance due to more complex codebase
- May have conflicts with other plugins due to its extensive feature set
- Steeper learning curve for users who prefer simpler functionality
Code Comparison
vim-markdown (tpope):
if !exists('g:markdown_fenced_languages')
let g:markdown_fenced_languages = []
endif
let s:done_include = {}
vim-markdown (preservim):
if !exists('g:vim_markdown_fenced_languages')
let g:vim_markdown_fenced_languages = []
endif
let s:done_include = {}
for s:type in g:vim_markdown_fenced_languages
if has_key(s:done_include, matchstr(s:type,'[^=]*'))
continue
endif
The preservim version offers more detailed configuration for fenced code blocks, allowing for greater customization of syntax highlighting. However, this comes at the cost of increased complexity in the codebase.
Vim script for text filtering and alignment
Pros of Tabular
- Provides powerful text alignment functionality for various file types, not limited to Markdown
- Offers more flexibility in aligning text based on patterns and delimiters
- Can be used for creating tables and aligning code in multiple languages
Cons of Tabular
- Lacks specific Markdown syntax highlighting and folding features
- Doesn't provide Markdown-specific commands or mappings
- May require more manual configuration for Markdown-specific tasks
Code Comparison
Tabular:
:Tabularize /|
vim-markdown:
:TableFormat
Key Differences
- Tabular is a general-purpose alignment tool, while vim-markdown is specifically designed for Markdown files
- vim-markdown offers Markdown-specific features like syntax highlighting, folding, and table formatting
- Tabular provides more advanced alignment options but requires manual setup for Markdown-specific tasks
Use Cases
- Choose Tabular for general text alignment needs across various file types
- Opt for vim-markdown when working primarily with Markdown files and requiring specific Markdown features
Community and Maintenance
- Both projects are well-established and have active user bases
- vim-markdown is maintained by Tim Pope, a renowned Vim plugin developer
- Tabular has a broader application scope, potentially attracting a more diverse user community
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Vim Markdown runtime files
This is the development version of Vim's included syntax highlighting and filetype plugins for Markdown. Generally you don't need to install these if you are running a recent version of Vim.
If you want to enable fenced code block syntax highlighting in your markdown
documents you can enable it in your .vimrc
like so:
let g:markdown_fenced_languages = ['html', 'python', 'bash=sh']
To disable markdown syntax concealing add the following to your vimrc:
let g:markdown_syntax_conceal = 0
Syntax highlight is synchronized in 50 lines. It may cause collapsed highlighting at large fenced code block. In the case, please set larger value in your vimrc:
let g:markdown_minlines = 100
Note that setting too large value may cause bad performance on highlighting.
License
Copyright © Tim Pope. Distributed under the same terms as Vim itself.
See :help license
.
Top Related Projects
Markdown Vim Mode
Vim script for text filtering and alignment
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot