From 4ef38f411ec198328b5c18ba4b56b1499e4bc798 Mon Sep 17 00:00:00 2001 From: Urbain Vaes Date: Wed, 7 Jun 2017 13:04:32 +0100 Subject: Add script to facilitate qutebrowser navigation --- vim/.vim/compiler/gmsh.vim | 12 ++++++++++ vim/.vim/ftplugin/gmsh.vim | 1 + vim/.vim/indent/gmsh.vim | 59 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 vim/.vim/compiler/gmsh.vim create mode 100644 vim/.vim/ftplugin/gmsh.vim create mode 100644 vim/.vim/indent/gmsh.vim (limited to 'vim/.vim') diff --git a/vim/.vim/compiler/gmsh.vim b/vim/.vim/compiler/gmsh.vim new file mode 100644 index 0000000..70148e8 --- /dev/null +++ b/vim/.vim/compiler/gmsh.vim @@ -0,0 +1,12 @@ +if exists("current_compiler") + finish +endif + +let current_compiler = "gmsh" + +if exists(":CompilerSet") != 2 + command -nargs=* CompilerSet setlocal +endif + +setlocal errorformat=Error\ \ \ :\ \'%f\'\\,\ line\ %l\ :\ %m +setlocal makeprg=gmsh\ %\ -\\|&\ grep\ Error diff --git a/vim/.vim/ftplugin/gmsh.vim b/vim/.vim/ftplugin/gmsh.vim new file mode 100644 index 0000000..ec58378 --- /dev/null +++ b/vim/.vim/ftplugin/gmsh.vim @@ -0,0 +1 @@ +compiler gmsh diff --git a/vim/.vim/indent/gmsh.vim b/vim/.vim/indent/gmsh.vim new file mode 100644 index 0000000..845b668 --- /dev/null +++ b/vim/.vim/indent/gmsh.vim @@ -0,0 +1,59 @@ +" Vim indent file + +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal indentexpr=GetGeoIndent() +setlocal indentkeys& +setlocal autoindent +setlocal commentstring=//%s + +if exists("*GetGeoIndent") + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +let s:skip_syntax = '\%(Comment\|String\)$' + +function! GetGeoIndent() + + let lnum = prevnonblank(v:lnum - 1) + + if lnum == 0 + return 0 + endif + + let ind = indent(lnum) + let last_line = getline(lnum) + let current_line = getline(v:lnum) + + if last_line =~ '\(^\/\/\|^\/\*\)' + return ind + endif + + if last_line =~ '\(\\|\\|\\)' + let ind += &shiftwidth + endif + + if last_line =~ '\({[^}]*$\)' + let ind += &shiftwidth + endif + + if current_line =~ '\(^[^{]*}\)' + let ind -= &shiftwidth + endif + + if current_line =~ '\(\\|\\|\\)$' + let ind -= &shiftwidth + endif + + return ind + +endfunction + +let &cpo = s:cpo_save +unlet s:cpo_save -- cgit v1.2.3