GithubHelp home page GithubHelp logo

vim-hugo's Introduction

vim-hugo

This is a Vim plugin for web development with the static site generator Hugo.

HTML

  • syntax highlighting and identation is improved to support the HTML Go template syntax.
  • :h path includes default directories used by Hugo, like layouts/partials, which is convenient to start editing files with :h gf and friends.
  • matchit patterns are extended to support Go template.
  • A compiler plugin is made available so you can build your website from inside Vim with compiler hugo | make, and build errors will populate the quickfix list.

Markdown

Markdown syntax highlight is also improved to add support for shortcodes and YAML front matter.

Embedded languages inside the {{< highlight >}} shortcode will be highlighted. For example, to highlight Python code, add let g:markdown_fenced_languages=['python'] to your .vimrc or init.vim.

{{< highlight python >}}
import foo
{{< /highlight >}}

If you want to highlight JavaScript code with js as a shorthand, use let g:markdown_fenced_languages=['js=javascript']:

{{< highlight js >}}
import { bar } from './foo'
{{< /highlight >}}

This is reused from Vim's built-in syntax files for markdown, so it'll also be used for markdown code blocks.

vim-hugo's People

Contributors

phelipetls avatar sodapopcan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

vim-hugo's Issues

Not detecting files with only {{- end -}}

Hi. Thanks for this plugin.

It doesn't seem to identify some of my template files, apparently because I use {{- end -}} rather than {{ end }}.

Here's a quick fix that works for me:

diff --git a/ftdetect/html.vim b/ftdetect/html.vim
index 97561fa..6073d0a 100644
--- a/ftdetect/html.vim
+++ b/ftdetect/html.vim
@@ -3,6 +3,8 @@ function! s:DetectGoTemplate()
     set ft=htmlhugo
   elseif search('{{\s*end\s*}}')
     set ft=htmlhugo
+  elseif search('{{-\s*end\s*-}}')
+    set ft=htmlhugo
   elseif search('{{\s*$\k\+\s*:=')
     set ft=htmlhugo
   elseif search('{{\s*\.[A-Z]')

It may also need similar tweaks to some of those other tests.

Cheers,

Chris

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.