• Stars
    star
    271
  • Rank 151,717 (Top 3 %)
  • Language
    Vim Script
  • Created almost 9 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The best PostgreSQL plugin for Vim!

Vim PostgreSQL syntax plugin

pgsql syntax highlighting

This plugin provides syntax highlighting and auto-completion support for PostgreSQL version 9.6 or above and for some of its extensions, including:

Besides, syntax highlighting for any language may be activated inside functions (see below).

Installation

If your Vim supports packages (echo has('packages') prints 1), I strongly recommend that you use them. Just clone this repo inside pack/*/start, e.g.,

mkdir -p ~/.vim/pack/plugins/start
git clone https://github.com/lifepillar/pgsql.vim.git ~/.vim/pack/plugins/start/pgsql

Otherwise, if you don't have a preferred installation method, I recommend installing Pathogen, and then simply copy and paste:

cd ~/.vim/bundle
git clone https://github.com/lifepillar/pgsql.vim.git

Usage

For thorough documentation, see :h pgsql.txt.

Files with a .pgsql suffix are highlighted out of the box. If you want to highlight .sql files using this plugin by default, add this to your .vimrc (see :h ft_sql.txt):

let g:sql_type_default = 'pgsql'

Alternatively, after loading a .sql file use this command:

:SQLSetType pgsql.vim

To set the file type in new buffers use:

:let b:sql_type_override='pgsql' | set ft=sql

Code between $pgsql$ or $$ pairs is treated as PL/pgSQL and highlighted accordingly:

PL/pgSQL snippet

You may set g:pgsql_pl to a list of file types to be used in user-defined functions. For example, after setting:

let g:pgsql_pl = ['python']

code between $python$ pairs will be highlighted as Python:

PL/Pythonu snippet

Hacking

The syntax file is generated automatically. If you want to hack it, edit src/pgsql.sql, then execute:

cd ./src
DBUSER=<user> DBHOST=<hostname> make install

When DBUSER is omitted, postgres is assumed. When DBHOST is omitted, 127.0.0.1 is assumed.

The specified user must be a superuser, because the script will create a database called vim_pgsql_syntax and a few extensions that require admin privileges. It will then proceed to extract all the keywords. Feel free to browse the source scripts to see exactly what they do.

The above command will update syntax/pgsql.vim. Use make distclean to drop the database (or drop it manually).

The script has been tested in macOS, but it should work on any *nix system.

Acknowledgments

This plugin was originally based on code from space::tekk (and completely rewritten).

More Repositories

1

vim-solarized8

Optimized Solarized colorschemes. Best served with true-color terminals!
Vim Script
1,008
star
2

vim-colortemplate

The Toolkit for Vim Color Scheme Designers!
Vim Script
920
star
3

vim-mucomplete

Chained completion that works the way you want!
Vim Script
912
star
4

vim-gruvbox8

A simplified and optimized Gruvbox colorscheme for Vim
Vim Script
528
star
5

CSVKeychain

Import/export between Apple Keychain.app and plain CSV file.
AppleScript
349
star
6

vim-cheat40

A Vim cheat sheet that makes sense, inside Vim!
Vim Script
247
star
7

vim-wwdc16-theme

Colorful dark color scheme for Vim inspired by Apple's WWDC16 page
Vim Script
102
star
8

homebrew-appleii

Homebrew formulae for anything related to Apple I, Apple II, Apple ///, and Apple IIGS emulators.
Ruby
54
star
9

vim-outlaw

The wanted outliner!
Vim Script
46
star
10

vim-wwdc17-theme

Colorful light color scheme for Vim inspired by Apple's WWDC17 page
Vim Script
39
star
11

vimrc

My personal Vim configuration.
Vim Script
34
star
12

ASUnit

AppleScript unit testing framework (originally written by Nir Soffer)
AppleScript
34
star
13

csv2keepassxml

Convert CSV files into KeePass 2 XML files.
Ruby
33
star
14

ledger2html

Process Ledger output to produce HTML5 reports.
Ruby
27
star
15

vim-zeef

Because you need to filter, but you want to do it your way!
Vim Script
19
star
16

nanoc4-template

A template for a site built with Nanoc 4 (http://nanoc.ws/), especially suited for blogs.
Ruby
16
star
17

Ledger.tmbundle

TextMate support for Ledger 3 (http://www.ledger-cli.org)
Ruby
10
star
18

ASMake

An AppleScript build library
AppleScript
10
star
19

middleman-by-lifepillar

A Middleman Template [OBSOLETE]
Ruby
9
star
20

dotfiles

๐Ÿก My dotfilesโ€ฆ finally!
Shell
9
star
21

vim-formal-package

Vim package supporting various formal languages.
Vim Script
7
star
22

vim-devel

The workbench for modern Vim development
Vim Script
7
star
23

vim-keysound

Turn Vim into a typewriter!
Vim Script
6
star
24

vim8-colorschemes

Temporary repository for reworked Vim color schemes
Vim Script
4
star
25

vim-ucf

User completion functions for Vim
Vim Script
4
star
26

drupid

The not-so-smart Drupal updater that keeps your Drupal platform in sync with a Drush makefile!
Ruby
2
star
27

vim-context-metapost

Development line of the ConTeXt and MetaPost scripts distributed with Vim.
Vim Script
2
star
28

typewriter-sounds

Some typewriter sounds from various sources
2
star
29

awesome-data-not-collected-ios

1
star
30

sqlite3decimal-mirror

Mirror of https://chiselapp.com/user/lifepillar/repository/sqlite3decimal
C
1
star