Merge topic 'import-vim-syntax'
b4556b47
Help: Add release notes for 'vim-cmake-syntax' import25c01cf0
Aux: Install vim-cmake-syntax files with CMakee3ac68cf
Merge branch 'upstream-vim-cmake-syntax' into import-vim-syntax4a22c06e
vim-cmake-syntax 2016-08-16 (e782679c)f21a8235
Aux: Drop vim files prior to import of third-party version0966f1c5
Add script to update vim-cmake-syntax from upstream
This commit is contained in:
commit
a71ca1f0b3
|
@ -1,4 +1,4 @@
|
||||||
install(FILES cmake-help.vim cmake-indent.vim cmake-syntax.vim DESTINATION ${CMAKE_DATA_DIR}/editors/vim)
|
install(DIRECTORY vim/indent vim/syntax DESTINATION ${CMAKE_DATA_DIR}/editors/vim)
|
||||||
install(FILES cmake-mode.el DESTINATION ${CMAKE_DATA_DIR}/editors/emacs)
|
install(FILES cmake-mode.el DESTINATION ${CMAKE_DATA_DIR}/editors/emacs)
|
||||||
install(FILES cmake.m4 DESTINATION share/aclocal)
|
install(FILES cmake.m4 DESTINATION share/aclocal)
|
||||||
add_subdirectory (bash-completion)
|
add_subdirectory (bash-completion)
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
nmap ,hc :call OpenCmakeHelp()<CR>
|
|
||||||
|
|
||||||
function! OpenCmakeHelp()
|
|
||||||
let s = getline( '.' )
|
|
||||||
let i = col( '.' ) - 1
|
|
||||||
while i > 0 && strpart( s, i, 1 ) =~ '[A-Za-z0-9_]'
|
|
||||||
let i = i - 1
|
|
||||||
endwhile
|
|
||||||
while i < col('$') && strpart( s, i, 1 ) !~ '[A-Za-z0-9_]'
|
|
||||||
let i = i + 1
|
|
||||||
endwhile
|
|
||||||
let start = match( s, '[A-Za-z0-9_]\+', i )
|
|
||||||
let end = matchend( s, '[A-Za-z0-9_]\+', i )
|
|
||||||
let ident = strpart( s, start, end - start )
|
|
||||||
execute "vertical new"
|
|
||||||
execute "%!cmake --help-command ".ident
|
|
||||||
set nomodified
|
|
||||||
set readonly
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
autocmd BufRead,BufNewFile *.cmake,CMakeLists.txt,*.cmake.in nmap <F1> :call OpenCmakeHelp()<CR>
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,141 @@
|
||||||
|
#!/usr/bin/env perl
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my @variables;
|
||||||
|
my @commands;
|
||||||
|
my @properties;
|
||||||
|
my @modules;
|
||||||
|
my %keywords; # command => keyword-list
|
||||||
|
|
||||||
|
# unwanted upper-cases
|
||||||
|
my %unwanted = map { $_ => 1 } qw(VS CXX IDE NOTFOUND NO_ DFOO DBAR);
|
||||||
|
# cannot remove ALL - exists for add_custom_command
|
||||||
|
|
||||||
|
# control-statements
|
||||||
|
my %conditional = map { $_ => 1 } qw(if else elseif endif);
|
||||||
|
my %loop = map { $_ => 1 } qw(foreach while endforeach endwhile);
|
||||||
|
|
||||||
|
# decrecated
|
||||||
|
my %deprecated = map { $_ => 1 } qw(build_name exec_program export_library_dependencies install_files install_programs install_targets link_libraries make_directory output_required_files remove subdir_depends subdirs use_mangled_mesa utility_source variable_requires write_file);
|
||||||
|
|
||||||
|
# add some (popular) modules
|
||||||
|
push @modules, "ExternalProject";
|
||||||
|
|
||||||
|
# variables
|
||||||
|
open(CMAKE, "cmake --help-variable-list|") or die "could not run cmake";
|
||||||
|
while (<CMAKE>) {
|
||||||
|
chomp;
|
||||||
|
push @variables, $_;
|
||||||
|
}
|
||||||
|
close(CMAKE);
|
||||||
|
|
||||||
|
# transform all variables in a hash - to be able to use exists later on
|
||||||
|
my %variables = map { $_ => 1 } @variables;
|
||||||
|
|
||||||
|
# commands
|
||||||
|
open(CMAKE, "cmake --help-command-list|");
|
||||||
|
while (my $cmd = <CMAKE>) {
|
||||||
|
chomp $cmd;
|
||||||
|
|
||||||
|
push @commands, $cmd;
|
||||||
|
}
|
||||||
|
close(CMAKE);
|
||||||
|
|
||||||
|
# now generate a keyword-list per command
|
||||||
|
foreach my $cmd (@commands) {
|
||||||
|
my @word = extract_upper("cmake --help-command $cmd|");
|
||||||
|
|
||||||
|
next if scalar @word == 0;
|
||||||
|
|
||||||
|
$keywords{$cmd} = [ sort keys %{ { map { $_ => 1 } @word } } ];
|
||||||
|
}
|
||||||
|
|
||||||
|
# and now for modules
|
||||||
|
foreach my $mod (@modules) {
|
||||||
|
my @word = extract_upper("cmake --help-module $mod|");
|
||||||
|
|
||||||
|
next if scalar @word == 0;
|
||||||
|
|
||||||
|
$keywords{$mod} = [ sort keys %{ { map { $_ => 1 } @word } } ];
|
||||||
|
}
|
||||||
|
|
||||||
|
# and now for generator-expressions
|
||||||
|
my @generator_expr = extract_upper("cmake --help-manual cmake-generator-expressions |");
|
||||||
|
|
||||||
|
# properties
|
||||||
|
open(CMAKE, "cmake --help-property-list|");
|
||||||
|
while (<CMAKE>) {
|
||||||
|
chomp;
|
||||||
|
push @properties, $_;
|
||||||
|
}
|
||||||
|
close(CMAKE);
|
||||||
|
|
||||||
|
# generate cmake.vim
|
||||||
|
open(IN, "<cmake.vim.in") or die "could not read cmake.vim.in";
|
||||||
|
open(OUT, ">syntax/cmake.vim") or die "could not write to syntax/cmake.vim";
|
||||||
|
|
||||||
|
my @keyword_hi;
|
||||||
|
|
||||||
|
while(<IN>)
|
||||||
|
{
|
||||||
|
if (m/\@([A-Z0-9_]+)\@/) { # match for @SOMETHING@
|
||||||
|
if ($1 eq "COMMAND_LIST") {
|
||||||
|
# do not include "special" commands in this list
|
||||||
|
my @tmp = grep { ! exists $conditional{$_} and
|
||||||
|
! exists $loop{$_} and
|
||||||
|
! exists $deprecated{$_} } @commands;
|
||||||
|
print OUT " " x 12 , "\\ ", join(" ", @tmp), "\n";
|
||||||
|
} elsif ($1 eq "VARIABLE_LIST") {
|
||||||
|
print OUT " " x 12 , "\\ ", join(" ", @variables), "\n";
|
||||||
|
} elsif ($1 eq "MODULES") {
|
||||||
|
print OUT " " x 12 , "\\ ", join("\n", @modules), "\n";
|
||||||
|
} elsif ($1 eq "GENERATOR_EXPRESSIONS") {
|
||||||
|
print OUT " " x 12 , "\\ ", join(" ", @generator_expr), "\n";
|
||||||
|
} elsif ($1 eq "CONDITIONALS") {
|
||||||
|
print OUT " " x 12 , "\\ ", join(" ", sort keys %conditional), "\n";
|
||||||
|
} elsif ($1 eq "LOOPS") {
|
||||||
|
print OUT " " x 12 , "\\ ", join(" ", sort keys %loop), "\n";
|
||||||
|
} elsif ($1 eq "DEPRECATED") {
|
||||||
|
print OUT " " x 12 , "\\ ", join(" ", sort keys %deprecated), "\n";
|
||||||
|
} elsif ($1 eq "KEYWORDS") {
|
||||||
|
foreach my $k (sort keys %keywords) {
|
||||||
|
print OUT "syn keyword cmakeKW$k\n";
|
||||||
|
print OUT " " x 12, "\\ ", join(" ", @{$keywords{$k}}), "\n";
|
||||||
|
print OUT " " x 12, "\\ contained\n";
|
||||||
|
print OUT "\n";
|
||||||
|
push @keyword_hi, "hi def link cmakeKW$k ModeMsg";
|
||||||
|
}
|
||||||
|
} elsif ($1 eq "KEYWORDS_HIGHLIGHT") {
|
||||||
|
print OUT join("\n", @keyword_hi), "\n";
|
||||||
|
} else {
|
||||||
|
print "ERROR do not know how to replace $1\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print OUT $_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close(IN);
|
||||||
|
close(OUT);
|
||||||
|
|
||||||
|
sub extract_upper
|
||||||
|
{
|
||||||
|
my $input = shift;
|
||||||
|
my @word;
|
||||||
|
|
||||||
|
open(KW, $input);
|
||||||
|
while (<KW>) {
|
||||||
|
|
||||||
|
foreach my $w (m/\b([A-Z_]{2,})\b/g) {
|
||||||
|
next
|
||||||
|
if exists $variables{$w} or # skip if it is a variable
|
||||||
|
exists $unwanted{$w}; # skip if not wanted
|
||||||
|
|
||||||
|
push @word, $w;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close(KW);
|
||||||
|
|
||||||
|
return @word;
|
||||||
|
}
|
|
@ -1,13 +1,3 @@
|
||||||
" =============================================================================
|
|
||||||
"
|
|
||||||
" Program: CMake - Cross-Platform Makefile Generator
|
|
||||||
" Module: $RCSfile$
|
|
||||||
" Language: VIM
|
|
||||||
" Date: $Date$
|
|
||||||
" Version: $Revision$
|
|
||||||
"
|
|
||||||
" =============================================================================
|
|
||||||
|
|
||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: CMake (ft=cmake)
|
" Language: CMake (ft=cmake)
|
||||||
" Author: Andy Cedilnik <andy.cedilnik@kitware.com>
|
" Author: Andy Cedilnik <andy.cedilnik@kitware.com>
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,11 @@
|
||||||
|
vim-cmake-syntax
|
||||||
|
----------------
|
||||||
|
|
||||||
|
* Vim support files ``indent/cmake.vim`` and ``syntax/cmake.vim``
|
||||||
|
from the `vim-cmake-syntax`_ project are now distributed with CMake.
|
||||||
|
|
||||||
|
* Vim support files ``cmake-indent.vim``, ``cmake-syntax.vim``, and
|
||||||
|
``cmake-help.vim`` have been removed in favor of the files now provided
|
||||||
|
from the `vim-cmake-syntax`_ project.
|
||||||
|
|
||||||
|
.. _`vim-cmake-syntax`: https://github.com/pboettch/vim-cmake-syntax
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -x
|
||||||
|
shopt -s dotglob
|
||||||
|
|
||||||
|
readonly name="vim-cmake-syntax"
|
||||||
|
readonly ownership="vim-cmake-syntax upstream <kwrobot@kitware.com>"
|
||||||
|
readonly subtree="Auxiliary/vim"
|
||||||
|
readonly repo="https://github.com/pboettch/vim-cmake-syntax.git"
|
||||||
|
readonly tag="master"
|
||||||
|
readonly shortlog=true
|
||||||
|
readonly paths="
|
||||||
|
indent
|
||||||
|
syntax
|
||||||
|
cmake.vim.in
|
||||||
|
extract-upper-case.pl
|
||||||
|
"
|
||||||
|
|
||||||
|
extract_source () {
|
||||||
|
git_archive
|
||||||
|
}
|
||||||
|
|
||||||
|
. "${BASH_SOURCE%/*}/update-third-party.bash"
|
Loading…
Reference in New Issue