I spend a lot of my day working with Bash.  Often, I'll use
the "fc" command or the "<C-X><C-E>" shortcut in the shell
to open the last or current command in the editor to fix
something on the fly.  I have an autocmd in my vimrc
that sets the correct filetype, but I thought I should make
this a part of Vim so that others might use it.

Also, I updated the documentation for file patterns that
are seen as bash scripts (the docs seemed to be lagging).

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
From 3b3adda598f780968ac2c959e46cc723d92e1b9c Mon Sep 17 00:00:00 2001
From: Jason Franklin <[email protected]>
Date: Fri, 27 Jul 2018 08:37:16 -0400
Subject: [PATCH] Recognize bash-fc[-.]* files as Bash scripts

---
 runtime/doc/syntax.txt | 4 +++-
 runtime/filetype.vim   | 4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index 526231f70..b372e57bc 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -2879,7 +2879,9 @@ Vim attempts to determine which shell type is in use by specifying that
 various filenames are of specific types: >
 
     ksh : .kshrc* *.ksh
-    bash: .bashrc* bashrc bash.bashrc .bash_profile* *.bash
+    bash: .bashrc* bashrc bash.bashrc .bash[_-]profile* .bash[_-]logout*
+          .bash[_-]aliases* bash-fc[-.]* *.bash *.ebuild *.eclass PKGBUILD*
+          */{,.}bash[_-]completion{,.d,.sh}{,/*}
 <
 If none of these cases pertain, then the first line of the file is examined
 (ex. looking for /bin/sh  /bin/ksh  /bin/bash).  If the first line specifies a
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index 541f613ac..5c38ff18f 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -1462,8 +1462,8 @@ au BufNewFile,BufRead sgml.catalog*		call s:StarSetf('catalog')
 
 " Shell scripts (sh, ksh, bash, bash2, csh); Allow .profile_foo etc.
 " Gentoo ebuilds and Arch Linux PKGBUILDs are actually bash scripts
-au BufNewFile,BufRead .bashrc*,bashrc,bash.bashrc,.bash[_-]profile*,.bash[_-]logout*,.bash[_-]aliases*,*.bash,*/{,.}bash[_-]completion{,.d,.sh}{,/*},*.ebuild,*.eclass,PKGBUILD* call dist#ft#SetFileTypeSH("bash")
-au BufNewFile,BufRead .kshrc*,*.ksh call dist#ft#SetFileTypeSH("ksh")
+au BufNewFile,BufRead .bashrc*,bashrc,bash.bashrc,.bash[_-]profile*,.bash[_-]logout*,.bash[_-]aliases*,bash-fc[-.]*,*.bash,*/{,.}bash[_-]completion{,.d,.sh}{,/*},*.ebuild,*.eclass,PKGBUILD* call dist#ft#SetFileTypeSH('bash')
+au BufNewFile,BufRead .kshrc*,*.ksh call dist#ft#SetFileTypeSH('ksh')
 au BufNewFile,BufRead */etc/profile,.profile*,*.sh,*.env call dist#ft#SetFileTypeSH(getline(1))
 
 " Shell script (Arch Linux) or PHP file (Drupal)
-- 
2.17.1

Raspunde prin e-mail lui