mirror of
https://github.com/amix/vimrc
synced 2025-02-28 14:12:51 +08:00
Removing not used bundles
This commit is contained in:
parent
7801140089
commit
27189d36ea
@ -1,7 +0,0 @@
|
||||
# nginx syntax files for Vim.
|
||||
|
||||
Copied into a directory to play well with pathogen.
|
||||
|
||||
* Original: http://www.vim.org/scripts/script.php?script_id=1886
|
||||
|
||||
|
@ -1,2 +0,0 @@
|
||||
au BufRead,BufNewFile /etc/nginx/* set ft=nginx
|
||||
au BufRead,BufNewFile /usr/local/nginx/conf/* set ft=nginx
|
@ -1,9 +0,0 @@
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
" cindent actually works for nginx' simple file structure
|
||||
setlocal cindent
|
||||
" Just make sure that the comments are not reset as defs would be.
|
||||
setlocal cinkeys-=0#
|
@ -1,664 +0,0 @@
|
||||
" Vim syntax file
|
||||
" Language: nginx.conf
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
end
|
||||
|
||||
setlocal iskeyword+=.
|
||||
setlocal iskeyword+=/
|
||||
setlocal iskeyword+=:
|
||||
|
||||
syn match ngxVariable '\$\w\w*'
|
||||
syn match ngxVariableBlock '\$\w\w*' contained
|
||||
syn match ngxVariableString '\$\w\w*' contained
|
||||
syn region ngxBlock start=+^+ end=+{+ contains=ngxComment,ngxDirectiveBlock,ngxVariableBlock,ngxString oneline
|
||||
syn region ngxString start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=ngxVariableString oneline
|
||||
syn region ngxString start=+'+ end=+'+ skip=+\\\\\|\\'+ contains=ngxVariableString oneline
|
||||
syn match ngxComment ' *#.*$'
|
||||
|
||||
syn keyword ngxBoolean on
|
||||
syn keyword ngxBoolean off
|
||||
|
||||
syn keyword ngxDirectiveBlock http contained
|
||||
syn keyword ngxDirectiveBlock mail contained
|
||||
syn keyword ngxDirectiveBlock events contained
|
||||
syn keyword ngxDirectiveBlock server contained
|
||||
syn keyword ngxDirectiveBlock types contained
|
||||
syn keyword ngxDirectiveBlock location contained
|
||||
syn keyword ngxDirectiveBlock upstream contained
|
||||
syn keyword ngxDirectiveBlock charset_map contained
|
||||
syn keyword ngxDirectiveBlock limit_except contained
|
||||
syn keyword ngxDirectiveBlock if contained
|
||||
syn keyword ngxDirectiveBlock geo contained
|
||||
syn keyword ngxDirectiveBlock map contained
|
||||
|
||||
syn keyword ngxDirectiveImportant include
|
||||
syn keyword ngxDirectiveImportant root
|
||||
syn keyword ngxDirectiveImportant server
|
||||
syn keyword ngxDirectiveImportant server_name
|
||||
syn keyword ngxDirectiveImportant listen
|
||||
syn keyword ngxDirectiveImportant internal
|
||||
syn keyword ngxDirectiveImportant proxy_pass
|
||||
syn keyword ngxDirectiveImportant memcached_pass
|
||||
syn keyword ngxDirectiveImportant fastcgi_pass
|
||||
syn keyword ngxDirectiveImportant try_files
|
||||
|
||||
syn keyword ngxDirectiveControl break
|
||||
syn keyword ngxDirectiveControl return
|
||||
syn keyword ngxDirectiveControl rewrite
|
||||
syn keyword ngxDirectiveControl set
|
||||
|
||||
syn keyword ngxDirectiveError error_page
|
||||
syn keyword ngxDirectiveError post_action
|
||||
|
||||
syn keyword ngxDirectiveDeprecated connections
|
||||
syn keyword ngxDirectiveDeprecated imap
|
||||
syn keyword ngxDirectiveDeprecated open_file_cache_retest
|
||||
syn keyword ngxDirectiveDeprecated optimize_server_names
|
||||
syn keyword ngxDirectiveDeprecated satisfy_any
|
||||
|
||||
syn keyword ngxDirective accept_mutex
|
||||
syn keyword ngxDirective accept_mutex_delay
|
||||
syn keyword ngxDirective access_log
|
||||
syn keyword ngxDirective add_after_body
|
||||
syn keyword ngxDirective add_before_body
|
||||
syn keyword ngxDirective add_header
|
||||
syn keyword ngxDirective addition_types
|
||||
syn keyword ngxDirective aio
|
||||
syn keyword ngxDirective alias
|
||||
syn keyword ngxDirective allow
|
||||
syn keyword ngxDirective ancient_browser
|
||||
syn keyword ngxDirective ancient_browser_value
|
||||
syn keyword ngxDirective auth_basic
|
||||
syn keyword ngxDirective auth_basic_user_file
|
||||
syn keyword ngxDirective auth_http
|
||||
syn keyword ngxDirective auth_http_header
|
||||
syn keyword ngxDirective auth_http_timeout
|
||||
syn keyword ngxDirective autoindex
|
||||
syn keyword ngxDirective autoindex_exact_size
|
||||
syn keyword ngxDirective autoindex_localtime
|
||||
syn keyword ngxDirective charset
|
||||
syn keyword ngxDirective charset_types
|
||||
syn keyword ngxDirective client_body_buffer_size
|
||||
syn keyword ngxDirective client_body_in_file_only
|
||||
syn keyword ngxDirective client_body_in_single_buffer
|
||||
syn keyword ngxDirective client_body_temp_path
|
||||
syn keyword ngxDirective client_body_timeout
|
||||
syn keyword ngxDirective client_header_buffer_size
|
||||
syn keyword ngxDirective client_header_timeout
|
||||
syn keyword ngxDirective client_max_body_size
|
||||
syn keyword ngxDirective connection_pool_size
|
||||
syn keyword ngxDirective create_full_put_path
|
||||
syn keyword ngxDirective daemon
|
||||
syn keyword ngxDirective dav_access
|
||||
syn keyword ngxDirective dav_methods
|
||||
syn keyword ngxDirective debug_connection
|
||||
syn keyword ngxDirective debug_points
|
||||
syn keyword ngxDirective default_type
|
||||
syn keyword ngxDirective degradation
|
||||
syn keyword ngxDirective degrade
|
||||
syn keyword ngxDirective deny
|
||||
syn keyword ngxDirective devpoll_changes
|
||||
syn keyword ngxDirective devpoll_events
|
||||
syn keyword ngxDirective directio
|
||||
syn keyword ngxDirective directio_alignment
|
||||
syn keyword ngxDirective empty_gif
|
||||
syn keyword ngxDirective env
|
||||
syn keyword ngxDirective epoll_events
|
||||
syn keyword ngxDirective error_log
|
||||
syn keyword ngxDirective eventport_events
|
||||
syn keyword ngxDirective expires
|
||||
syn keyword ngxDirective fastcgi_bind
|
||||
syn keyword ngxDirective fastcgi_buffer_size
|
||||
syn keyword ngxDirective fastcgi_buffers
|
||||
syn keyword ngxDirective fastcgi_busy_buffers_size
|
||||
syn keyword ngxDirective fastcgi_cache
|
||||
syn keyword ngxDirective fastcgi_cache_key
|
||||
syn keyword ngxDirective fastcgi_cache_methods
|
||||
syn keyword ngxDirective fastcgi_cache_min_uses
|
||||
syn keyword ngxDirective fastcgi_cache_path
|
||||
syn keyword ngxDirective fastcgi_cache_use_stale
|
||||
syn keyword ngxDirective fastcgi_cache_valid
|
||||
syn keyword ngxDirective fastcgi_catch_stderr
|
||||
syn keyword ngxDirective fastcgi_connect_timeout
|
||||
syn keyword ngxDirective fastcgi_hide_header
|
||||
syn keyword ngxDirective fastcgi_ignore_client_abort
|
||||
syn keyword ngxDirective fastcgi_ignore_headers
|
||||
syn keyword ngxDirective fastcgi_index
|
||||
syn keyword ngxDirective fastcgi_intercept_errors
|
||||
syn keyword ngxDirective fastcgi_max_temp_file_size
|
||||
syn keyword ngxDirective fastcgi_next_upstream
|
||||
syn keyword ngxDirective fastcgi_param
|
||||
syn keyword ngxDirective fastcgi_pass_header
|
||||
syn keyword ngxDirective fastcgi_pass_request_body
|
||||
syn keyword ngxDirective fastcgi_pass_request_headers
|
||||
syn keyword ngxDirective fastcgi_read_timeout
|
||||
syn keyword ngxDirective fastcgi_send_lowat
|
||||
syn keyword ngxDirective fastcgi_send_timeout
|
||||
syn keyword ngxDirective fastcgi_split_path_info
|
||||
syn keyword ngxDirective fastcgi_store
|
||||
syn keyword ngxDirective fastcgi_store_access
|
||||
syn keyword ngxDirective fastcgi_temp_file_write_size
|
||||
syn keyword ngxDirective fastcgi_temp_path
|
||||
syn keyword ngxDirective fastcgi_upstream_fail_timeout
|
||||
syn keyword ngxDirective fastcgi_upstream_max_fails
|
||||
syn keyword ngxDirective flv
|
||||
syn keyword ngxDirective geoip_city
|
||||
syn keyword ngxDirective geoip_country
|
||||
syn keyword ngxDirective google_perftools_profiles
|
||||
syn keyword ngxDirective gzip
|
||||
syn keyword ngxDirective gzip_buffers
|
||||
syn keyword ngxDirective gzip_comp_level
|
||||
syn keyword ngxDirective gzip_disable
|
||||
syn keyword ngxDirective gzip_hash
|
||||
syn keyword ngxDirective gzip_http_version
|
||||
syn keyword ngxDirective gzip_min_length
|
||||
syn keyword ngxDirective gzip_no_buffer
|
||||
syn keyword ngxDirective gzip_proxied
|
||||
syn keyword ngxDirective gzip_static
|
||||
syn keyword ngxDirective gzip_types
|
||||
syn keyword ngxDirective gzip_vary
|
||||
syn keyword ngxDirective gzip_window
|
||||
syn keyword ngxDirective if_modified_since
|
||||
syn keyword ngxDirective ignore_invalid_headers
|
||||
syn keyword ngxDirective image_filter
|
||||
syn keyword ngxDirective image_filter_buffer
|
||||
syn keyword ngxDirective image_filter_jpeg_quality
|
||||
syn keyword ngxDirective image_filter_transparency
|
||||
syn keyword ngxDirective imap_auth
|
||||
syn keyword ngxDirective imap_capabilities
|
||||
syn keyword ngxDirective imap_client_buffer
|
||||
syn keyword ngxDirective index
|
||||
syn keyword ngxDirective ip_hash
|
||||
syn keyword ngxDirective keepalive_requests
|
||||
syn keyword ngxDirective keepalive_timeout
|
||||
syn keyword ngxDirective kqueue_changes
|
||||
syn keyword ngxDirective kqueue_events
|
||||
syn keyword ngxDirective large_client_header_buffers
|
||||
syn keyword ngxDirective limit_conn
|
||||
syn keyword ngxDirective limit_conn_log_level
|
||||
syn keyword ngxDirective limit_rate
|
||||
syn keyword ngxDirective limit_rate_after
|
||||
syn keyword ngxDirective limit_req
|
||||
syn keyword ngxDirective limit_req_log_level
|
||||
syn keyword ngxDirective limit_req_zone
|
||||
syn keyword ngxDirective limit_zone
|
||||
syn keyword ngxDirective lingering_time
|
||||
syn keyword ngxDirective lingering_timeout
|
||||
syn keyword ngxDirective lock_file
|
||||
syn keyword ngxDirective log_format
|
||||
syn keyword ngxDirective log_not_found
|
||||
syn keyword ngxDirective log_subrequest
|
||||
syn keyword ngxDirective map_hash_bucket_size
|
||||
syn keyword ngxDirective map_hash_max_size
|
||||
syn keyword ngxDirective master_process
|
||||
syn keyword ngxDirective memcached_bind
|
||||
syn keyword ngxDirective memcached_buffer_size
|
||||
syn keyword ngxDirective memcached_connect_timeout
|
||||
syn keyword ngxDirective memcached_next_upstream
|
||||
syn keyword ngxDirective memcached_read_timeout
|
||||
syn keyword ngxDirective memcached_send_timeout
|
||||
syn keyword ngxDirective memcached_upstream_fail_timeout
|
||||
syn keyword ngxDirective memcached_upstream_max_fails
|
||||
syn keyword ngxDirective merge_slashes
|
||||
syn keyword ngxDirective min_delete_depth
|
||||
syn keyword ngxDirective modern_browser
|
||||
syn keyword ngxDirective modern_browser_value
|
||||
syn keyword ngxDirective msie_padding
|
||||
syn keyword ngxDirective msie_refresh
|
||||
syn keyword ngxDirective multi_accept
|
||||
syn keyword ngxDirective open_file_cache
|
||||
syn keyword ngxDirective open_file_cache_errors
|
||||
syn keyword ngxDirective open_file_cache_events
|
||||
syn keyword ngxDirective open_file_cache_min_uses
|
||||
syn keyword ngxDirective open_file_cache_valid
|
||||
syn keyword ngxDirective open_log_file_cache
|
||||
syn keyword ngxDirective output_buffers
|
||||
syn keyword ngxDirective override_charset
|
||||
syn keyword ngxDirective perl
|
||||
syn keyword ngxDirective perl_modules
|
||||
syn keyword ngxDirective perl_require
|
||||
syn keyword ngxDirective perl_set
|
||||
syn keyword ngxDirective pid
|
||||
syn keyword ngxDirective pop3_auth
|
||||
syn keyword ngxDirective pop3_capabilities
|
||||
syn keyword ngxDirective port_in_redirect
|
||||
syn keyword ngxDirective postpone_gzipping
|
||||
syn keyword ngxDirective postpone_output
|
||||
syn keyword ngxDirective protocol
|
||||
syn keyword ngxDirective proxy
|
||||
syn keyword ngxDirective proxy_bind
|
||||
syn keyword ngxDirective proxy_buffer
|
||||
syn keyword ngxDirective proxy_buffer_size
|
||||
syn keyword ngxDirective proxy_buffering
|
||||
syn keyword ngxDirective proxy_buffers
|
||||
syn keyword ngxDirective proxy_busy_buffers_size
|
||||
syn keyword ngxDirective proxy_cache
|
||||
syn keyword ngxDirective proxy_cache_key
|
||||
syn keyword ngxDirective proxy_cache_methods
|
||||
syn keyword ngxDirective proxy_cache_min_uses
|
||||
syn keyword ngxDirective proxy_cache_path
|
||||
syn keyword ngxDirective proxy_cache_use_stale
|
||||
syn keyword ngxDirective proxy_cache_valid
|
||||
syn keyword ngxDirective proxy_connect_timeout
|
||||
syn keyword ngxDirective proxy_headers_hash_bucket_size
|
||||
syn keyword ngxDirective proxy_headers_hash_max_size
|
||||
syn keyword ngxDirective proxy_hide_header
|
||||
syn keyword ngxDirective proxy_ignore_client_abort
|
||||
syn keyword ngxDirective proxy_ignore_headers
|
||||
syn keyword ngxDirective proxy_intercept_errors
|
||||
syn keyword ngxDirective proxy_max_temp_file_size
|
||||
syn keyword ngxDirective proxy_method
|
||||
syn keyword ngxDirective proxy_next_upstream
|
||||
syn keyword ngxDirective proxy_pass_error_message
|
||||
syn keyword ngxDirective proxy_pass_header
|
||||
syn keyword ngxDirective proxy_pass_request_body
|
||||
syn keyword ngxDirective proxy_pass_request_headers
|
||||
syn keyword ngxDirective proxy_read_timeout
|
||||
syn keyword ngxDirective proxy_redirect
|
||||
syn keyword ngxDirective proxy_send_lowat
|
||||
syn keyword ngxDirective proxy_send_timeout
|
||||
syn keyword ngxDirective proxy_set_body
|
||||
syn keyword ngxDirective proxy_set_header
|
||||
syn keyword ngxDirective proxy_ssl_session_reuse
|
||||
syn keyword ngxDirective proxy_store
|
||||
syn keyword ngxDirective proxy_store_access
|
||||
syn keyword ngxDirective proxy_temp_file_write_size
|
||||
syn keyword ngxDirective proxy_temp_path
|
||||
syn keyword ngxDirective proxy_timeout
|
||||
syn keyword ngxDirective proxy_upstream_fail_timeout
|
||||
syn keyword ngxDirective proxy_upstream_max_fails
|
||||
syn keyword ngxDirective random_index
|
||||
syn keyword ngxDirective read_ahead
|
||||
syn keyword ngxDirective real_ip_header
|
||||
syn keyword ngxDirective recursive_error_pages
|
||||
syn keyword ngxDirective request_pool_size
|
||||
syn keyword ngxDirective reset_timedout_connection
|
||||
syn keyword ngxDirective resolver
|
||||
syn keyword ngxDirective resolver_timeout
|
||||
syn keyword ngxDirective rewrite_log
|
||||
syn keyword ngxDirective rtsig_overflow_events
|
||||
syn keyword ngxDirective rtsig_overflow_test
|
||||
syn keyword ngxDirective rtsig_overflow_threshold
|
||||
syn keyword ngxDirective rtsig_signo
|
||||
syn keyword ngxDirective satisfy
|
||||
syn keyword ngxDirective secure_link_secret
|
||||
syn keyword ngxDirective send_lowat
|
||||
syn keyword ngxDirective send_timeout
|
||||
syn keyword ngxDirective sendfile
|
||||
syn keyword ngxDirective sendfile_max_chunk
|
||||
syn keyword ngxDirective server_name_in_redirect
|
||||
syn keyword ngxDirective server_names_hash_bucket_size
|
||||
syn keyword ngxDirective server_names_hash_max_size
|
||||
syn keyword ngxDirective server_tokens
|
||||
syn keyword ngxDirective set_real_ip_from
|
||||
syn keyword ngxDirective smtp_auth
|
||||
syn keyword ngxDirective smtp_capabilities
|
||||
syn keyword ngxDirective smtp_client_buffer
|
||||
syn keyword ngxDirective smtp_greeting_delay
|
||||
syn keyword ngxDirective so_keepalive
|
||||
syn keyword ngxDirective source_charset
|
||||
syn keyword ngxDirective ssi
|
||||
syn keyword ngxDirective ssi_ignore_recycled_buffers
|
||||
syn keyword ngxDirective ssi_min_file_chunk
|
||||
syn keyword ngxDirective ssi_silent_errors
|
||||
syn keyword ngxDirective ssi_types
|
||||
syn keyword ngxDirective ssi_value_length
|
||||
syn keyword ngxDirective ssl
|
||||
syn keyword ngxDirective ssl_certificate
|
||||
syn keyword ngxDirective ssl_certificate_key
|
||||
syn keyword ngxDirective ssl_ciphers
|
||||
syn keyword ngxDirective ssl_client_certificate
|
||||
syn keyword ngxDirective ssl_crl
|
||||
syn keyword ngxDirective ssl_dhparam
|
||||
syn keyword ngxDirective ssl_engine
|
||||
syn keyword ngxDirective ssl_prefer_server_ciphers
|
||||
syn keyword ngxDirective ssl_protocols
|
||||
syn keyword ngxDirective ssl_session_cache
|
||||
syn keyword ngxDirective ssl_session_timeout
|
||||
syn keyword ngxDirective ssl_verify_client
|
||||
syn keyword ngxDirective ssl_verify_depth
|
||||
syn keyword ngxDirective starttls
|
||||
syn keyword ngxDirective stub_status
|
||||
syn keyword ngxDirective sub_filter
|
||||
syn keyword ngxDirective sub_filter_once
|
||||
syn keyword ngxDirective sub_filter_types
|
||||
syn keyword ngxDirective tcp_nodelay
|
||||
syn keyword ngxDirective tcp_nopush
|
||||
syn keyword ngxDirective thread_stack_size
|
||||
syn keyword ngxDirective timeout
|
||||
syn keyword ngxDirective timer_resolution
|
||||
syn keyword ngxDirective types_hash_bucket_size
|
||||
syn keyword ngxDirective types_hash_max_size
|
||||
syn keyword ngxDirective underscores_in_headers
|
||||
syn keyword ngxDirective uninitialized_variable_warn
|
||||
syn keyword ngxDirective use
|
||||
syn keyword ngxDirective user
|
||||
syn keyword ngxDirective userid
|
||||
syn keyword ngxDirective userid_domain
|
||||
syn keyword ngxDirective userid_expires
|
||||
syn keyword ngxDirective userid_mark
|
||||
syn keyword ngxDirective userid_name
|
||||
syn keyword ngxDirective userid_p3p
|
||||
syn keyword ngxDirective userid_path
|
||||
syn keyword ngxDirective userid_service
|
||||
syn keyword ngxDirective valid_referers
|
||||
syn keyword ngxDirective variables_hash_bucket_size
|
||||
syn keyword ngxDirective variables_hash_max_size
|
||||
syn keyword ngxDirective worker_connections
|
||||
syn keyword ngxDirective worker_cpu_affinity
|
||||
syn keyword ngxDirective worker_priority
|
||||
syn keyword ngxDirective worker_processes
|
||||
syn keyword ngxDirective worker_rlimit_core
|
||||
syn keyword ngxDirective worker_rlimit_nofile
|
||||
syn keyword ngxDirective worker_rlimit_sigpending
|
||||
syn keyword ngxDirective worker_threads
|
||||
syn keyword ngxDirective working_directory
|
||||
syn keyword ngxDirective xclient
|
||||
syn keyword ngxDirective xml_entities
|
||||
syn keyword ngxDirective xslt_stylesheet
|
||||
syn keyword ngxDirective xslt_types
|
||||
|
||||
" 3rd party module list:
|
||||
" http://wiki.nginx.org/Nginx3rdPartyModules
|
||||
|
||||
" Accept Language Module <http://wiki.nginx.org/NginxAcceptLanguageModule>
|
||||
" Parses the Accept-Language header and gives the most suitable locale from a list of supported locales.
|
||||
syn keyword ngxDirectiveThirdParty set_from_accept_language
|
||||
|
||||
" Access Key Module <http://wiki.nginx.org/NginxHttpAccessKeyModule>
|
||||
" Denies access unless the request URL contains an access key.
|
||||
syn keyword ngxDirectiveThirdParty accesskey
|
||||
syn keyword ngxDirectiveThirdParty accesskey_arg
|
||||
syn keyword ngxDirectiveThirdParty accesskey_hashmethod
|
||||
syn keyword ngxDirectiveThirdParty accesskey_signature
|
||||
|
||||
" Auth PAM Module <http://web.iti.upv.es/~sto/nginx/>
|
||||
" HTTP Basic Authentication using PAM.
|
||||
syn keyword ngxDirectiveThirdParty auth_pam
|
||||
syn keyword ngxDirectiveThirdParty auth_pam_service_name
|
||||
|
||||
" Cache Purge Module <http://labs.frickle.com/nginx_ngx_cache_purge/>
|
||||
" Module adding ability to purge content from FastCGI and proxy caches.
|
||||
syn keyword ngxDirectiveThirdParty fastcgi_cache_purge
|
||||
syn keyword ngxDirectiveThirdParty proxy_cache_purge
|
||||
|
||||
" Chunkin Module <http://wiki.nginx.org/NginxHttpChunkinModule>
|
||||
" HTTP 1.1 chunked-encoding request body support for Nginx.
|
||||
syn keyword ngxDirectiveThirdParty chunkin
|
||||
syn keyword ngxDirectiveThirdParty chunkin_keepalive
|
||||
syn keyword ngxDirectiveThirdParty chunkin_max_chunks_per_buf
|
||||
syn keyword ngxDirectiveThirdParty chunkin_resume
|
||||
|
||||
" Circle GIF Module <http://wiki.nginx.org/NginxHttpCircleGifModule>
|
||||
" Generates simple circle images with the colors and size specified in the URL.
|
||||
syn keyword ngxDirectiveThirdParty circle_gif
|
||||
syn keyword ngxDirectiveThirdParty circle_gif_max_radius
|
||||
syn keyword ngxDirectiveThirdParty circle_gif_min_radius
|
||||
syn keyword ngxDirectiveThirdParty circle_gif_step_radius
|
||||
|
||||
" Drizzle Module <http://github.com/chaoslawful/drizzle-nginx-module>
|
||||
" Make nginx talk directly to mysql, drizzle, and sqlite3 by libdrizzle.
|
||||
syn keyword ngxDirectiveThirdParty drizzle_connect_timeout
|
||||
syn keyword ngxDirectiveThirdParty drizzle_dbname
|
||||
syn keyword ngxDirectiveThirdParty drizzle_keepalive
|
||||
syn keyword ngxDirectiveThirdParty drizzle_module_header
|
||||
syn keyword ngxDirectiveThirdParty drizzle_pass
|
||||
syn keyword ngxDirectiveThirdParty drizzle_query
|
||||
syn keyword ngxDirectiveThirdParty drizzle_recv_cols_timeout
|
||||
syn keyword ngxDirectiveThirdParty drizzle_recv_rows_timeout
|
||||
syn keyword ngxDirectiveThirdParty drizzle_send_query_timeout
|
||||
syn keyword ngxDirectiveThirdParty drizzle_server
|
||||
|
||||
" Echo Module <http://wiki.nginx.org/NginxHttpEchoModule>
|
||||
" Brings 'echo', 'sleep', 'time', 'exec' and more shell-style goodies to Nginx config file.
|
||||
syn keyword ngxDirectiveThirdParty echo
|
||||
syn keyword ngxDirectiveThirdParty echo_after_body
|
||||
syn keyword ngxDirectiveThirdParty echo_before_body
|
||||
syn keyword ngxDirectiveThirdParty echo_blocking_sleep
|
||||
syn keyword ngxDirectiveThirdParty echo_duplicate
|
||||
syn keyword ngxDirectiveThirdParty echo_end
|
||||
syn keyword ngxDirectiveThirdParty echo_exec
|
||||
syn keyword ngxDirectiveThirdParty echo_flush
|
||||
syn keyword ngxDirectiveThirdParty echo_foreach_split
|
||||
syn keyword ngxDirectiveThirdParty echo_location
|
||||
syn keyword ngxDirectiveThirdParty echo_location_async
|
||||
syn keyword ngxDirectiveThirdParty echo_read_request_body
|
||||
syn keyword ngxDirectiveThirdParty echo_request_body
|
||||
syn keyword ngxDirectiveThirdParty echo_reset_timer
|
||||
syn keyword ngxDirectiveThirdParty echo_sleep
|
||||
syn keyword ngxDirectiveThirdParty echo_subrequest
|
||||
syn keyword ngxDirectiveThirdParty echo_subrequest_async
|
||||
|
||||
" Events Module <http://docs.dutov.org/nginx_modules_events_en.html>
|
||||
" Privides options for start/stop events.
|
||||
syn keyword ngxDirectiveThirdParty on_start
|
||||
syn keyword ngxDirectiveThirdParty on_stop
|
||||
|
||||
" EY Balancer Module <http://github.com/ry/nginx-ey-balancer>
|
||||
" Adds a request queue to Nginx that allows the limiting of concurrent requests passed to the upstream.
|
||||
syn keyword ngxDirectiveThirdParty max_connections
|
||||
syn keyword ngxDirectiveThirdParty max_connections_max_queue_length
|
||||
syn keyword ngxDirectiveThirdParty max_connections_queue_timeout
|
||||
|
||||
" Fancy Indexes Module <https://connectical.com/projects/ngx-fancyindex/wiki>
|
||||
" Like the built-in autoindex module, but fancier.
|
||||
syn keyword ngxDirectiveThirdParty fancyindex
|
||||
syn keyword ngxDirectiveThirdParty fancyindex_exact_size
|
||||
syn keyword ngxDirectiveThirdParty fancyindex_footer
|
||||
syn keyword ngxDirectiveThirdParty fancyindex_header
|
||||
syn keyword ngxDirectiveThirdParty fancyindex_localtime
|
||||
syn keyword ngxDirectiveThirdParty fancyindex_readme
|
||||
syn keyword ngxDirectiveThirdParty fancyindex_readme_mode
|
||||
|
||||
" GeoIP Module (DEPRECATED) <http://wiki.nginx.org/NginxHttp3rdPartyGeoIPModule>
|
||||
" Country code lookups via the MaxMind GeoIP API.
|
||||
syn keyword ngxDirectiveThirdParty geoip_country_file
|
||||
|
||||
" Headers More Module <http://wiki.nginx.org/NginxHttpHeadersMoreModule>
|
||||
" Set and clear input and output headers...more than "add"!
|
||||
syn keyword ngxDirectiveThirdParty more_clear_headers
|
||||
syn keyword ngxDirectiveThirdParty more_clear_input_headers
|
||||
syn keyword ngxDirectiveThirdParty more_set_headers
|
||||
syn keyword ngxDirectiveThirdParty more_set_input_headers
|
||||
|
||||
" HTTP Push Module <http://pushmodule.slact.net/>
|
||||
" Turn Nginx into an adept long-polling HTTP Push (Comet) server.
|
||||
syn keyword ngxDirectiveThirdParty push_buffer_size
|
||||
syn keyword ngxDirectiveThirdParty push_listener
|
||||
syn keyword ngxDirectiveThirdParty push_message_timeout
|
||||
syn keyword ngxDirectiveThirdParty push_queue_messages
|
||||
syn keyword ngxDirectiveThirdParty push_sender
|
||||
|
||||
" HTTP Redis Module <http://people.FreeBSD.ORG/~osa/ngx_http_redis-0.3.1.tar.gz>>
|
||||
" Redis <http://code.google.com/p/redis/> support.>
|
||||
syn keyword ngxDirectiveThirdParty redis_bind
|
||||
syn keyword ngxDirectiveThirdParty redis_buffer_size
|
||||
syn keyword ngxDirectiveThirdParty redis_connect_timeout
|
||||
syn keyword ngxDirectiveThirdParty redis_next_upstream
|
||||
syn keyword ngxDirectiveThirdParty redis_pass
|
||||
syn keyword ngxDirectiveThirdParty redis_read_timeout
|
||||
syn keyword ngxDirectiveThirdParty redis_send_timeout
|
||||
|
||||
" HTTP JavaScript Module <http://wiki.github.com/kung-fu-tzu/ngx_http_js_module>
|
||||
" Embedding SpiderMonkey. Nearly full port on Perl module.
|
||||
syn keyword ngxDirectiveThirdParty js
|
||||
syn keyword ngxDirectiveThirdParty js_filter
|
||||
syn keyword ngxDirectiveThirdParty js_filter_types
|
||||
syn keyword ngxDirectiveThirdParty js_load
|
||||
syn keyword ngxDirectiveThirdParty js_maxmem
|
||||
syn keyword ngxDirectiveThirdParty js_require
|
||||
syn keyword ngxDirectiveThirdParty js_set
|
||||
syn keyword ngxDirectiveThirdParty js_utf8
|
||||
|
||||
" Log Request Speed <http://wiki.nginx.org/NginxHttpLogRequestSpeed>
|
||||
" Log the time it took to process each request.
|
||||
syn keyword ngxDirectiveThirdParty log_request_speed_filter
|
||||
syn keyword ngxDirectiveThirdParty log_request_speed_filter_timeout
|
||||
|
||||
" Memc Module <http://wiki.nginx.org/NginxHttpMemcModule>
|
||||
" An extended version of the standard memcached module that supports set, add, delete, and many more memcached commands.
|
||||
syn keyword ngxDirectiveThirdParty memc_buffer_size
|
||||
syn keyword ngxDirectiveThirdParty memc_cmds_allowed
|
||||
syn keyword ngxDirectiveThirdParty memc_connect_timeout
|
||||
syn keyword ngxDirectiveThirdParty memc_flags_to_last_modified
|
||||
syn keyword ngxDirectiveThirdParty memc_next_upstream
|
||||
syn keyword ngxDirectiveThirdParty memc_pass
|
||||
syn keyword ngxDirectiveThirdParty memc_read_timeout
|
||||
syn keyword ngxDirectiveThirdParty memc_send_timeout
|
||||
syn keyword ngxDirectiveThirdParty memc_upstream_fail_timeout
|
||||
syn keyword ngxDirectiveThirdParty memc_upstream_max_fails
|
||||
|
||||
" Mogilefs Module <http://www.grid.net.ru/nginx/mogilefs.en.html>
|
||||
" Implements a MogileFS client, provides a replace to the Perlbal reverse proxy of the original MogileFS.
|
||||
syn keyword ngxDirectiveThirdParty mogilefs_connect_timeout
|
||||
syn keyword ngxDirectiveThirdParty mogilefs_domain
|
||||
syn keyword ngxDirectiveThirdParty mogilefs_methods
|
||||
syn keyword ngxDirectiveThirdParty mogilefs_noverify
|
||||
syn keyword ngxDirectiveThirdParty mogilefs_pass
|
||||
syn keyword ngxDirectiveThirdParty mogilefs_read_timeout
|
||||
syn keyword ngxDirectiveThirdParty mogilefs_send_timeout
|
||||
syn keyword ngxDirectiveThirdParty mogilefs_tracker
|
||||
|
||||
" MP4 Streaming Lite Module <http://wiki.nginx.org/NginxMP4StreamingLite>
|
||||
" Will seek to a certain time within H.264/MP4 files when provided with a 'start' parameter in the URL.
|
||||
syn keyword ngxDirectiveThirdParty mp4
|
||||
|
||||
" Nginx Notice Module <http://xph.us/software/nginx-notice/>
|
||||
" Serve static file to POST requests.
|
||||
syn keyword ngxDirectiveThirdParty notice
|
||||
syn keyword ngxDirectiveThirdParty notice_type
|
||||
|
||||
" Phusion Passenger <http://www.modrails.com/documentation.html>
|
||||
" Easy and robust deployment of Ruby on Rails application on Apache and Nginx webservers.
|
||||
syn keyword ngxDirectiveThirdParty passenger_base_uri
|
||||
syn keyword ngxDirectiveThirdParty passenger_default_user
|
||||
syn keyword ngxDirectiveThirdParty passenger_enabled
|
||||
syn keyword ngxDirectiveThirdParty passenger_log_level
|
||||
syn keyword ngxDirectiveThirdParty passenger_max_instances_per_app
|
||||
syn keyword ngxDirectiveThirdParty passenger_max_pool_size
|
||||
syn keyword ngxDirectiveThirdParty passenger_pool_idle_time
|
||||
syn keyword ngxDirectiveThirdParty passenger_root
|
||||
syn keyword ngxDirectiveThirdParty passenger_ruby
|
||||
syn keyword ngxDirectiveThirdParty passenger_use_global_queue
|
||||
syn keyword ngxDirectiveThirdParty passenger_user_switching
|
||||
syn keyword ngxDirectiveThirdParty rack_env
|
||||
syn keyword ngxDirectiveThirdParty rails_app_spawner_idle_time
|
||||
syn keyword ngxDirectiveThirdParty rails_env
|
||||
syn keyword ngxDirectiveThirdParty rails_framework_spawner_idle_time
|
||||
syn keyword ngxDirectiveThirdParty rails_spawn_method
|
||||
|
||||
" RDS JSON Module <http://github.com/agentzh/rds-json-nginx-module>
|
||||
" Help ngx_drizzle and other DBD modules emit JSON data.
|
||||
syn keyword ngxDirectiveThirdParty rds_json
|
||||
syn keyword ngxDirectiveThirdParty rds_json_content_type
|
||||
syn keyword ngxDirectiveThirdParty rds_json_format
|
||||
syn keyword ngxDirectiveThirdParty rds_json_ret
|
||||
|
||||
" RRD Graph Module <http://wiki.nginx.org/NginxNgx_rrd_graph>
|
||||
" This module provides an HTTP interface to RRDtool's graphing facilities.
|
||||
syn keyword ngxDirectiveThirdParty rrd_graph
|
||||
syn keyword ngxDirectiveThirdParty rrd_graph_root
|
||||
|
||||
" Secure Download <http://wiki.nginx.org/NginxHttpSecureDownload>
|
||||
" Create expiring links.
|
||||
syn keyword ngxDirectiveThirdParty secure_download
|
||||
syn keyword ngxDirectiveThirdParty secure_download_fail_location
|
||||
syn keyword ngxDirectiveThirdParty secure_download_path_mode
|
||||
syn keyword ngxDirectiveThirdParty secure_download_secret
|
||||
|
||||
" SlowFS Cache Module <http://labs.frickle.com/nginx_ngx_slowfs_cache/>
|
||||
" Module adding ability to cache static files.
|
||||
syn keyword ngxDirectiveThirdParty slowfs_big_file_size
|
||||
syn keyword ngxDirectiveThirdParty slowfs_cache
|
||||
syn keyword ngxDirectiveThirdParty slowfs_cache_key
|
||||
syn keyword ngxDirectiveThirdParty slowfs_cache_min_uses
|
||||
syn keyword ngxDirectiveThirdParty slowfs_cache_path
|
||||
syn keyword ngxDirectiveThirdParty slowfs_cache_purge
|
||||
syn keyword ngxDirectiveThirdParty slowfs_cache_valid
|
||||
syn keyword ngxDirectiveThirdParty slowfs_temp_path
|
||||
|
||||
" Strip Module <http://wiki.nginx.org/NginxHttpStripModule>
|
||||
" Whitespace remover.
|
||||
syn keyword ngxDirectiveThirdParty strip
|
||||
|
||||
" Substitutions Module <http://wiki.nginx.org/NginxHttpSubsModule>
|
||||
" A filter module which can do both regular expression and fixed string substitutions on response bodies.
|
||||
syn keyword ngxDirectiveThirdParty subs_filter
|
||||
syn keyword ngxDirectiveThirdParty subs_filter_types
|
||||
|
||||
" Supervisord Module <http://labs.frickle.com/nginx_ngx_supervisord/>
|
||||
" Module providing nginx with API to communicate with supervisord and manage (start/stop) backends on-demand.
|
||||
syn keyword ngxDirectiveThirdParty supervisord
|
||||
syn keyword ngxDirectiveThirdParty supervisord_inherit_backend_status
|
||||
syn keyword ngxDirectiveThirdParty supervisord_name
|
||||
syn keyword ngxDirectiveThirdParty supervisord_start
|
||||
syn keyword ngxDirectiveThirdParty supervisord_stop
|
||||
|
||||
" Upload Module <http://www.grid.net.ru/nginx/upload.en.html>
|
||||
" Parses multipart/form-data allowing arbitrary handling of uploaded files.
|
||||
syn keyword ngxDirectiveThirdParty upload_aggregate_form_field
|
||||
syn keyword ngxDirectiveThirdParty upload_buffer_size
|
||||
syn keyword ngxDirectiveThirdParty upload_cleanup
|
||||
syn keyword ngxDirectiveThirdParty upload_limit_rate
|
||||
syn keyword ngxDirectiveThirdParty upload_max_file_size
|
||||
syn keyword ngxDirectiveThirdParty upload_max_output_body_len
|
||||
syn keyword ngxDirectiveThirdParty upload_max_part_header_len
|
||||
syn keyword ngxDirectiveThirdParty upload_pass
|
||||
syn keyword ngxDirectiveThirdParty upload_pass_args
|
||||
syn keyword ngxDirectiveThirdParty upload_pass_form_field
|
||||
syn keyword ngxDirectiveThirdParty upload_set_form_field
|
||||
syn keyword ngxDirectiveThirdParty upload_store
|
||||
syn keyword ngxDirectiveThirdParty upload_store_access
|
||||
|
||||
" Upload Progress Module <http://wiki.nginx.org/NginxHttpUploadProgressModule>
|
||||
" Tracks and reports upload progress.
|
||||
syn keyword ngxDirectiveThirdParty report_uploads
|
||||
syn keyword ngxDirectiveThirdParty track_uploads
|
||||
syn keyword ngxDirectiveThirdParty upload_progress
|
||||
syn keyword ngxDirectiveThirdParty upload_progress_content_type
|
||||
syn keyword ngxDirectiveThirdParty upload_progress_header
|
||||
syn keyword ngxDirectiveThirdParty upload_progress_json_output
|
||||
syn keyword ngxDirectiveThirdParty upload_progress_template
|
||||
|
||||
" Upstream Fair Balancer <http://wiki.nginx.org/NginxHttpUpstreamFairModule>
|
||||
" Sends an incoming request to the least-busy backend server, rather than distributing requests round-robin.
|
||||
syn keyword ngxDirectiveThirdParty fair
|
||||
syn keyword ngxDirectiveThirdParty upstream_fair_shm_size
|
||||
|
||||
" Upstream Consistent Hash <http://wiki.nginx.org/NginxHttpUpstreamConsistentHash>
|
||||
" Select backend based on Consistent hash ring.
|
||||
syn keyword ngxDirectiveThirdParty consistent_hash
|
||||
|
||||
" Upstream Hash Module <http://wiki.nginx.org/NginxHttpUpstreamRequestHashModule>
|
||||
" Provides simple upstream load distribution by hashing a configurable variable.
|
||||
syn keyword ngxDirectiveThirdParty hash
|
||||
syn keyword ngxDirectiveThirdParty hash_again
|
||||
|
||||
" XSS Module <http://github.com/agentzh/xss-nginx-module>
|
||||
" Native support for cross-site scripting (XSS) in an nginx.
|
||||
syn keyword ngxDirectiveThirdParty xss_callback_arg
|
||||
syn keyword ngxDirectiveThirdParty xss_get
|
||||
syn keyword ngxDirectiveThirdParty xss_input_types
|
||||
syn keyword ngxDirectiveThirdParty xss_output_type
|
||||
|
||||
" highlight
|
||||
|
||||
hi link ngxComment Comment
|
||||
hi link ngxVariable Identifier
|
||||
hi link ngxVariableBlock Identifier
|
||||
hi link ngxVariableString PreProc
|
||||
hi link ngxBlock Normal
|
||||
hi link ngxString String
|
||||
|
||||
hi link ngxBoolean Boolean
|
||||
hi link ngxDirectiveBlock Statement
|
||||
hi link ngxDirectiveImportant Type
|
||||
hi link ngxDirectiveControl Keyword
|
||||
hi link ngxDirectiveError Constant
|
||||
hi link ngxDirectiveDeprecated Error
|
||||
hi link ngxDirective Identifier
|
||||
hi link ngxDirectiveThirdParty Special
|
||||
|
||||
let b:current_syntax = "nginx"
|
@ -1,3 +0,0 @@
|
||||
This is a mirror of http://www.vim.org/scripts/script.php?script_id=1886
|
||||
|
||||
nginx.vim highlights configuration files for nginx, the high-performance web server (see http://nginx.net).
|
@ -1,664 +0,0 @@
|
||||
" Vim syntax file
|
||||
" Language: nginx.conf
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
end
|
||||
|
||||
setlocal iskeyword+=.
|
||||
setlocal iskeyword+=/
|
||||
setlocal iskeyword+=:
|
||||
|
||||
syn match ngxVariable '\$\w\w*'
|
||||
syn match ngxVariableBlock '\$\w\w*' contained
|
||||
syn match ngxVariableString '\$\w\w*' contained
|
||||
syn region ngxBlock start=+^+ end=+{+ contains=ngxComment,ngxDirectiveBlock,ngxVariableBlock,ngxString oneline
|
||||
syn region ngxString start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=ngxVariableString oneline
|
||||
syn region ngxString start=+'+ end=+'+ skip=+\\\\\|\\'+ contains=ngxVariableString oneline
|
||||
syn match ngxComment ' *#.*$'
|
||||
|
||||
syn keyword ngxBoolean on
|
||||
syn keyword ngxBoolean off
|
||||
|
||||
syn keyword ngxDirectiveBlock http contained
|
||||
syn keyword ngxDirectiveBlock mail contained
|
||||
syn keyword ngxDirectiveBlock events contained
|
||||
syn keyword ngxDirectiveBlock server contained
|
||||
syn keyword ngxDirectiveBlock types contained
|
||||
syn keyword ngxDirectiveBlock location contained
|
||||
syn keyword ngxDirectiveBlock upstream contained
|
||||
syn keyword ngxDirectiveBlock charset_map contained
|
||||
syn keyword ngxDirectiveBlock limit_except contained
|
||||
syn keyword ngxDirectiveBlock if contained
|
||||
syn keyword ngxDirectiveBlock geo contained
|
||||
syn keyword ngxDirectiveBlock map contained
|
||||
|
||||
syn keyword ngxDirectiveImportant include
|
||||
syn keyword ngxDirectiveImportant root
|
||||
syn keyword ngxDirectiveImportant server
|
||||
syn keyword ngxDirectiveImportant server_name
|
||||
syn keyword ngxDirectiveImportant listen
|
||||
syn keyword ngxDirectiveImportant internal
|
||||
syn keyword ngxDirectiveImportant proxy_pass
|
||||
syn keyword ngxDirectiveImportant memcached_pass
|
||||
syn keyword ngxDirectiveImportant fastcgi_pass
|
||||
syn keyword ngxDirectiveImportant try_files
|
||||
|
||||
syn keyword ngxDirectiveControl break
|
||||
syn keyword ngxDirectiveControl return
|
||||
syn keyword ngxDirectiveControl rewrite
|
||||
syn keyword ngxDirectiveControl set
|
||||
|
||||
syn keyword ngxDirectiveError error_page
|
||||
syn keyword ngxDirectiveError post_action
|
||||
|
||||
syn keyword ngxDirectiveDeprecated connections
|
||||
syn keyword ngxDirectiveDeprecated imap
|
||||
syn keyword ngxDirectiveDeprecated open_file_cache_retest
|
||||
syn keyword ngxDirectiveDeprecated optimize_server_names
|
||||
syn keyword ngxDirectiveDeprecated satisfy_any
|
||||
|
||||
syn keyword ngxDirective accept_mutex
|
||||
syn keyword ngxDirective accept_mutex_delay
|
||||
syn keyword ngxDirective access_log
|
||||
syn keyword ngxDirective add_after_body
|
||||
syn keyword ngxDirective add_before_body
|
||||
syn keyword ngxDirective add_header
|
||||
syn keyword ngxDirective addition_types
|
||||
syn keyword ngxDirective aio
|
||||
syn keyword ngxDirective alias
|
||||
syn keyword ngxDirective allow
|
||||
syn keyword ngxDirective ancient_browser
|
||||
syn keyword ngxDirective ancient_browser_value
|
||||
syn keyword ngxDirective auth_basic
|
||||
syn keyword ngxDirective auth_basic_user_file
|
||||
syn keyword ngxDirective auth_http
|
||||
syn keyword ngxDirective auth_http_header
|
||||
syn keyword ngxDirective auth_http_timeout
|
||||
syn keyword ngxDirective autoindex
|
||||
syn keyword ngxDirective autoindex_exact_size
|
||||
syn keyword ngxDirective autoindex_localtime
|
||||
syn keyword ngxDirective charset
|
||||
syn keyword ngxDirective charset_types
|
||||
syn keyword ngxDirective client_body_buffer_size
|
||||
syn keyword ngxDirective client_body_in_file_only
|
||||
syn keyword ngxDirective client_body_in_single_buffer
|
||||
syn keyword ngxDirective client_body_temp_path
|
||||
syn keyword ngxDirective client_body_timeout
|
||||
syn keyword ngxDirective client_header_buffer_size
|
||||
syn keyword ngxDirective client_header_timeout
|
||||
syn keyword ngxDirective client_max_body_size
|
||||
syn keyword ngxDirective connection_pool_size
|
||||
syn keyword ngxDirective create_full_put_path
|
||||
syn keyword ngxDirective daemon
|
||||
syn keyword ngxDirective dav_access
|
||||
syn keyword ngxDirective dav_methods
|
||||
syn keyword ngxDirective debug_connection
|
||||
syn keyword ngxDirective debug_points
|
||||
syn keyword ngxDirective default_type
|
||||
syn keyword ngxDirective degradation
|
||||
syn keyword ngxDirective degrade
|
||||
syn keyword ngxDirective deny
|
||||
syn keyword ngxDirective devpoll_changes
|
||||
syn keyword ngxDirective devpoll_events
|
||||
syn keyword ngxDirective directio
|
||||
syn keyword ngxDirective directio_alignment
|
||||
syn keyword ngxDirective empty_gif
|
||||
syn keyword ngxDirective env
|
||||
syn keyword ngxDirective epoll_events
|
||||
syn keyword ngxDirective error_log
|
||||
syn keyword ngxDirective eventport_events
|
||||
syn keyword ngxDirective expires
|
||||
syn keyword ngxDirective fastcgi_bind
|
||||
syn keyword ngxDirective fastcgi_buffer_size
|
||||
syn keyword ngxDirective fastcgi_buffers
|
||||
syn keyword ngxDirective fastcgi_busy_buffers_size
|
||||
syn keyword ngxDirective fastcgi_cache
|
||||
syn keyword ngxDirective fastcgi_cache_key
|
||||
syn keyword ngxDirective fastcgi_cache_methods
|
||||
syn keyword ngxDirective fastcgi_cache_min_uses
|
||||
syn keyword ngxDirective fastcgi_cache_path
|
||||
syn keyword ngxDirective fastcgi_cache_use_stale
|
||||
syn keyword ngxDirective fastcgi_cache_valid
|
||||
syn keyword ngxDirective fastcgi_catch_stderr
|
||||
syn keyword ngxDirective fastcgi_connect_timeout
|
||||
syn keyword ngxDirective fastcgi_hide_header
|
||||
syn keyword ngxDirective fastcgi_ignore_client_abort
|
||||
syn keyword ngxDirective fastcgi_ignore_headers
|
||||
syn keyword ngxDirective fastcgi_index
|
||||
syn keyword ngxDirective fastcgi_intercept_errors
|
||||
syn keyword ngxDirective fastcgi_max_temp_file_size
|
||||
syn keyword ngxDirective fastcgi_next_upstream
|
||||
syn keyword ngxDirective fastcgi_param
|
||||
syn keyword ngxDirective fastcgi_pass_header
|
||||
syn keyword ngxDirective fastcgi_pass_request_body
|
||||
syn keyword ngxDirective fastcgi_pass_request_headers
|
||||
syn keyword ngxDirective fastcgi_read_timeout
|
||||
syn keyword ngxDirective fastcgi_send_lowat
|
||||
syn keyword ngxDirective fastcgi_send_timeout
|
||||
syn keyword ngxDirective fastcgi_split_path_info
|
||||
syn keyword ngxDirective fastcgi_store
|
||||
syn keyword ngxDirective fastcgi_store_access
|
||||
syn keyword ngxDirective fastcgi_temp_file_write_size
|
||||
syn keyword ngxDirective fastcgi_temp_path
|
||||
syn keyword ngxDirective fastcgi_upstream_fail_timeout
|
||||
syn keyword ngxDirective fastcgi_upstream_max_fails
|
||||
syn keyword ngxDirective flv
|
||||
syn keyword ngxDirective geoip_city
|
||||
syn keyword ngxDirective geoip_country
|
||||
syn keyword ngxDirective google_perftools_profiles
|
||||
syn keyword ngxDirective gzip
|
||||
syn keyword ngxDirective gzip_buffers
|
||||
syn keyword ngxDirective gzip_comp_level
|
||||
syn keyword ngxDirective gzip_disable
|
||||
syn keyword ngxDirective gzip_hash
|
||||
syn keyword ngxDirective gzip_http_version
|
||||
syn keyword ngxDirective gzip_min_length
|
||||
syn keyword ngxDirective gzip_no_buffer
|
||||
syn keyword ngxDirective gzip_proxied
|
||||
syn keyword ngxDirective gzip_static
|
||||
syn keyword ngxDirective gzip_types
|
||||
syn keyword ngxDirective gzip_vary
|
||||
syn keyword ngxDirective gzip_window
|
||||
syn keyword ngxDirective if_modified_since
|
||||
syn keyword ngxDirective ignore_invalid_headers
|
||||
syn keyword ngxDirective image_filter
|
||||
syn keyword ngxDirective image_filter_buffer
|
||||
syn keyword ngxDirective image_filter_jpeg_quality
|
||||
syn keyword ngxDirective image_filter_transparency
|
||||
syn keyword ngxDirective imap_auth
|
||||
syn keyword ngxDirective imap_capabilities
|
||||
syn keyword ngxDirective imap_client_buffer
|
||||
syn keyword ngxDirective index
|
||||
syn keyword ngxDirective ip_hash
|
||||
syn keyword ngxDirective keepalive_requests
|
||||
syn keyword ngxDirective keepalive_timeout
|
||||
syn keyword ngxDirective kqueue_changes
|
||||
syn keyword ngxDirective kqueue_events
|
||||
syn keyword ngxDirective large_client_header_buffers
|
||||
syn keyword ngxDirective limit_conn
|
||||
syn keyword ngxDirective limit_conn_log_level
|
||||
syn keyword ngxDirective limit_rate
|
||||
syn keyword ngxDirective limit_rate_after
|
||||
syn keyword ngxDirective limit_req
|
||||
syn keyword ngxDirective limit_req_log_level
|
||||
syn keyword ngxDirective limit_req_zone
|
||||
syn keyword ngxDirective limit_zone
|
||||
syn keyword ngxDirective lingering_time
|
||||
syn keyword ngxDirective lingering_timeout
|
||||
syn keyword ngxDirective lock_file
|
||||
syn keyword ngxDirective log_format
|
||||
syn keyword ngxDirective log_not_found
|
||||
syn keyword ngxDirective log_subrequest
|
||||
syn keyword ngxDirective map_hash_bucket_size
|
||||
syn keyword ngxDirective map_hash_max_size
|
||||
syn keyword ngxDirective master_process
|
||||
syn keyword ngxDirective memcached_bind
|
||||
syn keyword ngxDirective memcached_buffer_size
|
||||
syn keyword ngxDirective memcached_connect_timeout
|
||||
syn keyword ngxDirective memcached_next_upstream
|
||||
syn keyword ngxDirective memcached_read_timeout
|
||||
syn keyword ngxDirective memcached_send_timeout
|
||||
syn keyword ngxDirective memcached_upstream_fail_timeout
|
||||
syn keyword ngxDirective memcached_upstream_max_fails
|
||||
syn keyword ngxDirective merge_slashes
|
||||
syn keyword ngxDirective min_delete_depth
|
||||
syn keyword ngxDirective modern_browser
|
||||
syn keyword ngxDirective modern_browser_value
|
||||
syn keyword ngxDirective msie_padding
|
||||
syn keyword ngxDirective msie_refresh
|
||||
syn keyword ngxDirective multi_accept
|
||||
syn keyword ngxDirective open_file_cache
|
||||
syn keyword ngxDirective open_file_cache_errors
|
||||
syn keyword ngxDirective open_file_cache_events
|
||||
syn keyword ngxDirective open_file_cache_min_uses
|
||||
syn keyword ngxDirective open_file_cache_valid
|
||||
syn keyword ngxDirective open_log_file_cache
|
||||
syn keyword ngxDirective output_buffers
|
||||
syn keyword ngxDirective override_charset
|
||||
syn keyword ngxDirective perl
|
||||
syn keyword ngxDirective perl_modules
|
||||
syn keyword ngxDirective perl_require
|
||||
syn keyword ngxDirective perl_set
|
||||
syn keyword ngxDirective pid
|
||||
syn keyword ngxDirective pop3_auth
|
||||
syn keyword ngxDirective pop3_capabilities
|
||||
syn keyword ngxDirective port_in_redirect
|
||||
syn keyword ngxDirective postpone_gzipping
|
||||
syn keyword ngxDirective postpone_output
|
||||
syn keyword ngxDirective protocol
|
||||
syn keyword ngxDirective proxy
|
||||
syn keyword ngxDirective proxy_bind
|
||||
syn keyword ngxDirective proxy_buffer
|
||||
syn keyword ngxDirective proxy_buffer_size
|
||||
syn keyword ngxDirective proxy_buffering
|
||||
syn keyword ngxDirective proxy_buffers
|
||||
syn keyword ngxDirective proxy_busy_buffers_size
|
||||
syn keyword ngxDirective proxy_cache
|
||||
syn keyword ngxDirective proxy_cache_key
|
||||
syn keyword ngxDirective proxy_cache_methods
|
||||
syn keyword ngxDirective proxy_cache_min_uses
|
||||
syn keyword ngxDirective proxy_cache_path
|
||||
syn keyword ngxDirective proxy_cache_use_stale
|
||||
syn keyword ngxDirective proxy_cache_valid
|
||||
syn keyword ngxDirective proxy_connect_timeout
|
||||
syn keyword ngxDirective proxy_headers_hash_bucket_size
|
||||
syn keyword ngxDirective proxy_headers_hash_max_size
|
||||
syn keyword ngxDirective proxy_hide_header
|
||||
syn keyword ngxDirective proxy_ignore_client_abort
|
||||
syn keyword ngxDirective proxy_ignore_headers
|
||||
syn keyword ngxDirective proxy_intercept_errors
|
||||
syn keyword ngxDirective proxy_max_temp_file_size
|
||||
syn keyword ngxDirective proxy_method
|
||||
syn keyword ngxDirective proxy_next_upstream
|
||||
syn keyword ngxDirective proxy_pass_error_message
|
||||
syn keyword ngxDirective proxy_pass_header
|
||||
syn keyword ngxDirective proxy_pass_request_body
|
||||
syn keyword ngxDirective proxy_pass_request_headers
|
||||
syn keyword ngxDirective proxy_read_timeout
|
||||
syn keyword ngxDirective proxy_redirect
|
||||
syn keyword ngxDirective proxy_send_lowat
|
||||
syn keyword ngxDirective proxy_send_timeout
|
||||
syn keyword ngxDirective proxy_set_body
|
||||
syn keyword ngxDirective proxy_set_header
|
||||
syn keyword ngxDirective proxy_ssl_session_reuse
|
||||
syn keyword ngxDirective proxy_store
|
||||
syn keyword ngxDirective proxy_store_access
|
||||
syn keyword ngxDirective proxy_temp_file_write_size
|
||||
syn keyword ngxDirective proxy_temp_path
|
||||
syn keyword ngxDirective proxy_timeout
|
||||
syn keyword ngxDirective proxy_upstream_fail_timeout
|
||||
syn keyword ngxDirective proxy_upstream_max_fails
|
||||
syn keyword ngxDirective random_index
|
||||
syn keyword ngxDirective read_ahead
|
||||
syn keyword ngxDirective real_ip_header
|
||||
syn keyword ngxDirective recursive_error_pages
|
||||
syn keyword ngxDirective request_pool_size
|
||||
syn keyword ngxDirective reset_timedout_connection
|
||||
syn keyword ngxDirective resolver
|
||||
syn keyword ngxDirective resolver_timeout
|
||||
syn keyword ngxDirective rewrite_log
|
||||
syn keyword ngxDirective rtsig_overflow_events
|
||||
syn keyword ngxDirective rtsig_overflow_test
|
||||
syn keyword ngxDirective rtsig_overflow_threshold
|
||||
syn keyword ngxDirective rtsig_signo
|
||||
syn keyword ngxDirective satisfy
|
||||
syn keyword ngxDirective secure_link_secret
|
||||
syn keyword ngxDirective send_lowat
|
||||
syn keyword ngxDirective send_timeout
|
||||
syn keyword ngxDirective sendfile
|
||||
syn keyword ngxDirective sendfile_max_chunk
|
||||
syn keyword ngxDirective server_name_in_redirect
|
||||
syn keyword ngxDirective server_names_hash_bucket_size
|
||||
syn keyword ngxDirective server_names_hash_max_size
|
||||
syn keyword ngxDirective server_tokens
|
||||
syn keyword ngxDirective set_real_ip_from
|
||||
syn keyword ngxDirective smtp_auth
|
||||
syn keyword ngxDirective smtp_capabilities
|
||||
syn keyword ngxDirective smtp_client_buffer
|
||||
syn keyword ngxDirective smtp_greeting_delay
|
||||
syn keyword ngxDirective so_keepalive
|
||||
syn keyword ngxDirective source_charset
|
||||
syn keyword ngxDirective ssi
|
||||
syn keyword ngxDirective ssi_ignore_recycled_buffers
|
||||
syn keyword ngxDirective ssi_min_file_chunk
|
||||
syn keyword ngxDirective ssi_silent_errors
|
||||
syn keyword ngxDirective ssi_types
|
||||
syn keyword ngxDirective ssi_value_length
|
||||
syn keyword ngxDirective ssl
|
||||
syn keyword ngxDirective ssl_certificate
|
||||
syn keyword ngxDirective ssl_certificate_key
|
||||
syn keyword ngxDirective ssl_ciphers
|
||||
syn keyword ngxDirective ssl_client_certificate
|
||||
syn keyword ngxDirective ssl_crl
|
||||
syn keyword ngxDirective ssl_dhparam
|
||||
syn keyword ngxDirective ssl_engine
|
||||
syn keyword ngxDirective ssl_prefer_server_ciphers
|
||||
syn keyword ngxDirective ssl_protocols
|
||||
syn keyword ngxDirective ssl_session_cache
|
||||
syn keyword ngxDirective ssl_session_timeout
|
||||
syn keyword ngxDirective ssl_verify_client
|
||||
syn keyword ngxDirective ssl_verify_depth
|
||||
syn keyword ngxDirective starttls
|
||||
syn keyword ngxDirective stub_status
|
||||
syn keyword ngxDirective sub_filter
|
||||
syn keyword ngxDirective sub_filter_once
|
||||
syn keyword ngxDirective sub_filter_types
|
||||
syn keyword ngxDirective tcp_nodelay
|
||||
syn keyword ngxDirective tcp_nopush
|
||||
syn keyword ngxDirective thread_stack_size
|
||||
syn keyword ngxDirective timeout
|
||||
syn keyword ngxDirective timer_resolution
|
||||
syn keyword ngxDirective types_hash_bucket_size
|
||||
syn keyword ngxDirective types_hash_max_size
|
||||
syn keyword ngxDirective underscores_in_headers
|
||||
syn keyword ngxDirective uninitialized_variable_warn
|
||||
syn keyword ngxDirective use
|
||||
syn keyword ngxDirective user
|
||||
syn keyword ngxDirective userid
|
||||
syn keyword ngxDirective userid_domain
|
||||
syn keyword ngxDirective userid_expires
|
||||
syn keyword ngxDirective userid_mark
|
||||
syn keyword ngxDirective userid_name
|
||||
syn keyword ngxDirective userid_p3p
|
||||
syn keyword ngxDirective userid_path
|
||||
syn keyword ngxDirective userid_service
|
||||
syn keyword ngxDirective valid_referers
|
||||
syn keyword ngxDirective variables_hash_bucket_size
|
||||
syn keyword ngxDirective variables_hash_max_size
|
||||
syn keyword ngxDirective worker_connections
|
||||
syn keyword ngxDirective worker_cpu_affinity
|
||||
syn keyword ngxDirective worker_priority
|
||||
syn keyword ngxDirective worker_processes
|
||||
syn keyword ngxDirective worker_rlimit_core
|
||||
syn keyword ngxDirective worker_rlimit_nofile
|
||||
syn keyword ngxDirective worker_rlimit_sigpending
|
||||
syn keyword ngxDirective worker_threads
|
||||
syn keyword ngxDirective working_directory
|
||||
syn keyword ngxDirective xclient
|
||||
syn keyword ngxDirective xml_entities
|
||||
syn keyword ngxDirective xslt_stylesheet
|
||||
syn keyword ngxDirective xslt_types
|
||||
|
||||
" 3rd party module list:
|
||||
" http://wiki.nginx.org/Nginx3rdPartyModules
|
||||
|
||||
" Accept Language Module <http://wiki.nginx.org/NginxAcceptLanguageModule>
|
||||
" Parses the Accept-Language header and gives the most suitable locale from a list of supported locales.
|
||||
syn keyword ngxDirectiveThirdParty set_from_accept_language
|
||||
|
||||
" Access Key Module <http://wiki.nginx.org/NginxHttpAccessKeyModule>
|
||||
" Denies access unless the request URL contains an access key.
|
||||
syn keyword ngxDirectiveThirdParty accesskey
|
||||
syn keyword ngxDirectiveThirdParty accesskey_arg
|
||||
syn keyword ngxDirectiveThirdParty accesskey_hashmethod
|
||||
syn keyword ngxDirectiveThirdParty accesskey_signature
|
||||
|
||||
" Auth PAM Module <http://web.iti.upv.es/~sto/nginx/>
|
||||
" HTTP Basic Authentication using PAM.
|
||||
syn keyword ngxDirectiveThirdParty auth_pam
|
||||
syn keyword ngxDirectiveThirdParty auth_pam_service_name
|
||||
|
||||
" Cache Purge Module <http://labs.frickle.com/nginx_ngx_cache_purge/>
|
||||
" Module adding ability to purge content from FastCGI and proxy caches.
|
||||
syn keyword ngxDirectiveThirdParty fastcgi_cache_purge
|
||||
syn keyword ngxDirectiveThirdParty proxy_cache_purge
|
||||
|
||||
" Chunkin Module <http://wiki.nginx.org/NginxHttpChunkinModule>
|
||||
" HTTP 1.1 chunked-encoding request body support for Nginx.
|
||||
syn keyword ngxDirectiveThirdParty chunkin
|
||||
syn keyword ngxDirectiveThirdParty chunkin_keepalive
|
||||
syn keyword ngxDirectiveThirdParty chunkin_max_chunks_per_buf
|
||||
syn keyword ngxDirectiveThirdParty chunkin_resume
|
||||
|
||||
" Circle GIF Module <http://wiki.nginx.org/NginxHttpCircleGifModule>
|
||||
" Generates simple circle images with the colors and size specified in the URL.
|
||||
syn keyword ngxDirectiveThirdParty circle_gif
|
||||
syn keyword ngxDirectiveThirdParty circle_gif_max_radius
|
||||
syn keyword ngxDirectiveThirdParty circle_gif_min_radius
|
||||
syn keyword ngxDirectiveThirdParty circle_gif_step_radius
|
||||
|
||||
" Drizzle Module <http://github.com/chaoslawful/drizzle-nginx-module>
|
||||
" Make nginx talk directly to mysql, drizzle, and sqlite3 by libdrizzle.
|
||||
syn keyword ngxDirectiveThirdParty drizzle_connect_timeout
|
||||
syn keyword ngxDirectiveThirdParty drizzle_dbname
|
||||
syn keyword ngxDirectiveThirdParty drizzle_keepalive
|
||||
syn keyword ngxDirectiveThirdParty drizzle_module_header
|
||||
syn keyword ngxDirectiveThirdParty drizzle_pass
|
||||
syn keyword ngxDirectiveThirdParty drizzle_query
|
||||
syn keyword ngxDirectiveThirdParty drizzle_recv_cols_timeout
|
||||
syn keyword ngxDirectiveThirdParty drizzle_recv_rows_timeout
|
||||
syn keyword ngxDirectiveThirdParty drizzle_send_query_timeout
|
||||
syn keyword ngxDirectiveThirdParty drizzle_server
|
||||
|
||||
" Echo Module <http://wiki.nginx.org/NginxHttpEchoModule>
|
||||
" Brings 'echo', 'sleep', 'time', 'exec' and more shell-style goodies to Nginx config file.
|
||||
syn keyword ngxDirectiveThirdParty echo
|
||||
syn keyword ngxDirectiveThirdParty echo_after_body
|
||||
syn keyword ngxDirectiveThirdParty echo_before_body
|
||||
syn keyword ngxDirectiveThirdParty echo_blocking_sleep
|
||||
syn keyword ngxDirectiveThirdParty echo_duplicate
|
||||
syn keyword ngxDirectiveThirdParty echo_end
|
||||
syn keyword ngxDirectiveThirdParty echo_exec
|
||||
syn keyword ngxDirectiveThirdParty echo_flush
|
||||
syn keyword ngxDirectiveThirdParty echo_foreach_split
|
||||
syn keyword ngxDirectiveThirdParty echo_location
|
||||
syn keyword ngxDirectiveThirdParty echo_location_async
|
||||
syn keyword ngxDirectiveThirdParty echo_read_request_body
|
||||
syn keyword ngxDirectiveThirdParty echo_request_body
|
||||
syn keyword ngxDirectiveThirdParty echo_reset_timer
|
||||
syn keyword ngxDirectiveThirdParty echo_sleep
|
||||
syn keyword ngxDirectiveThirdParty echo_subrequest
|
||||
syn keyword ngxDirectiveThirdParty echo_subrequest_async
|
||||
|
||||
" Events Module <http://docs.dutov.org/nginx_modules_events_en.html>
|
||||
" Privides options for start/stop events.
|
||||
syn keyword ngxDirectiveThirdParty on_start
|
||||
syn keyword ngxDirectiveThirdParty on_stop
|
||||
|
||||
" EY Balancer Module <http://github.com/ry/nginx-ey-balancer>
|
||||
" Adds a request queue to Nginx that allows the limiting of concurrent requests passed to the upstream.
|
||||
syn keyword ngxDirectiveThirdParty max_connections
|
||||
syn keyword ngxDirectiveThirdParty max_connections_max_queue_length
|
||||
syn keyword ngxDirectiveThirdParty max_connections_queue_timeout
|
||||
|
||||
" Fancy Indexes Module <https://connectical.com/projects/ngx-fancyindex/wiki>
|
||||
" Like the built-in autoindex module, but fancier.
|
||||
syn keyword ngxDirectiveThirdParty fancyindex
|
||||
syn keyword ngxDirectiveThirdParty fancyindex_exact_size
|
||||
syn keyword ngxDirectiveThirdParty fancyindex_footer
|
||||
syn keyword ngxDirectiveThirdParty fancyindex_header
|
||||
syn keyword ngxDirectiveThirdParty fancyindex_localtime
|
||||
syn keyword ngxDirectiveThirdParty fancyindex_readme
|
||||
syn keyword ngxDirectiveThirdParty fancyindex_readme_mode
|
||||
|
||||
" GeoIP Module (DEPRECATED) <http://wiki.nginx.org/NginxHttp3rdPartyGeoIPModule>
|
||||
" Country code lookups via the MaxMind GeoIP API.
|
||||
syn keyword ngxDirectiveThirdParty geoip_country_file
|
||||
|
||||
" Headers More Module <http://wiki.nginx.org/NginxHttpHeadersMoreModule>
|
||||
" Set and clear input and output headers...more than "add"!
|
||||
syn keyword ngxDirectiveThirdParty more_clear_headers
|
||||
syn keyword ngxDirectiveThirdParty more_clear_input_headers
|
||||
syn keyword ngxDirectiveThirdParty more_set_headers
|
||||
syn keyword ngxDirectiveThirdParty more_set_input_headers
|
||||
|
||||
" HTTP Push Module <http://pushmodule.slact.net/>
|
||||
" Turn Nginx into an adept long-polling HTTP Push (Comet) server.
|
||||
syn keyword ngxDirectiveThirdParty push_buffer_size
|
||||
syn keyword ngxDirectiveThirdParty push_listener
|
||||
syn keyword ngxDirectiveThirdParty push_message_timeout
|
||||
syn keyword ngxDirectiveThirdParty push_queue_messages
|
||||
syn keyword ngxDirectiveThirdParty push_sender
|
||||
|
||||
" HTTP Redis Module <http://people.FreeBSD.ORG/~osa/ngx_http_redis-0.3.1.tar.gz>>
|
||||
" Redis <http://code.google.com/p/redis/> support.>
|
||||
syn keyword ngxDirectiveThirdParty redis_bind
|
||||
syn keyword ngxDirectiveThirdParty redis_buffer_size
|
||||
syn keyword ngxDirectiveThirdParty redis_connect_timeout
|
||||
syn keyword ngxDirectiveThirdParty redis_next_upstream
|
||||
syn keyword ngxDirectiveThirdParty redis_pass
|
||||
syn keyword ngxDirectiveThirdParty redis_read_timeout
|
||||
syn keyword ngxDirectiveThirdParty redis_send_timeout
|
||||
|
||||
" HTTP JavaScript Module <http://wiki.github.com/kung-fu-tzu/ngx_http_js_module>
|
||||
" Embedding SpiderMonkey. Nearly full port on Perl module.
|
||||
syn keyword ngxDirectiveThirdParty js
|
||||
syn keyword ngxDirectiveThirdParty js_filter
|
||||
syn keyword ngxDirectiveThirdParty js_filter_types
|
||||
syn keyword ngxDirectiveThirdParty js_load
|
||||
syn keyword ngxDirectiveThirdParty js_maxmem
|
||||
syn keyword ngxDirectiveThirdParty js_require
|
||||
syn keyword ngxDirectiveThirdParty js_set
|
||||
syn keyword ngxDirectiveThirdParty js_utf8
|
||||
|
||||
" Log Request Speed <http://wiki.nginx.org/NginxHttpLogRequestSpeed>
|
||||
" Log the time it took to process each request.
|
||||
syn keyword ngxDirectiveThirdParty log_request_speed_filter
|
||||
syn keyword ngxDirectiveThirdParty log_request_speed_filter_timeout
|
||||
|
||||
" Memc Module <http://wiki.nginx.org/NginxHttpMemcModule>
|
||||
" An extended version of the standard memcached module that supports set, add, delete, and many more memcached commands.
|
||||
syn keyword ngxDirectiveThirdParty memc_buffer_size
|
||||
syn keyword ngxDirectiveThirdParty memc_cmds_allowed
|
||||
syn keyword ngxDirectiveThirdParty memc_connect_timeout
|
||||
syn keyword ngxDirectiveThirdParty memc_flags_to_last_modified
|
||||
syn keyword ngxDirectiveThirdParty memc_next_upstream
|
||||
syn keyword ngxDirectiveThirdParty memc_pass
|
||||
syn keyword ngxDirectiveThirdParty memc_read_timeout
|
||||
syn keyword ngxDirectiveThirdParty memc_send_timeout
|
||||
syn keyword ngxDirectiveThirdParty memc_upstream_fail_timeout
|
||||
syn keyword ngxDirectiveThirdParty memc_upstream_max_fails
|
||||
|
||||
" Mogilefs Module <http://www.grid.net.ru/nginx/mogilefs.en.html>
|
||||
" Implements a MogileFS client, provides a replace to the Perlbal reverse proxy of the original MogileFS.
|
||||
syn keyword ngxDirectiveThirdParty mogilefs_connect_timeout
|
||||
syn keyword ngxDirectiveThirdParty mogilefs_domain
|
||||
syn keyword ngxDirectiveThirdParty mogilefs_methods
|
||||
syn keyword ngxDirectiveThirdParty mogilefs_noverify
|
||||
syn keyword ngxDirectiveThirdParty mogilefs_pass
|
||||
syn keyword ngxDirectiveThirdParty mogilefs_read_timeout
|
||||
syn keyword ngxDirectiveThirdParty mogilefs_send_timeout
|
||||
syn keyword ngxDirectiveThirdParty mogilefs_tracker
|
||||
|
||||
" MP4 Streaming Lite Module <http://wiki.nginx.org/NginxMP4StreamingLite>
|
||||
" Will seek to a certain time within H.264/MP4 files when provided with a 'start' parameter in the URL.
|
||||
syn keyword ngxDirectiveThirdParty mp4
|
||||
|
||||
" Nginx Notice Module <http://xph.us/software/nginx-notice/>
|
||||
" Serve static file to POST requests.
|
||||
syn keyword ngxDirectiveThirdParty notice
|
||||
syn keyword ngxDirectiveThirdParty notice_type
|
||||
|
||||
" Phusion Passenger <http://www.modrails.com/documentation.html>
|
||||
" Easy and robust deployment of Ruby on Rails application on Apache and Nginx webservers.
|
||||
syn keyword ngxDirectiveThirdParty passenger_base_uri
|
||||
syn keyword ngxDirectiveThirdParty passenger_default_user
|
||||
syn keyword ngxDirectiveThirdParty passenger_enabled
|
||||
syn keyword ngxDirectiveThirdParty passenger_log_level
|
||||
syn keyword ngxDirectiveThirdParty passenger_max_instances_per_app
|
||||
syn keyword ngxDirectiveThirdParty passenger_max_pool_size
|
||||
syn keyword ngxDirectiveThirdParty passenger_pool_idle_time
|
||||
syn keyword ngxDirectiveThirdParty passenger_root
|
||||
syn keyword ngxDirectiveThirdParty passenger_ruby
|
||||
syn keyword ngxDirectiveThirdParty passenger_use_global_queue
|
||||
syn keyword ngxDirectiveThirdParty passenger_user_switching
|
||||
syn keyword ngxDirectiveThirdParty rack_env
|
||||
syn keyword ngxDirectiveThirdParty rails_app_spawner_idle_time
|
||||
syn keyword ngxDirectiveThirdParty rails_env
|
||||
syn keyword ngxDirectiveThirdParty rails_framework_spawner_idle_time
|
||||
syn keyword ngxDirectiveThirdParty rails_spawn_method
|
||||
|
||||
" RDS JSON Module <http://github.com/agentzh/rds-json-nginx-module>
|
||||
" Help ngx_drizzle and other DBD modules emit JSON data.
|
||||
syn keyword ngxDirectiveThirdParty rds_json
|
||||
syn keyword ngxDirectiveThirdParty rds_json_content_type
|
||||
syn keyword ngxDirectiveThirdParty rds_json_format
|
||||
syn keyword ngxDirectiveThirdParty rds_json_ret
|
||||
|
||||
" RRD Graph Module <http://wiki.nginx.org/NginxNgx_rrd_graph>
|
||||
" This module provides an HTTP interface to RRDtool's graphing facilities.
|
||||
syn keyword ngxDirectiveThirdParty rrd_graph
|
||||
syn keyword ngxDirectiveThirdParty rrd_graph_root
|
||||
|
||||
" Secure Download <http://wiki.nginx.org/NginxHttpSecureDownload>
|
||||
" Create expiring links.
|
||||
syn keyword ngxDirectiveThirdParty secure_download
|
||||
syn keyword ngxDirectiveThirdParty secure_download_fail_location
|
||||
syn keyword ngxDirectiveThirdParty secure_download_path_mode
|
||||
syn keyword ngxDirectiveThirdParty secure_download_secret
|
||||
|
||||
" SlowFS Cache Module <http://labs.frickle.com/nginx_ngx_slowfs_cache/>
|
||||
" Module adding ability to cache static files.
|
||||
syn keyword ngxDirectiveThirdParty slowfs_big_file_size
|
||||
syn keyword ngxDirectiveThirdParty slowfs_cache
|
||||
syn keyword ngxDirectiveThirdParty slowfs_cache_key
|
||||
syn keyword ngxDirectiveThirdParty slowfs_cache_min_uses
|
||||
syn keyword ngxDirectiveThirdParty slowfs_cache_path
|
||||
syn keyword ngxDirectiveThirdParty slowfs_cache_purge
|
||||
syn keyword ngxDirectiveThirdParty slowfs_cache_valid
|
||||
syn keyword ngxDirectiveThirdParty slowfs_temp_path
|
||||
|
||||
" Strip Module <http://wiki.nginx.org/NginxHttpStripModule>
|
||||
" Whitespace remover.
|
||||
syn keyword ngxDirectiveThirdParty strip
|
||||
|
||||
" Substitutions Module <http://wiki.nginx.org/NginxHttpSubsModule>
|
||||
" A filter module which can do both regular expression and fixed string substitutions on response bodies.
|
||||
syn keyword ngxDirectiveThirdParty subs_filter
|
||||
syn keyword ngxDirectiveThirdParty subs_filter_types
|
||||
|
||||
" Supervisord Module <http://labs.frickle.com/nginx_ngx_supervisord/>
|
||||
" Module providing nginx with API to communicate with supervisord and manage (start/stop) backends on-demand.
|
||||
syn keyword ngxDirectiveThirdParty supervisord
|
||||
syn keyword ngxDirectiveThirdParty supervisord_inherit_backend_status
|
||||
syn keyword ngxDirectiveThirdParty supervisord_name
|
||||
syn keyword ngxDirectiveThirdParty supervisord_start
|
||||
syn keyword ngxDirectiveThirdParty supervisord_stop
|
||||
|
||||
" Upload Module <http://www.grid.net.ru/nginx/upload.en.html>
|
||||
" Parses multipart/form-data allowing arbitrary handling of uploaded files.
|
||||
syn keyword ngxDirectiveThirdParty upload_aggregate_form_field
|
||||
syn keyword ngxDirectiveThirdParty upload_buffer_size
|
||||
syn keyword ngxDirectiveThirdParty upload_cleanup
|
||||
syn keyword ngxDirectiveThirdParty upload_limit_rate
|
||||
syn keyword ngxDirectiveThirdParty upload_max_file_size
|
||||
syn keyword ngxDirectiveThirdParty upload_max_output_body_len
|
||||
syn keyword ngxDirectiveThirdParty upload_max_part_header_len
|
||||
syn keyword ngxDirectiveThirdParty upload_pass
|
||||
syn keyword ngxDirectiveThirdParty upload_pass_args
|
||||
syn keyword ngxDirectiveThirdParty upload_pass_form_field
|
||||
syn keyword ngxDirectiveThirdParty upload_set_form_field
|
||||
syn keyword ngxDirectiveThirdParty upload_store
|
||||
syn keyword ngxDirectiveThirdParty upload_store_access
|
||||
|
||||
" Upload Progress Module <http://wiki.nginx.org/NginxHttpUploadProgressModule>
|
||||
" Tracks and reports upload progress.
|
||||
syn keyword ngxDirectiveThirdParty report_uploads
|
||||
syn keyword ngxDirectiveThirdParty track_uploads
|
||||
syn keyword ngxDirectiveThirdParty upload_progress
|
||||
syn keyword ngxDirectiveThirdParty upload_progress_content_type
|
||||
syn keyword ngxDirectiveThirdParty upload_progress_header
|
||||
syn keyword ngxDirectiveThirdParty upload_progress_json_output
|
||||
syn keyword ngxDirectiveThirdParty upload_progress_template
|
||||
|
||||
" Upstream Fair Balancer <http://wiki.nginx.org/NginxHttpUpstreamFairModule>
|
||||
" Sends an incoming request to the least-busy backend server, rather than distributing requests round-robin.
|
||||
syn keyword ngxDirectiveThirdParty fair
|
||||
syn keyword ngxDirectiveThirdParty upstream_fair_shm_size
|
||||
|
||||
" Upstream Consistent Hash <http://wiki.nginx.org/NginxHttpUpstreamConsistentHash>
|
||||
" Select backend based on Consistent hash ring.
|
||||
syn keyword ngxDirectiveThirdParty consistent_hash
|
||||
|
||||
" Upstream Hash Module <http://wiki.nginx.org/NginxHttpUpstreamRequestHashModule>
|
||||
" Provides simple upstream load distribution by hashing a configurable variable.
|
||||
syn keyword ngxDirectiveThirdParty hash
|
||||
syn keyword ngxDirectiveThirdParty hash_again
|
||||
|
||||
" XSS Module <http://github.com/agentzh/xss-nginx-module>
|
||||
" Native support for cross-site scripting (XSS) in an nginx.
|
||||
syn keyword ngxDirectiveThirdParty xss_callback_arg
|
||||
syn keyword ngxDirectiveThirdParty xss_get
|
||||
syn keyword ngxDirectiveThirdParty xss_input_types
|
||||
syn keyword ngxDirectiveThirdParty xss_output_type
|
||||
|
||||
" highlight
|
||||
|
||||
hi link ngxComment Comment
|
||||
hi link ngxVariable Identifier
|
||||
hi link ngxVariableBlock Identifier
|
||||
hi link ngxVariableString PreProc
|
||||
hi link ngxBlock Normal
|
||||
hi link ngxString String
|
||||
|
||||
hi link ngxBoolean Boolean
|
||||
hi link ngxDirectiveBlock Statement
|
||||
hi link ngxDirectiveImportant Type
|
||||
hi link ngxDirectiveControl Keyword
|
||||
hi link ngxDirectiveError Constant
|
||||
hi link ngxDirectiveDeprecated Error
|
||||
hi link ngxDirective Identifier
|
||||
hi link ngxDirectiveThirdParty Special
|
||||
|
||||
let b:current_syntax = "nginx"
|
@ -1,28 +0,0 @@
|
||||
" ----- Emulate 'gf' but recognize :line format -----
|
||||
function! GotoFile(w)
|
||||
let curword = expand("<cfile>")
|
||||
if (strlen(curword) == 0)
|
||||
return
|
||||
endif
|
||||
let matchstart = match(curword, ':\d\+$')
|
||||
if matchstart > 0
|
||||
let pos = '+' . strpart(curword, matchstart+1)
|
||||
let fname = strpart(curword, 0, matchstart)
|
||||
else
|
||||
let pos = ""
|
||||
let fname = curword
|
||||
endif
|
||||
" Open new window if requested
|
||||
if a:w == "new"
|
||||
new
|
||||
endif
|
||||
" Use 'find' so path is searched like 'gf' would
|
||||
execute 'find ' . pos . ' ' . fname
|
||||
endfunction
|
||||
|
||||
set isfname+=: " include colon in filenames
|
||||
|
||||
" Override vim commands 'gf', '^Wf', '^W^F'
|
||||
nnoremap gf :call GotoFile("")<CR>
|
||||
nnoremap <C-W>f :call GotoFile("new")<CR>
|
||||
nnoremap <C-W><C-F> :call GotoFile("new")<CR>
|
@ -1,18 +0,0 @@
|
||||
This is a mirror of http://www.vim.org/scripts/script.php?script_id=273
|
||||
|
||||
The "Tag List" plugin is a source code browser plugin for Vim and
|
||||
provides an overview of the structure of source code files and allows
|
||||
you to efficiently browse through source code files for different
|
||||
programming languages. You can visit the taglist plugin home page for
|
||||
more information:
|
||||
|
||||
http://vim-taglist.sourceforge.net
|
||||
|
||||
You can subscribe to the taglist mailing list to post your questions
|
||||
or suggestions for improvement or to report bugs. Visit the following
|
||||
page for subscribing to the mailing list:
|
||||
|
||||
http://groups.yahoo.com/group/taglist/
|
||||
|
||||
For more information about using this plugin, after installing the
|
||||
taglist plugin, use the ":help taglist" command.
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
4
bundle/vim-coffee-script/.gitignore
vendored
4
bundle/vim-coffee-script/.gitignore
vendored
@ -1,4 +0,0 @@
|
||||
.*.sw[a-z]
|
||||
.*.un~
|
||||
doc/tags
|
||||
|
@ -1,15 +0,0 @@
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright (C) 2010 to 2012 Mick Koch <kchmck@gmail.com>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||
|
||||
|
@ -1,25 +0,0 @@
|
||||
REF = HEAD
|
||||
VERSION = $(shell git describe --always $(REF))
|
||||
|
||||
ARCHIVE = vim-coffee-script-$(VERSION).zip
|
||||
ARCHIVE_DIRS = after autoload compiler doc ftdetect ftplugin indent syntax
|
||||
|
||||
# Don't do anything by default.
|
||||
all:
|
||||
|
||||
# Make vim.org zipball.
|
||||
archive:
|
||||
git archive $(REF) -o $(ARCHIVE) -- $(ARCHIVE_DIRS)
|
||||
|
||||
# Remove zipball.
|
||||
clean:
|
||||
-rm -f $(ARCHIVE)
|
||||
|
||||
# Build the list of syntaxes for @coffeeAll.
|
||||
coffeeAll:
|
||||
@grep -E 'syn (match|region)' syntax/coffee.vim |\
|
||||
grep -v 'contained' |\
|
||||
awk '{print $$3}' |\
|
||||
uniq
|
||||
|
||||
.PHONY: all archive clean hash coffeeAll
|
@ -1,18 +0,0 @@
|
||||
### Version 002 (December 5, 2011)
|
||||
|
||||
Added binary numbers (0b0101) and fixed some bugs (#9, #62, #63, #65).
|
||||
|
||||
### Version 001 (October 18, 2011)
|
||||
|
||||
Removed deprecated `coffee_folding` option, added `coffee_compile_vert` option,
|
||||
split out compiler, fixed indentation and syntax bugs, and added Haml support
|
||||
and omnicompletion.
|
||||
|
||||
- The coffee compiler is now a proper vim compiler that can be loaded with
|
||||
`:compiler coffee`.
|
||||
- The `coffee_compile_vert` option can now be set to split the CoffeeCompile
|
||||
buffer vertically by default.
|
||||
- CoffeeScript is now highlighted inside the `:coffeescript` filter in Haml.
|
||||
- Omnicompletion (`:help compl-omni`) now uses JavaScript's dictionary to
|
||||
complete words.
|
||||
- We now have a fancy version number.
|
@ -1,599 +0,0 @@
|
||||
This project adds [CoffeeScript] support to vim. It covers syntax, indenting,
|
||||
compiling, and more.
|
||||
|
||||

|
||||
|
||||
[CoffeeScript]: http://coffeescript.org/
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- Installation
|
||||
- [Requirements](#requirements)
|
||||
- [Install using Pathogen](#install-using-pathogen)
|
||||
- [Install using Vundle](#install-using-vundle)
|
||||
- [Install from a Zip File](#install-from-a-zip-file)
|
||||
- Coffee Commands
|
||||
- [Compile to JavaScript](#compile-to-javascript)
|
||||
- [Compile CoffeeScript Snippets](#coffeecompile-compile-coffeescript-snippets)
|
||||
- [Live Preview Compiling](#coffeewatch-live-preview-compiling)
|
||||
- [Run CoffeeScript Snippets](#coffeerun-run-coffeescript-snippets)
|
||||
- [Lint your CoffeeScript](#coffeelint-lint-your-coffeescript)
|
||||
- Extras
|
||||
- [Literate CoffeeScript](#literate-coffeescript)
|
||||
- [CoffeeScript in HTML](#coffeescript-in-html)
|
||||
- [CoffeeScript in Haml](#coffeescript-in-haml)
|
||||
- Configuration
|
||||
- [Custom Autocmds](#custom-autocmds)
|
||||
- [Configuration Variables](#configuration-variables)
|
||||
- [Configure Syntax Highlighting](#configure-syntax-highlighting)
|
||||
- [Tune Vim for CoffeeScript](#tune-vim-for-coffeescript)
|
||||
|
||||
## Requirements
|
||||
|
||||
- vim 7.4 or later
|
||||
- coffee 1.2.0 or later
|
||||
|
||||
## Install using Pathogen
|
||||
|
||||
This project uses rolling releases based on git commits, so pathogen is a
|
||||
natural fit for it. If you're already using pathogen, you can skip to step 4.
|
||||
|
||||
1. Install [pathogen.vim] into `~/.vim/autoload/` (see [pathogen's
|
||||
readme][install-pathogen] for more information.)
|
||||
|
||||
[pathogen.vim]: http://www.vim.org/scripts/script.php?script_id=2332
|
||||
[install-pathogen]: https://github.com/tpope/vim-pathogen#installation
|
||||
|
||||
2. Enable pathogen in your vimrc. Here's a bare-minimum vimrc that enables
|
||||
all the features of `vim-coffee-script`:
|
||||
|
||||
```vim
|
||||
call pathogen#infect()
|
||||
syntax enable
|
||||
filetype plugin indent on
|
||||
```
|
||||
|
||||
If you already have a vimrc built up, just make sure it contains these calls,
|
||||
in this order.
|
||||
|
||||
3. Create the directory `~/.vim/bundle/`:
|
||||
|
||||
mkdir ~/.vim/bundle
|
||||
|
||||
4. Clone the `vim-coffee-script` repo into `~/.vim/bundle/`:
|
||||
|
||||
git clone https://github.com/kchmck/vim-coffee-script.git ~/.vim/bundle/vim-coffee-script/
|
||||
|
||||
Updating takes two steps:
|
||||
|
||||
1. Change into `~/.vim/bundle/vim-coffee-script/`:
|
||||
|
||||
cd ~/.vim/bundle/vim-coffee-script
|
||||
|
||||
2. Pull in the latest changes:
|
||||
|
||||
git pull
|
||||
|
||||
## Install using Vundle
|
||||
|
||||
1. [Install Vundle] into `~/.vim/bundle/`.
|
||||
|
||||
[Install Vundle]: https://github.com/gmarik/vundle#quick-start
|
||||
|
||||
2. Configure your vimrc for Vundle. Here's a bare-minimum vimrc that enables all
|
||||
the features of `vim-coffee-script`:
|
||||
|
||||
|
||||
```vim
|
||||
set nocompatible
|
||||
filetype off
|
||||
|
||||
set rtp+=~/.vim/bundle/vundle/
|
||||
call vundle#rc()
|
||||
|
||||
Bundle 'kchmck/vim-coffee-script'
|
||||
|
||||
syntax enable
|
||||
filetype plugin indent on
|
||||
```
|
||||
|
||||
If you're adding Vundle to a built-up vimrc, just make sure all these calls
|
||||
are in there and that they occur in this order.
|
||||
|
||||
3. Open vim and run `:BundleInstall`.
|
||||
|
||||
To update, open vim and run `:BundleInstall!` (notice the bang!)
|
||||
|
||||
## Install from a Zip File
|
||||
|
||||
1. Download the latest zip file from [vim.org][zip].
|
||||
|
||||
2. Extract the archive into `~/.vim/`:
|
||||
|
||||
unzip -od ~/.vim/ ARCHIVE.zip
|
||||
|
||||
This should create the files `~/.vim/autoload/coffee.vim`,
|
||||
`~/.vim/compiler/coffee.vim`, etc.
|
||||
|
||||
You can update the plugin using the same steps.
|
||||
|
||||
[zip]: http://www.vim.org/scripts/script.php?script_id=3590
|
||||
|
||||
## Compile to JavaScript
|
||||
|
||||
A `coffee` wrapper for use with `:make` is enabled automatically for coffee
|
||||
files if no other compiler is loaded. To enable it manually, run
|
||||
|
||||
:compiler coffee
|
||||
|
||||
The `:make` command is then configured to use the `coffee` compiler and
|
||||
recognize its errors. I've included a quick reference here but be sure to check
|
||||
out [`:help :make`][make] for a full reference of the command.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
[make]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#:make_makeprg
|
||||
|
||||
Consider the full signature of a `:make` call as
|
||||
|
||||
:[silent] make[!] [COFFEE-OPTIONS]...
|
||||
|
||||
By default `:make` shows all compiler output and jumps to the first line
|
||||
reported as an error. Compiler output can be hidden with a leading `:silent`:
|
||||
|
||||
:silent make
|
||||
|
||||
Line-jumping can be turned off by adding a bang:
|
||||
|
||||
:make!
|
||||
|
||||
`COFFEE-OPTIONS` given to `:make` are passed along to `coffee` (see also
|
||||
[`coffee_make_options`](#coffee_make_options)):
|
||||
|
||||
:make --bare --output /some/dir
|
||||
|
||||
See the [full table of options](http://coffeescript.org/#usage) for a
|
||||
list of all the options that `coffee` recognizes.
|
||||
|
||||
*Configuration*: [`coffee_compiler`](#coffee_compiler),
|
||||
[`coffee_make_options`](#coffee_make_options)
|
||||
|
||||
#### The quickfix window
|
||||
|
||||
Compiler errors are added to the [quickfix] list by `:make`, but the quickfix
|
||||
window isn't automatically shown. The [`:cwindow`][cwindow] command will pop up
|
||||
the quickfix window if there are any errors:
|
||||
|
||||
:make
|
||||
:cwindow
|
||||
|
||||
This is usually the desired behavior, so you may want to add an autocmd to your
|
||||
vimrc to do this automatically:
|
||||
|
||||
autocmd QuickFixCmdPost * nested cwindow | redraw!
|
||||
|
||||
The `redraw!` command is needed to fix a redrawing quirk in terminal vim, but
|
||||
can removed for gVim.
|
||||
|
||||
[quickfix]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#quickfix
|
||||
[cwindow]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#:cwindow
|
||||
|
||||
#### Recompile on write
|
||||
|
||||
To recompile a file when it's written, add a `BufWritePost` autocmd to your
|
||||
vimrc:
|
||||
|
||||
autocmd BufWritePost *.coffee silent make!
|
||||
|
||||
#### Cake and Cakefiles
|
||||
|
||||
A `cake` compiler is also available with the call
|
||||
|
||||
:compiler cake
|
||||
|
||||
You can then use `:make` as above to run your Cakefile and capture any `coffee`
|
||||
errors:
|
||||
|
||||
:silent make build
|
||||
|
||||
It runs within the current directory, so make sure you're in the directory of
|
||||
your Cakefile before calling it.
|
||||
|
||||
*Configuration*: [`coffee_cake`](#coffee_cake),
|
||||
[`coffee_cake_options`](#coffee_cake_options)
|
||||
|
||||
## CoffeeCompile: Compile CoffeeScript Snippets
|
||||
|
||||
CoffeeCompile shows how the current file or a snippet of CoffeeScript is
|
||||
compiled to JavaScript.
|
||||
|
||||
:[RANGE] CoffeeCompile [vert[ical]] [WINDOW-SIZE]
|
||||
|
||||
Calling `:CoffeeCompile` without a range compiles the whole file:
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
Calling it with a range, like in visual mode, compiles only the selected snippet
|
||||
of CoffeeScript:
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
Each file gets its own CoffeeCompile buffer, and the same buffer is used for all
|
||||
future calls of `:CoffeeCompile` on that file. It can be quickly closed by
|
||||
hitting `q` in normal mode.
|
||||
|
||||
Using `vert` opens the CoffeeCompile buffer vertically instead of horizontally
|
||||
(see also [`coffee_compile_vert`](#coffee_compile_vert)):
|
||||
|
||||
:CoffeeCompile vert
|
||||
|
||||
By default the CoffeeCompile buffer splits the source buffer in half, but this
|
||||
can be overridden by passing in a `WINDOW-SIZE`:
|
||||
|
||||
:CoffeeCompile 4
|
||||
|
||||
*Configuration*: [`coffee_compiler`](#coffee_compiler`),
|
||||
[`coffee_compile_vert`](#coffee_compile_vert)
|
||||
|
||||
#### Quick syntax checking
|
||||
|
||||
If compiling a snippet results in a compiler error, CoffeeCompile adds that
|
||||
error to the [quickfix] list.
|
||||
|
||||
[quickfix]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#quickfix
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
You can use this to quickly check the syntax of a snippet.
|
||||
|
||||
## CoffeeWatch: Live Preview Compiling
|
||||
|
||||
CoffeeWatch emulates using the Try CoffeeScript preview box on the [CoffeeScript
|
||||
homepage][CoffeeScript].
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
CoffeeWatch takes the same options as CoffeeCompile:
|
||||
|
||||
:CoffeeWatch [vert[ical]] [WINDOW-SIZE]
|
||||
|
||||
After a source buffer is watched, leaving insert mode or saving the file fires
|
||||
off a recompile of the CoffeeScript:
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
You can force recompilation by calling `:CoffeeWatch`.
|
||||
|
||||
To get synchronized scrolling of the source buffer and CoffeeWatch buffer, set
|
||||
[`'scrollbind'`](http://vimdoc.sourceforge.net/htmldoc/options.html#'scrollbind')
|
||||
on each:
|
||||
|
||||
:setl scrollbind
|
||||
|
||||
*Configuration*: [`coffee_compiler`](#coffee_compiler),
|
||||
[`coffee_watch_vert`](#coffee_watch_vert)
|
||||
|
||||
## CoffeeRun: Run CoffeeScript Snippets
|
||||
|
||||
CoffeeRun compiles the current file or selected snippet and runs the resulting
|
||||
JavaScript.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
The command has two forms:
|
||||
|
||||
:CoffeeRun [PROGRAM-OPTIONS]...
|
||||
|
||||
This form applies when no `RANGE` is given or when the given range is `1,$`
|
||||
(first line to last line). It allows passing `PROGRAM-OPTIONS` to your compiled
|
||||
program. The filename is passed directly to `coffee` so you must save the file
|
||||
for your changes to take effect.
|
||||
|
||||
:RANGE CoffeeRun [COFFEE-OPTIONS]...
|
||||
|
||||
This form applies with all other ranges. It compiles and runs the lines within
|
||||
the given `RANGE` and any extra `COFFEE-OPTIONS` are passed to `coffee`.
|
||||
|
||||
*Configuration*: [`coffee_compiler`](#coffee_compiler),
|
||||
[`coffee_run_vert`](#coffee_run_vert)
|
||||
|
||||
## CoffeeLint: Lint your CoffeeScript
|
||||
|
||||
CoffeeLint runs [coffeelint](http://www.coffeelint.org/) (version 0.5.7 or later
|
||||
required) on the current file and adds any issues to the [quickfix] list.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
:[RANGE] CoffeeLint[!] [COFFEELINT-OPTIONS]... [ | cwindow]
|
||||
|
||||
If a `RANGE` is given, only those lines are piped to `coffeelint`. Options given
|
||||
in `COFFEELINT-OPTIONS` are passed to `coffeelint` (see also
|
||||
[`coffee_lint_options`](#coffee_lint_options)):
|
||||
|
||||
:CoffeeLint -f lint.json
|
||||
|
||||
It behaves very similar to `:make`, described [above](#compile-to-javascript).
|
||||
|
||||
:CoffeeLint! | cwindow
|
||||
|
||||
*Configuration*: [`coffee_linter`](#coffee_linter),
|
||||
[`coffee_lint_options`](#coffee_lint_options)
|
||||
|
||||
## Literate CoffeeScript
|
||||
|
||||
Literate CoffeeScript syntax and indent support is provided by
|
||||
[vim-literate-coffeescript]. The `Coffee` commands detect when they're running
|
||||
on a litcoffee file and pass the `--literate` flag to their respective tools,
|
||||
but at this time the commands are not automatically loaded when a litcoffee file
|
||||
is opened.
|
||||
|
||||
[vim-literate-coffeescript]: https://github.com/mintplant/vim-literate-coffeescript
|
||||
|
||||
To load them, run
|
||||
|
||||
runtime ftplugin/coffee.vim
|
||||
|
||||
while inside a litcoffee buffer. To do this automatically, add
|
||||
|
||||
autocmd FileType litcoffee runtime ftplugin/coffee.vim
|
||||
|
||||
to your vimrc.
|
||||
|
||||
## CoffeeScript in HTML
|
||||
|
||||
CoffeeScript is highlighted and indented within
|
||||
|
||||
```html
|
||||
<script type="text/coffeescript">
|
||||
</script>
|
||||
```
|
||||
|
||||
blocks in html files.
|
||||
|
||||
## CoffeeScript in Haml
|
||||
|
||||
CoffeeScript is highlighted within the `:coffeescript` filter in haml files:
|
||||
|
||||
```haml
|
||||
:coffeescript
|
||||
console.log "hullo"
|
||||
```
|
||||
|
||||
At this time, coffee indenting doesn't work in these blocks.
|
||||
|
||||
## Custom Autocmds
|
||||
|
||||
You can [define commands][autocmd-explain] to be ran automatically on these
|
||||
custom events.
|
||||
|
||||
In all cases, the name of the command running the event (`CoffeeCompile`,
|
||||
`CoffeeWatch`, or `CoffeeRun`) is matched by the [`{pat}`][autocmd] argument.
|
||||
You can match all commands with a `*` or only specific commands by separating
|
||||
them with a comma: `CoffeeCompile,CoffeeWatch`.
|
||||
|
||||
[autocmd-explain]: http://vimdoc.sourceforge.net/htmldoc/usr_40.html#40.3
|
||||
[autocmd]: http://vimdoc.sourceforge.net/htmldoc/autocmd.html#:autocmd
|
||||
|
||||
#### CoffeeBufNew
|
||||
|
||||
CoffeeBufNew is ran when a new scratch buffer is created. It's called from the
|
||||
new buffer, so it can be used to do additional set up.
|
||||
|
||||
```vim
|
||||
augroup CoffeeBufNew
|
||||
autocmd User * set wrap
|
||||
augroup END
|
||||
```
|
||||
|
||||
*Used By*: CoffeeCompile, CoffeeWatch, CoffeeRun
|
||||
|
||||
#### CoffeeBufUpdate
|
||||
|
||||
CoffeeBufUpdate is ran when a scratch buffer is updated with output from
|
||||
`coffee`. It's called from the scratch buffer, so it can be used to alter the
|
||||
compiled output.
|
||||
|
||||
```vim
|
||||
" Switch back to the source buffer after updating.
|
||||
augroup CoffeeBufUpdate
|
||||
autocmd User CoffeeCompile,CoffeeRun exec bufwinnr(b:coffee_src_buf) 'wincmd w'
|
||||
augroup END
|
||||
```
|
||||
|
||||
For example, to strip off the "Generated by" comment on the first line, put this
|
||||
in your vimrc:
|
||||
|
||||
```vim
|
||||
function! s:RemoveGeneratedBy()
|
||||
" If there was an error compiling, there's no comment to remove.
|
||||
if v:shell_error
|
||||
return
|
||||
endif
|
||||
|
||||
" Save cursor position.
|
||||
let pos = getpos('.')
|
||||
|
||||
" Remove first line.
|
||||
set modifiable
|
||||
1 delete _
|
||||
set nomodifiable
|
||||
|
||||
" Restore cursor position.
|
||||
call setpos('.', pos)
|
||||
endfunction
|
||||
|
||||
augroup CoffeeBufUpdate
|
||||
autocmd User CoffeeCompile,CoffeeWatch call s:RemoveGeneratedBy()
|
||||
augroup END
|
||||
```
|
||||
|
||||
*Used By*: CoffeeCompile, CoffeeWatch, CoffeeRun
|
||||
|
||||
## Configuration Variables
|
||||
|
||||
This is the full list of configuration variables available, with example
|
||||
settings and default values. Use these in your vimrc to control the default
|
||||
behavior.
|
||||
|
||||
#### coffee\_indent\_keep\_current
|
||||
|
||||
By default, the indent function matches the indent of the previous line if it
|
||||
doesn't find a reason to indent or outdent. To change this behavior so it
|
||||
instead keeps the [current indent of the cursor][98], use
|
||||
|
||||
let coffee_indent_keep_current = 1
|
||||
|
||||
[98]: https://github.com/kchmck/vim-coffee-script/pull/98
|
||||
|
||||
*Default*: `unlet coffee_indent_keep_current`
|
||||
|
||||
Note that if you change this after a coffee file has been loaded, you'll have to
|
||||
reload the indent script for the change to take effect:
|
||||
|
||||
unlet b:did_indent | runtime indent/coffee.vim
|
||||
|
||||
#### coffee\_compiler
|
||||
|
||||
Path to the `coffee` executable used by the `Coffee` commands:
|
||||
|
||||
let coffee_compiler = '/usr/bin/coffee'
|
||||
|
||||
*Default*: `'coffee'` (search `$PATH` for executable)
|
||||
|
||||
#### coffee\_make\_options
|
||||
|
||||
Options to pass to `coffee` with `:make`:
|
||||
|
||||
let coffee_make_options = '--bare'
|
||||
|
||||
*Default*: `''` (nothing)
|
||||
|
||||
Note that `coffee_make_options` is embedded into `'makeprg'`, so `:compiler
|
||||
coffee` must be ran after changing `coffee_make_options` for the changes to take
|
||||
effect.
|
||||
|
||||
#### coffee\_cake
|
||||
|
||||
Path to the `cake` executable:
|
||||
|
||||
let coffee_cake = '/opt/bin/cake'
|
||||
|
||||
*Default*: `'cake'` (search `$PATH` for executable)
|
||||
|
||||
#### coffee\_cake\_options
|
||||
|
||||
Options to pass to `cake` with `:make`:
|
||||
|
||||
let coffee_cake_options = 'build'
|
||||
|
||||
*Default*: `''` (nothing)
|
||||
|
||||
#### coffee\_linter
|
||||
|
||||
Path to the `coffeelint` executable:
|
||||
|
||||
let coffee_linter = '/opt/bin/coffeelint'
|
||||
|
||||
*Default*: `'coffeelint'` (search `$PATH` for executable)
|
||||
|
||||
#### coffee\_lint\_options
|
||||
|
||||
Options to pass to `coffeelint`:
|
||||
|
||||
let coffee_lint_options = '-f lint.json'
|
||||
|
||||
*Default*: `''` (nothing)
|
||||
|
||||
#### coffee\_compile\_vert
|
||||
|
||||
Open the CoffeeCompile buffer with a vertical split instead of a horizontal
|
||||
one:
|
||||
|
||||
let coffee_compile_vert = 1
|
||||
|
||||
*Default*: `unlet coffee_compile_vert`
|
||||
|
||||
#### coffee\_watch\_vert
|
||||
|
||||
Open the CoffeeWatch buffer with a vertical split instead of a horizontal
|
||||
one:
|
||||
|
||||
let coffee_watch_vert = 1
|
||||
|
||||
*Default*: `unlet coffee_watch_vert`
|
||||
|
||||
#### coffee\_run\_vert
|
||||
|
||||
Open the CoffeeRun buffer with a vertical split instead of a horizontal
|
||||
one:
|
||||
|
||||
let coffee_run_vert = 1
|
||||
|
||||
*Default*: `unlet coffee_run_vert`
|
||||
|
||||
## Configure Syntax Highlighting
|
||||
|
||||
Add these lines to your vimrc to disable the relevant syntax group.
|
||||
|
||||
#### Disable trailing whitespace error
|
||||
|
||||
Trailing whitespace is highlighted as an error by default. This can be disabled
|
||||
with:
|
||||
|
||||
hi link coffeeSpaceError NONE
|
||||
|
||||
#### Disable trailing semicolon error
|
||||
|
||||
Trailing semicolons are considered an error (for help transitioning from
|
||||
JavaScript.) This can be disabled with:
|
||||
|
||||
hi link coffeeSemicolonError NONE
|
||||
|
||||
#### Disable reserved words error
|
||||
|
||||
Reserved words like `function` and `var` are highlighted as an error where
|
||||
they're not allowed in CoffeeScript. This can be disabled with:
|
||||
|
||||
hi link coffeeReservedError NONE
|
||||
|
||||
## Tune Vim for CoffeeScript
|
||||
|
||||
Changing these core settings can make vim more CoffeeScript friendly.
|
||||
|
||||
#### Fold by indentation
|
||||
|
||||
Folding by indentation works well for CoffeeScript functions and classes:
|
||||
|
||||

|
||||
|
||||
To fold by indentation in CoffeeScript files, add this line to your vimrc:
|
||||
|
||||
autocmd BufNewFile,BufReadPost *.coffee setl foldmethod=indent nofoldenable
|
||||
|
||||
With this, folding is disabled by default but can be quickly toggled per-file
|
||||
by hitting `zi`. To enable folding by default, remove `nofoldenable`:
|
||||
|
||||
autocmd BufNewFile,BufReadPost *.coffee setl foldmethod=indent
|
||||
|
||||
#### Two-space indentation
|
||||
|
||||
To get standard two-space indentation in CoffeeScript files, add this line to
|
||||
your vimrc:
|
||||
|
||||
autocmd BufNewFile,BufReadPost *.coffee setl shiftwidth=2 expandtab
|
@ -1,44 +0,0 @@
|
||||
Thanks to all bug reporters, and special thanks to those who have contributed
|
||||
code:
|
||||
|
||||
Brian Egan (brianegan):
|
||||
Initial compiling support
|
||||
|
||||
Ches Martin (ches):
|
||||
Initial vim docs
|
||||
|
||||
Chris Hoffman (cehoffman):
|
||||
Add new keywoards from, to, and do
|
||||
Highlight the - in negative integers
|
||||
Add here regex highlighting, increase fold level for here docs
|
||||
|
||||
David Wilhelm (bigfish):
|
||||
CoffeeRun command
|
||||
|
||||
Jay Adkisson (jayferd):
|
||||
Support for eco templates
|
||||
|
||||
Karl Guertin (grayrest)
|
||||
Cakefiles are coffeescript
|
||||
|
||||
Maciej Konieczny (narfdotpl):
|
||||
Fix funny typo
|
||||
|
||||
Matt Sacks (mattsa):
|
||||
Javascript omni-completion
|
||||
coffee_compile_vert option
|
||||
|
||||
Nick Stenning (nickstenning):
|
||||
Fold by indentation for coffeescript
|
||||
|
||||
Simon Lipp (sloonz):
|
||||
Trailing spaces are not error on lines containing only spaces
|
||||
|
||||
Stéphan Kochen (stephank):
|
||||
Initial HTML CoffeeScript highlighting
|
||||
|
||||
Sven Felix Oberquelle (Svelix):
|
||||
Haml CoffeeScript highlighting
|
||||
|
||||
Wei Dai (clvv):
|
||||
Fix the use of Vim built-in make command.
|
@ -1 +0,0 @@
|
||||
- Don't highlight bad operator combinations
|
@ -1,33 +0,0 @@
|
||||
" Language: CoffeeScript
|
||||
" Maintainer: Mick Koch <kchmck@gmail.com>
|
||||
" URL: http://github.com/kchmck/vim-coffee-script
|
||||
" License: WTFPL
|
||||
|
||||
" Load the coffee and html indent functions.
|
||||
silent! unlet b:did_indent
|
||||
runtime indent/coffee.vim
|
||||
let s:coffeeIndentExpr = &l:indentexpr
|
||||
|
||||
" Load html last so it can overwrite coffee settings.
|
||||
silent! unlet b:did_indent
|
||||
runtime indent/html.vim
|
||||
let s:htmlIndentExpr = &l:indentexpr
|
||||
|
||||
" Inject our wrapper indent function.
|
||||
setlocal indentexpr=GetCoffeeHtmlIndent(v:lnum)
|
||||
|
||||
function! GetCoffeeHtmlIndent(curlinenum)
|
||||
" See if we're inside a coffeescript block.
|
||||
let scriptlnum = searchpair('<script [^>]*type="text/coffeescript"[^>]*>', '',
|
||||
\ '</script>', 'bWn')
|
||||
let prevlnum = prevnonblank(a:curlinenum)
|
||||
|
||||
" If we're in the script block and the previous line isn't the script tag
|
||||
" itself, use coffee indenting.
|
||||
if scriptlnum && scriptlnum != prevlnum
|
||||
exec 'return ' s:coffeeIndentExpr
|
||||
endif
|
||||
|
||||
" Otherwise use html indenting.
|
||||
exec 'return ' s:htmlIndentExpr
|
||||
endfunction
|
@ -1,13 +0,0 @@
|
||||
" Language: CoffeeScript
|
||||
" Maintainer: Sven Felix Oberquelle <Svelix.Github@gmail.com>
|
||||
" URL: http://github.com/kchmck/vim-coffee-script
|
||||
" License: WTFPL
|
||||
|
||||
" Inherit coffee from html so coffeeComment isn't redefined and given higher
|
||||
" priority than hamlInterpolation.
|
||||
syn cluster hamlCoffeescript contains=@htmlCoffeeScript
|
||||
syn region hamlCoffeescriptFilter matchgroup=hamlFilter
|
||||
\ start="^\z(\s*\):coffee\z(script\)\?\s*$"
|
||||
\ end="^\%(\z1 \| *$\)\@!"
|
||||
\ contains=@hamlCoffeeScript,hamlInterpolation
|
||||
\ keepend
|
@ -1,11 +0,0 @@
|
||||
" Language: CoffeeScript
|
||||
" Maintainer: Mick Koch <kchmck@gmail.com>
|
||||
" URL: http://github.com/kchmck/vim-coffee-script
|
||||
" License: WTFPL
|
||||
|
||||
" Syntax highlighting for text/coffeescript script tags
|
||||
syn include @htmlCoffeeScript syntax/coffee.vim
|
||||
syn region coffeeScript start=#<script [^>]*type="text/coffeescript"[^>]*>#
|
||||
\ end=#</script>#me=s-1 keepend
|
||||
\ contains=@htmlCoffeeScript,htmlScriptTag,@htmlPreproc
|
||||
\ containedin=htmlHead
|
@ -1,54 +0,0 @@
|
||||
" Language: CoffeeScript
|
||||
" Maintainer: Mick Koch <kchmck@gmail.com>
|
||||
" URL: http://github.com/kchmck/vim-coffee-script
|
||||
" License: WTFPL
|
||||
|
||||
" Set up some common global/buffer variables.
|
||||
function! coffee#CoffeeSetUpVariables()
|
||||
" Path to coffee executable
|
||||
if !exists('g:coffee_compiler')
|
||||
let g:coffee_compiler = 'coffee'
|
||||
endif
|
||||
|
||||
" Options passed to coffee with make
|
||||
if !exists('g:coffee_make_options')
|
||||
let g:coffee_make_options = ''
|
||||
endif
|
||||
|
||||
" Path to cake executable
|
||||
if !exists('g:coffee_cake')
|
||||
let g:coffee_cake = 'cake'
|
||||
endif
|
||||
|
||||
" Extra options passed to cake
|
||||
if !exists('g:coffee_cake_options')
|
||||
let g:coffee_cake_options = ''
|
||||
endif
|
||||
|
||||
" Path to coffeelint executable
|
||||
if !exists('g:coffee_linter')
|
||||
let g:coffee_linter = 'coffeelint'
|
||||
endif
|
||||
|
||||
" Options passed to CoffeeLint
|
||||
if !exists('g:coffee_lint_options')
|
||||
let g:coffee_lint_options = ''
|
||||
endif
|
||||
|
||||
" Pass the litcoffee flag to tools in this buffer if a litcoffee file is open.
|
||||
" Let the variable be overwritten so it can be updated if a different filetype
|
||||
" is set.
|
||||
if &filetype == 'litcoffee'
|
||||
let b:coffee_litcoffee = '--literate'
|
||||
else
|
||||
let b:coffee_litcoffee = ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! coffee#CoffeeSetUpErrorFormat()
|
||||
CompilerSet errorformat=Error:\ In\ %f\\,\ %m\ on\ line\ %l,
|
||||
\Error:\ In\ %f\\,\ Parse\ error\ on\ line\ %l:\ %m,
|
||||
\SyntaxError:\ In\ %f\\,\ %m,
|
||||
\%f:%l:%c:\ error:\ %m,
|
||||
\%-G%.%#
|
||||
endfunction
|
@ -1,15 +0,0 @@
|
||||
" Language: CoffeeScript
|
||||
" Maintainer: Mick Koch <kchmck@gmail.com>
|
||||
" URL: http://github.com/kchmck/vim-coffee-script
|
||||
" License: WTFPL
|
||||
|
||||
if exists('current_compiler')
|
||||
finish
|
||||
endif
|
||||
|
||||
let current_compiler = 'cake'
|
||||
call coffee#CoffeeSetUpVariables()
|
||||
|
||||
exec 'CompilerSet makeprg=' . escape(g:coffee_cake . ' ' .
|
||||
\ g:coffee_cake_options . ' $*', ' ')
|
||||
call coffee#CoffeeSetUpErrorFormat()
|
@ -1,82 +0,0 @@
|
||||
" Language: CoffeeScript
|
||||
" Maintainer: Mick Koch <kchmck@gmail.com>
|
||||
" URL: http://github.com/kchmck/vim-coffee-script
|
||||
" License: WTFPL
|
||||
|
||||
" All this is needed to support compiling filenames with spaces, quotes, and
|
||||
" such. The filename is escaped and embedded into the `makeprg` setting.
|
||||
"
|
||||
" Because of this, `makeprg` must be updated on every file rename. And because
|
||||
" of that, `CompilerSet` can't be used because it doesn't exist when the
|
||||
" rename autocmd is ran. So, we have to do some checks to see whether `compiler`
|
||||
" was called locally or globally, and respect that in the rest of the script.
|
||||
|
||||
if exists('current_compiler')
|
||||
finish
|
||||
endif
|
||||
|
||||
let current_compiler = 'coffee'
|
||||
call coffee#CoffeeSetUpVariables()
|
||||
|
||||
" Pattern to check if coffee is the compiler
|
||||
let s:pat = '^' . current_compiler
|
||||
|
||||
" Get a `makeprg` for the current filename.
|
||||
function! s:GetMakePrg()
|
||||
return g:coffee_compiler .
|
||||
\ ' -c' .
|
||||
\ ' ' . b:coffee_litcoffee .
|
||||
\ ' ' . g:coffee_make_options .
|
||||
\ ' $*' .
|
||||
\ ' ' . fnameescape(expand('%'))
|
||||
endfunction
|
||||
|
||||
" Set `makeprg` and return 1 if coffee is still the compiler, else return 0.
|
||||
function! s:SetMakePrg()
|
||||
if &l:makeprg =~ s:pat
|
||||
let &l:makeprg = s:GetMakePrg()
|
||||
elseif &g:makeprg =~ s:pat
|
||||
let &g:makeprg = s:GetMakePrg()
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
" Set a dummy compiler so we can check whether to set locally or globally.
|
||||
exec 'CompilerSet makeprg=' . current_compiler
|
||||
" Then actually set the compiler.
|
||||
call s:SetMakePrg()
|
||||
call coffee#CoffeeSetUpErrorFormat()
|
||||
|
||||
function! s:CoffeeMakeDeprecated(bang, args)
|
||||
echoerr 'CoffeeMake is deprecated! Please use :make instead, its behavior ' .
|
||||
\ 'is identical.'
|
||||
sleep 5
|
||||
exec 'make' . a:bang a:args
|
||||
endfunction
|
||||
|
||||
" Compile the current file.
|
||||
command! -bang -bar -nargs=* CoffeeMake
|
||||
\ call s:CoffeeMakeDeprecated(<q-bang>, <q-args>)
|
||||
|
||||
" Set `makeprg` on rename since we embed the filename in the setting.
|
||||
augroup CoffeeUpdateMakePrg
|
||||
autocmd!
|
||||
|
||||
" Update `makeprg` if coffee is still the compiler, else stop running this
|
||||
" function.
|
||||
function! s:UpdateMakePrg()
|
||||
if !s:SetMakePrg()
|
||||
autocmd! CoffeeUpdateMakePrg
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Set autocmd locally if compiler was set locally.
|
||||
if &l:makeprg =~ s:pat
|
||||
autocmd BufWritePre,BufFilePost <buffer> call s:UpdateMakePrg()
|
||||
else
|
||||
autocmd BufWritePre,BufFilePost call s:UpdateMakePrg()
|
||||
endif
|
||||
augroup END
|
@ -1,4 +0,0 @@
|
||||
Please see the project readme for up-to-date docs:
|
||||
https://github.com/kchmck/vim-coffee-script
|
||||
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
@ -1,17 +0,0 @@
|
||||
" Language: CoffeeScript
|
||||
" Maintainer: Mick Koch <kchmck@gmail.com>
|
||||
" URL: http://github.com/kchmck/vim-coffee-script
|
||||
" License: WTFPL
|
||||
|
||||
autocmd BufNewFile,BufRead *.coffee set filetype=coffee
|
||||
autocmd BufNewFile,BufRead *Cakefile set filetype=coffee
|
||||
autocmd BufNewFile,BufRead *.coffeekup,*.ck set filetype=coffee
|
||||
autocmd BufNewFile,BufRead *._coffee set filetype=coffee
|
||||
|
||||
function! s:DetectCoffee()
|
||||
if getline(1) =~ '^#!.*\<coffee\>'
|
||||
set filetype=coffee
|
||||
endif
|
||||
endfunction
|
||||
|
||||
autocmd BufNewFile,BufRead * call s:DetectCoffee()
|
@ -1,404 +0,0 @@
|
||||
" Language: CoffeeScript
|
||||
" Maintainer: Mick Koch <kchmck@gmail.com>
|
||||
" URL: http://github.com/kchmck/vim-coffee-script
|
||||
" License: WTFPL
|
||||
|
||||
if exists('b:did_ftplugin')
|
||||
finish
|
||||
endif
|
||||
|
||||
let b:did_ftplugin = 1
|
||||
call coffee#CoffeeSetUpVariables()
|
||||
|
||||
setlocal formatoptions-=t formatoptions+=croql
|
||||
setlocal comments=:# commentstring=#\ %s
|
||||
setlocal omnifunc=javascriptcomplete#CompleteJS
|
||||
|
||||
" Create custom augroups.
|
||||
augroup CoffeeBufUpdate | augroup END
|
||||
augroup CoffeeBufNew | augroup END
|
||||
|
||||
" Enable coffee compiler if a compiler isn't set already.
|
||||
if !len(&l:makeprg)
|
||||
compiler coffee
|
||||
endif
|
||||
|
||||
" Switch to the window for buf.
|
||||
function! s:SwitchWindow(buf)
|
||||
exec bufwinnr(a:buf) 'wincmd w'
|
||||
endfunction
|
||||
|
||||
" Create a new scratch buffer and return the bufnr of it. After the function
|
||||
" returns, vim remains in the scratch buffer so more set up can be done.
|
||||
function! s:ScratchBufBuild(src, vert, size)
|
||||
if a:size <= 0
|
||||
if a:vert
|
||||
let size = winwidth(bufwinnr(a:src)) / 2
|
||||
else
|
||||
let size = winheight(bufwinnr(a:src)) / 2
|
||||
endif
|
||||
endif
|
||||
|
||||
if a:vert
|
||||
vertical belowright new
|
||||
exec 'vertical resize' size
|
||||
else
|
||||
belowright new
|
||||
exec 'resize' size
|
||||
endif
|
||||
|
||||
setlocal bufhidden=wipe buftype=nofile nobuflisted noswapfile nomodifiable
|
||||
nnoremap <buffer> <silent> q :hide<CR>
|
||||
|
||||
return bufnr('%')
|
||||
endfunction
|
||||
|
||||
" Replace buffer contents with text and delete the last empty line.
|
||||
function! s:ScratchBufUpdate(buf, text)
|
||||
" Move to the scratch buffer.
|
||||
call s:SwitchWindow(a:buf)
|
||||
|
||||
" Double check we're in the scratch buffer before overwriting.
|
||||
if bufnr('%') != a:buf
|
||||
throw 'unable to change to scratch buffer'
|
||||
endif
|
||||
|
||||
setlocal modifiable
|
||||
silent exec '% delete _'
|
||||
silent put! =a:text
|
||||
silent exec '$ delete _'
|
||||
setlocal nomodifiable
|
||||
endfunction
|
||||
|
||||
" Parse the output of coffee into a qflist entry for src buffer.
|
||||
function! s:ParseCoffeeError(output, src, startline)
|
||||
" Coffee error is always on first line?
|
||||
let match = matchlist(a:output,
|
||||
\ '^\(\f\+\|\[stdin\]\):\(\d\):\(\d\): error: \(.\{-}\)' . "\n")
|
||||
|
||||
if !len(match)
|
||||
return
|
||||
endif
|
||||
|
||||
" Consider the line number from coffee as relative and add it to the beginning
|
||||
" line number of the range the command was called on, then subtract one for
|
||||
" zero-based relativity.
|
||||
call setqflist([{'bufnr': a:src, 'lnum': a:startline + str2nr(match[2]) - 1,
|
||||
\ 'type': 'E', 'col': str2nr(match[3]), 'text': match[4]}], 'r')
|
||||
endfunction
|
||||
|
||||
" Reset source buffer variables.
|
||||
function! s:CoffeeCompileResetVars()
|
||||
" Variables defined in source buffer:
|
||||
" b:coffee_compile_buf: bufnr of output buffer
|
||||
" Variables defined in output buffer:
|
||||
" b:coffee_src_buf: bufnr of source buffer
|
||||
" b:coffee_compile_pos: previous cursor position in output buffer
|
||||
|
||||
let b:coffee_compile_buf = -1
|
||||
endfunction
|
||||
|
||||
function! s:CoffeeWatchResetVars()
|
||||
" Variables defined in source buffer:
|
||||
" b:coffee_watch_buf: bufnr of output buffer
|
||||
" Variables defined in output buffer:
|
||||
" b:coffee_src_buf: bufnr of source buffer
|
||||
" b:coffee_watch_pos: previous cursor position in output buffer
|
||||
|
||||
let b:coffee_watch_buf = -1
|
||||
endfunction
|
||||
|
||||
function! s:CoffeeRunResetVars()
|
||||
" Variables defined in CoffeeRun source buffer:
|
||||
" b:coffee_run_buf: bufnr of output buffer
|
||||
" Variables defined in CoffeeRun output buffer:
|
||||
" b:coffee_src_buf: bufnr of source buffer
|
||||
" b:coffee_run_pos: previous cursor position in output buffer
|
||||
|
||||
let b:coffee_run_buf = -1
|
||||
endfunction
|
||||
|
||||
" Clean things up in the source buffers.
|
||||
function! s:CoffeeCompileClose()
|
||||
" Switch to the source buffer if not already in it.
|
||||
silent! call s:SwitchWindow(b:coffee_src_buf)
|
||||
call s:CoffeeCompileResetVars()
|
||||
endfunction
|
||||
|
||||
function! s:CoffeeWatchClose()
|
||||
silent! call s:SwitchWindow(b:coffee_src_buf)
|
||||
silent! autocmd! CoffeeAuWatch * <buffer>
|
||||
call s:CoffeeWatchResetVars()
|
||||
endfunction
|
||||
|
||||
function! s:CoffeeRunClose()
|
||||
silent! call s:SwitchWindow(b:coffee_src_buf)
|
||||
call s:CoffeeRunResetVars()
|
||||
endfunction
|
||||
|
||||
" Compile the lines between startline and endline and put the result into buf.
|
||||
function! s:CoffeeCompileToBuf(buf, startline, endline)
|
||||
let src = bufnr('%')
|
||||
let input = join(getline(a:startline, a:endline), "\n")
|
||||
|
||||
" Coffee doesn't like empty input.
|
||||
if !len(input)
|
||||
" Function should still return within output buffer.
|
||||
call s:SwitchWindow(a:buf)
|
||||
return
|
||||
endif
|
||||
|
||||
" Pipe lines into coffee.
|
||||
let output = system(g:coffee_compiler .
|
||||
\ ' -scb' .
|
||||
\ ' ' . b:coffee_litcoffee .
|
||||
\ ' 2>&1', input)
|
||||
|
||||
" Paste output into output buffer.
|
||||
call s:ScratchBufUpdate(a:buf, output)
|
||||
|
||||
" Highlight as JavaScript if there were no compile errors.
|
||||
if v:shell_error
|
||||
call s:ParseCoffeeError(output, src, a:startline)
|
||||
setlocal filetype=
|
||||
else
|
||||
" Clear the quickfix list.
|
||||
call setqflist([], 'r')
|
||||
setlocal filetype=javascript
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Peek at compiled CoffeeScript in a scratch buffer. We handle ranges like this
|
||||
" to prevent the cursor from being moved (and its position saved) before the
|
||||
" function is called.
|
||||
function! s:CoffeeCompile(startline, endline, args)
|
||||
if a:args =~ '\<watch\>'
|
||||
echoerr 'CoffeeCompile watch is deprecated! Please use CoffeeWatch instead'
|
||||
sleep 5
|
||||
call s:CoffeeWatch(a:args)
|
||||
return
|
||||
endif
|
||||
|
||||
" Switch to the source buffer if not already in it.
|
||||
silent! call s:SwitchWindow(b:coffee_src_buf)
|
||||
|
||||
" Bail if not in source buffer.
|
||||
if !exists('b:coffee_compile_buf')
|
||||
return
|
||||
endif
|
||||
|
||||
" Build the output buffer if it doesn't exist.
|
||||
if bufwinnr(b:coffee_compile_buf) == -1
|
||||
let src = bufnr('%')
|
||||
|
||||
let vert = exists('g:coffee_compile_vert') || a:args =~ '\<vert\%[ical]\>'
|
||||
let size = str2nr(matchstr(a:args, '\<\d\+\>'))
|
||||
|
||||
" Build the output buffer and save the source bufnr.
|
||||
let buf = s:ScratchBufBuild(src, vert, size)
|
||||
let b:coffee_src_buf = src
|
||||
|
||||
" Set the buffer name.
|
||||
exec 'silent! file [CoffeeCompile ' . src . ']'
|
||||
|
||||
" Clean up the source buffer when the output buffer is closed.
|
||||
autocmd BufWipeout <buffer> call s:CoffeeCompileClose()
|
||||
" Save the cursor when leaving the output buffer.
|
||||
autocmd BufLeave <buffer> let b:coffee_compile_pos = getpos('.')
|
||||
|
||||
" Run user-defined commands on new buffer.
|
||||
silent doautocmd CoffeeBufNew User CoffeeCompile
|
||||
|
||||
" Switch back to the source buffer and save the output bufnr. This also
|
||||
" triggers BufLeave above.
|
||||
call s:SwitchWindow(src)
|
||||
let b:coffee_compile_buf = buf
|
||||
endif
|
||||
|
||||
" Fill the scratch buffer.
|
||||
call s:CoffeeCompileToBuf(b:coffee_compile_buf, a:startline, a:endline)
|
||||
" Reset cursor to previous position.
|
||||
call setpos('.', b:coffee_compile_pos)
|
||||
|
||||
" Run any user-defined commands on the scratch buffer.
|
||||
silent doautocmd CoffeeBufUpdate User CoffeeCompile
|
||||
endfunction
|
||||
|
||||
" Update the scratch buffer and switch back to the source buffer.
|
||||
function! s:CoffeeWatchUpdate()
|
||||
call s:CoffeeCompileToBuf(b:coffee_watch_buf, 1, '$')
|
||||
call setpos('.', b:coffee_watch_pos)
|
||||
silent doautocmd CoffeeBufUpdate User CoffeeWatch
|
||||
call s:SwitchWindow(b:coffee_src_buf)
|
||||
endfunction
|
||||
|
||||
" Continually compile a source buffer.
|
||||
function! s:CoffeeWatch(args)
|
||||
silent! call s:SwitchWindow(b:coffee_src_buf)
|
||||
|
||||
if !exists('b:coffee_watch_buf')
|
||||
return
|
||||
endif
|
||||
|
||||
if bufwinnr(b:coffee_watch_buf) == -1
|
||||
let src = bufnr('%')
|
||||
|
||||
let vert = exists('g:coffee_watch_vert') || a:args =~ '\<vert\%[ical]\>'
|
||||
let size = str2nr(matchstr(a:args, '\<\d\+\>'))
|
||||
|
||||
let buf = s:ScratchBufBuild(src, vert, size)
|
||||
let b:coffee_src_buf = src
|
||||
|
||||
exec 'silent! file [CoffeeWatch ' . src . ']'
|
||||
|
||||
autocmd BufWipeout <buffer> call s:CoffeeWatchClose()
|
||||
autocmd BufLeave <buffer> let b:coffee_watch_pos = getpos('.')
|
||||
|
||||
silent doautocmd CoffeeBufNew User CoffeeWatch
|
||||
|
||||
call s:SwitchWindow(src)
|
||||
let b:coffee_watch_buf = buf
|
||||
endif
|
||||
|
||||
" Make sure only one watch autocmd is defined on this buffer.
|
||||
silent! autocmd! CoffeeAuWatch * <buffer>
|
||||
|
||||
augroup CoffeeAuWatch
|
||||
autocmd InsertLeave <buffer> call s:CoffeeWatchUpdate()
|
||||
autocmd BufWritePost <buffer> call s:CoffeeWatchUpdate()
|
||||
augroup END
|
||||
|
||||
call s:CoffeeWatchUpdate()
|
||||
endfunction
|
||||
|
||||
" Run a snippet of CoffeeScript between startline and endline.
|
||||
function! s:CoffeeRun(startline, endline, args)
|
||||
silent! call s:SwitchWindow(b:coffee_src_buf)
|
||||
|
||||
if !exists('b:coffee_run_buf')
|
||||
return
|
||||
endif
|
||||
|
||||
if bufwinnr(b:coffee_run_buf) == -1
|
||||
let src = bufnr('%')
|
||||
|
||||
let buf = s:ScratchBufBuild(src, exists('g:coffee_run_vert'), 0)
|
||||
let b:coffee_src_buf = src
|
||||
|
||||
exec 'silent! file [CoffeeRun ' . src . ']'
|
||||
|
||||
autocmd BufWipeout <buffer> call s:CoffeeRunClose()
|
||||
autocmd BufLeave <buffer> let b:coffee_run_pos = getpos('.')
|
||||
|
||||
silent doautocmd CoffeeBufNew User CoffeeRun
|
||||
|
||||
call s:SwitchWindow(src)
|
||||
let b:coffee_run_buf = buf
|
||||
endif
|
||||
|
||||
if a:startline == 1 && a:endline == line('$')
|
||||
let output = system(g:coffee_compiler .
|
||||
\ ' ' . b:coffee_litcoffee .
|
||||
\ ' ' . fnameescape(expand('%')) .
|
||||
\ ' ' . a:args)
|
||||
else
|
||||
let input = join(getline(a:startline, a:endline), "\n")
|
||||
|
||||
if !len(input)
|
||||
return
|
||||
endif
|
||||
|
||||
let output = system(g:coffee_compiler .
|
||||
\ ' -s' .
|
||||
\ ' ' . b:coffee_litcoffee .
|
||||
\ ' ' . a:args, input)
|
||||
endif
|
||||
|
||||
call s:ScratchBufUpdate(b:coffee_run_buf, output)
|
||||
call setpos('.', b:coffee_run_pos)
|
||||
|
||||
silent doautocmd CoffeeBufUpdate User CoffeeRun
|
||||
endfunction
|
||||
|
||||
" Run coffeelint on a file, and add any errors between startline and endline
|
||||
" to the quickfix list.
|
||||
function! s:CoffeeLint(startline, endline, bang, args)
|
||||
let input = join(getline(a:startline, a:endline), "\n")
|
||||
|
||||
if !len(input)
|
||||
return
|
||||
endif
|
||||
|
||||
let output = system(g:coffee_linter .
|
||||
\ ' -s --csv' .
|
||||
\ ' ' . b:coffee_litcoffee .
|
||||
\ ' ' . g:coffee_lint_options .
|
||||
\ ' ' . a:args .
|
||||
\ ' 2>&1', input)
|
||||
|
||||
" Convert output into an array and strip off the csv header.
|
||||
let lines = split(output, "\n")[1:]
|
||||
let buf = bufnr('%')
|
||||
let qflist = []
|
||||
|
||||
for line in lines
|
||||
let match = matchlist(line, '^stdin,\(\d\+\),\d*,\(error\|warn\),\(.\+\)$')
|
||||
|
||||
" Ignore unmatched lines.
|
||||
if !len(match)
|
||||
continue
|
||||
endif
|
||||
|
||||
" The 'type' will result in either 'E' or 'W'.
|
||||
call add(qflist, {'bufnr': buf, 'lnum': a:startline + str2nr(match[1]) - 1,
|
||||
\ 'type': toupper(match[2][0]), 'text': match[3]})
|
||||
endfor
|
||||
|
||||
" Replace the quicklist with our items.
|
||||
call setqflist(qflist, 'r')
|
||||
|
||||
" If not given a bang, jump to first error.
|
||||
if !len(a:bang)
|
||||
silent! cc 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Complete arguments for Coffee* commands.
|
||||
function! s:CoffeeComplete(cmd, cmdline, cursor)
|
||||
let args = ['vertical']
|
||||
|
||||
" If no partial command, return all possibilities.
|
||||
if !len(a:cmd)
|
||||
return args
|
||||
endif
|
||||
|
||||
let pat = '^' . a:cmd
|
||||
|
||||
for arg in args
|
||||
if arg =~ pat
|
||||
return [arg]
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
" Set initial state variables if they don't exist
|
||||
if !exists('b:coffee_compile_buf')
|
||||
call s:CoffeeCompileResetVars()
|
||||
endif
|
||||
|
||||
if !exists('b:coffee_watch_buf')
|
||||
call s:CoffeeWatchResetVars()
|
||||
endif
|
||||
|
||||
if !exists('b:coffee_run_buf')
|
||||
call s:CoffeeRunResetVars()
|
||||
endif
|
||||
|
||||
command! -range=% -bar -nargs=* -complete=customlist,s:CoffeeComplete
|
||||
\ CoffeeCompile call s:CoffeeCompile(<line1>, <line2>, <q-args>)
|
||||
command! -bar -nargs=* -complete=customlist,s:CoffeeComplete
|
||||
\ CoffeeWatch call s:CoffeeWatch(<q-args>)
|
||||
command! -range=% -bar -nargs=* CoffeeRun
|
||||
\ call s:CoffeeRun(<line1>, <line2>, <q-args>)
|
||||
command! -range=% -bang -bar -nargs=* CoffeeLint
|
||||
\ call s:CoffeeLint(<line1>, <line2>, <q-bang>, <q-args>)
|
@ -1,433 +0,0 @@
|
||||
" Language: CoffeeScript
|
||||
" Maintainer: Mick Koch <kchmck@gmail.com>
|
||||
" URL: http://github.com/kchmck/vim-coffee-script
|
||||
" License: WTFPL
|
||||
|
||||
if exists('b:did_indent')
|
||||
finish
|
||||
endif
|
||||
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal autoindent
|
||||
setlocal indentexpr=GetCoffeeIndent(v:lnum)
|
||||
" Make sure GetCoffeeIndent is run when these are typed so they can be
|
||||
" indented or outdented.
|
||||
setlocal indentkeys+=0],0),0.,=else,=when,=catch,=finally
|
||||
|
||||
" If no indenting or outdenting is needed, either keep the indent of the cursor
|
||||
" (use autoindent) or match the indent of the previous line.
|
||||
if exists('g:coffee_indent_keep_current')
|
||||
let s:DEFAULT_LEVEL = '-1'
|
||||
else
|
||||
let s:DEFAULT_LEVEL = 'indent(prevnlnum)'
|
||||
endif
|
||||
|
||||
" Only define the function once.
|
||||
if exists('*GetCoffeeIndent')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Keywords that begin a block
|
||||
let s:BEGIN_BLOCK_KEYWORD = '\C^\%(if\|unless\|else\|for\|while\|until\|'
|
||||
\ . 'loop\|switch\|when\|try\|catch\|finally\|'
|
||||
\ . 'class\)\>\%(\s*:\)\@!'
|
||||
|
||||
" An expression that uses the result of a statement
|
||||
let s:COMPOUND_EXPRESSION = '\C\%([^-]-\|[^+]+\|[^/]/\|[:=*%&|^<>]\)\s*'
|
||||
\ . '\%(if\|unless\|for\|while\|until\|loop\|switch\|'
|
||||
\ . 'try\|class\)\>'
|
||||
|
||||
" Combine the two above
|
||||
let s:BEGIN_BLOCK = s:BEGIN_BLOCK_KEYWORD . '\|' . s:COMPOUND_EXPRESSION
|
||||
|
||||
" Operators that begin a block but also count as a continuation
|
||||
let s:BEGIN_BLOCK_OP = '[([{:=]$'
|
||||
|
||||
" Begins a function block
|
||||
let s:FUNCTION = '[-=]>$'
|
||||
|
||||
" Operators that continue a line onto the next line
|
||||
let s:CONTINUATION_OP = '\C\%(\<\%(is\|isnt\|and\|or\)\>\|'
|
||||
\ . '[^-]-\|[^+]+\|[^-=]>\|[^.]\.\|[<*/%&|^,]\)$'
|
||||
|
||||
" Ancestor operators that prevent continuation indenting
|
||||
let s:CONTINUATION = s:CONTINUATION_OP . '\|' . s:BEGIN_BLOCK_OP
|
||||
|
||||
" A closing bracket by itself on a line followed by a continuation
|
||||
let s:BRACKET_CONTINUATION = '^\s*[}\])]\s*' . s:CONTINUATION_OP
|
||||
|
||||
" A continuation dot access
|
||||
let s:DOT_ACCESS = '^\.'
|
||||
|
||||
" Keywords that break out of a block
|
||||
let s:BREAK_BLOCK_OP = '\C^\%(return\|break\|continue\|throw\)\>'
|
||||
|
||||
" A condition attached to the end of a statement
|
||||
let s:POSTFIX_CONDITION = '\C\S\s\+\zs\<\%(if\|unless\|when\|while\|until\)\>'
|
||||
|
||||
" A then contained in brackets
|
||||
let s:CONTAINED_THEN = '\C[(\[].\{-}\<then\>.\{-\}[)\]]'
|
||||
|
||||
" An else with a condition attached
|
||||
let s:ELSE_COND = '\C^\s*else\s\+\<\%(if\|unless\)\>'
|
||||
|
||||
" A single-line else statement (without a condition attached)
|
||||
let s:SINGLE_LINE_ELSE = '\C^else\s\+\%(\<\%(if\|unless\)\>\)\@!'
|
||||
|
||||
" Pairs of starting and ending keywords, with an initial pattern to match
|
||||
let s:KEYWORD_PAIRS = [
|
||||
\ ['\C^else\>', '\C\<\%(if\|unless\|when\|else\s\+\%(if\|unless\)\)\>',
|
||||
\ '\C\<else\>'],
|
||||
\ ['\C^catch\>', '\C\<try\>', '\C\<catch\>'],
|
||||
\ ['\C^finally\>', '\C\<try\>', '\C\<finally\>']
|
||||
\]
|
||||
|
||||
" Pairs of starting and ending brackets
|
||||
let s:BRACKET_PAIRS = {']': '\[', '}': '{', ')': '('}
|
||||
|
||||
" Max lines to look back for a match
|
||||
let s:MAX_LOOKBACK = 50
|
||||
|
||||
" Syntax names for strings
|
||||
let s:SYNTAX_STRING = 'coffee\%(String\|AssignString\|Embed\|Regex\|Heregex\|'
|
||||
\ . 'Heredoc\)'
|
||||
|
||||
" Syntax names for comments
|
||||
let s:SYNTAX_COMMENT = 'coffee\%(Comment\|BlockComment\|HeregexComment\)'
|
||||
|
||||
" Syntax names for strings and comments
|
||||
let s:SYNTAX_STRING_COMMENT = s:SYNTAX_STRING . '\|' . s:SYNTAX_COMMENT
|
||||
|
||||
" Compatibility code for shiftwidth() as recommended by the docs, but modified
|
||||
" so there isn't as much of a penalty if shiftwidth() exists.
|
||||
if exists('*shiftwidth')
|
||||
let s:ShiftWidth = function('shiftwidth')
|
||||
else
|
||||
function! s:ShiftWidth()
|
||||
return &shiftwidth
|
||||
endfunction
|
||||
endif
|
||||
|
||||
" Get the linked syntax name of a character.
|
||||
function! s:SyntaxName(lnum, col)
|
||||
return synIDattr(synID(a:lnum, a:col, 1), 'name')
|
||||
endfunction
|
||||
|
||||
" Check if a character is in a comment.
|
||||
function! s:IsComment(lnum, col)
|
||||
return s:SyntaxName(a:lnum, a:col) =~ s:SYNTAX_COMMENT
|
||||
endfunction
|
||||
|
||||
" Check if a character is in a string.
|
||||
function! s:IsString(lnum, col)
|
||||
return s:SyntaxName(a:lnum, a:col) =~ s:SYNTAX_STRING
|
||||
endfunction
|
||||
|
||||
" Check if a character is in a comment or string.
|
||||
function! s:IsCommentOrString(lnum, col)
|
||||
return s:SyntaxName(a:lnum, a:col) =~ s:SYNTAX_STRING_COMMENT
|
||||
endfunction
|
||||
|
||||
" Search a line for a regex until one is found outside a string or comment.
|
||||
function! s:SearchCode(lnum, regex)
|
||||
" Start at the first column and look for an initial match (including at the
|
||||
" cursor.)
|
||||
call cursor(a:lnum, 1)
|
||||
let pos = search(a:regex, 'c', a:lnum)
|
||||
|
||||
while pos
|
||||
if !s:IsCommentOrString(a:lnum, col('.'))
|
||||
return 1
|
||||
endif
|
||||
|
||||
" Move to the match and continue searching (don't accept matches at the
|
||||
" cursor.)
|
||||
let pos = search(a:regex, '', a:lnum)
|
||||
endwhile
|
||||
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
" Search for the nearest previous line that isn't a comment.
|
||||
function! s:GetPrevNormalLine(startlnum)
|
||||
let curlnum = a:startlnum
|
||||
|
||||
while curlnum
|
||||
let curlnum = prevnonblank(curlnum - 1)
|
||||
|
||||
" Return the line if the first non-whitespace character isn't a comment.
|
||||
if !s:IsComment(curlnum, indent(curlnum) + 1)
|
||||
return curlnum
|
||||
endif
|
||||
endwhile
|
||||
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
function! s:SearchPair(startlnum, lookback, skip, open, close)
|
||||
" Go to the first column so a:close will be matched even if it's at the
|
||||
" beginning of the line.
|
||||
call cursor(a:startlnum, 1)
|
||||
return searchpair(a:open, '', a:close, 'bnW', a:skip, max([1, a:lookback]))
|
||||
endfunction
|
||||
|
||||
" Skip if a match
|
||||
" - is in a string or comment
|
||||
" - is a single-line statement that isn't immediately
|
||||
" adjacent
|
||||
" - has a postfix condition and isn't an else statement or compound
|
||||
" expression
|
||||
function! s:ShouldSkip(startlnum, lnum, col)
|
||||
return s:IsCommentOrString(a:lnum, a:col) ||
|
||||
\ s:SearchCode(a:lnum, '\C\<then\>') && a:startlnum - a:lnum > 1 ||
|
||||
\ s:SearchCode(a:lnum, s:POSTFIX_CONDITION) &&
|
||||
\ getline(a:lnum) !~ s:ELSE_COND &&
|
||||
\ !s:SearchCode(a:lnum, s:COMPOUND_EXPRESSION)
|
||||
endfunction
|
||||
|
||||
" Search for the nearest and farthest match for a keyword pair.
|
||||
function! s:SearchMatchingKeyword(startlnum, open, close)
|
||||
let skip = 's:ShouldSkip(' . a:startlnum . ", line('.'), line('.'))"
|
||||
|
||||
" Search for the nearest match.
|
||||
let nearestlnum = s:SearchPair(a:startlnum, a:startlnum - s:MAX_LOOKBACK,
|
||||
\ skip, a:open, a:close)
|
||||
|
||||
if !nearestlnum
|
||||
return []
|
||||
endif
|
||||
|
||||
" Find the nearest previous line with indent less than or equal to startlnum.
|
||||
let ind = indent(a:startlnum)
|
||||
let lookback = s:GetPrevNormalLine(a:startlnum)
|
||||
|
||||
while lookback && indent(lookback) > ind
|
||||
let lookback = s:GetPrevNormalLine(lookback)
|
||||
endwhile
|
||||
|
||||
" Search for the farthest match. If there are no other matches, then the
|
||||
" nearest match is also the farthest one.
|
||||
let matchlnum = nearestlnum
|
||||
|
||||
while matchlnum
|
||||
let lnum = matchlnum
|
||||
let matchlnum = s:SearchPair(matchlnum, lookback, skip, a:open, a:close)
|
||||
endwhile
|
||||
|
||||
return [nearestlnum, lnum]
|
||||
endfunction
|
||||
|
||||
" Strip a line of a trailing comment and surrounding whitespace.
|
||||
function! s:GetTrimmedLine(lnum)
|
||||
" Try to find a comment starting at the first column.
|
||||
call cursor(a:lnum, 1)
|
||||
let pos = search('#', 'c', a:lnum)
|
||||
|
||||
" Keep searching until a comment is found or search returns 0.
|
||||
while pos
|
||||
if s:IsComment(a:lnum, col('.'))
|
||||
break
|
||||
endif
|
||||
|
||||
let pos = search('#', '', a:lnum)
|
||||
endwhile
|
||||
|
||||
if !pos
|
||||
" No comment was found so use the whole line.
|
||||
let line = getline(a:lnum)
|
||||
else
|
||||
" Subtract 1 to get to the column before the comment and another 1 for
|
||||
" column indexing -> zero-based indexing.
|
||||
let line = getline(a:lnum)[:col('.') - 2]
|
||||
endif
|
||||
|
||||
return substitute(substitute(line, '^\s\+', '', ''),
|
||||
\ '\s\+$', '', '')
|
||||
endfunction
|
||||
|
||||
" Get the indent policy when no special rules are used.
|
||||
function! s:GetDefaultPolicy(curlnum)
|
||||
" Check whether equalprg is being ran on existing lines.
|
||||
if strlen(getline(a:curlnum)) == indent(a:curlnum)
|
||||
" If not indenting an existing line, use the default policy.
|
||||
return s:DEFAULT_LEVEL
|
||||
else
|
||||
" Otherwise let autoindent determine what to do with an existing line.
|
||||
return '-1'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! GetCoffeeIndent(curlnum)
|
||||
" Get the previous non-blank line (may be a comment.)
|
||||
let prevlnum = prevnonblank(a:curlnum - 1)
|
||||
|
||||
" Bail if there's no code before.
|
||||
if !prevlnum
|
||||
return -1
|
||||
endif
|
||||
|
||||
" Bail if inside a multiline string.
|
||||
if s:IsString(a:curlnum, 1)
|
||||
let prevnlnum = prevlnum
|
||||
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
||||
endif
|
||||
|
||||
" Get the code part of the current line.
|
||||
let curline = s:GetTrimmedLine(a:curlnum)
|
||||
" Get the previous non-comment line.
|
||||
let prevnlnum = s:GetPrevNormalLine(a:curlnum)
|
||||
|
||||
" Check if the current line is the closing bracket in a bracket pair.
|
||||
if has_key(s:BRACKET_PAIRS, curline[0])
|
||||
" Search for a matching opening bracket.
|
||||
let matchlnum = s:SearchPair(a:curlnum, a:curlnum - s:MAX_LOOKBACK,
|
||||
\ "s:IsCommentOrString(line('.'), col('.'))",
|
||||
\ s:BRACKET_PAIRS[curline[0]], curline[0])
|
||||
|
||||
if matchlnum
|
||||
" Match the indent of the opening bracket.
|
||||
return indent(matchlnum)
|
||||
else
|
||||
" No opening bracket found (bad syntax), so bail.
|
||||
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
||||
endif
|
||||
endif
|
||||
|
||||
" Check if the current line is the closing keyword in a keyword pair.
|
||||
for pair in s:KEYWORD_PAIRS
|
||||
if curline =~ pair[0]
|
||||
" Find the nearest and farthest matches within the same indent level.
|
||||
let matches = s:SearchMatchingKeyword(a:curlnum, pair[1], pair[2])
|
||||
|
||||
if len(matches)
|
||||
" Don't force indenting/outdenting as long as line is already lined up
|
||||
" with a valid match
|
||||
return max([min([indent(a:curlnum), indent(matches[0])]),
|
||||
\ indent(matches[1])])
|
||||
else
|
||||
" No starting keyword found (bad syntax), so bail.
|
||||
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
|
||||
" Check if the current line is a `when` and not the first in a switch block.
|
||||
if curline =~ '\C^when\>' && !s:SearchCode(prevnlnum, '\C\<switch\>')
|
||||
" Look back for a `when`.
|
||||
while prevnlnum
|
||||
if getline(prevnlnum) =~ '\C^\s*when\>'
|
||||
" Indent to match the found `when`, but don't force indenting (for when
|
||||
" indenting nested switch blocks.)
|
||||
return min([indent(a:curlnum), indent(prevnlnum)])
|
||||
endif
|
||||
|
||||
let prevnlnum = s:GetPrevNormalLine(prevnlnum)
|
||||
endwhile
|
||||
|
||||
" No matching `when` found (bad syntax), so bail.
|
||||
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
||||
endif
|
||||
|
||||
" If the previous line is a comment, use its indentation, but don't force
|
||||
" indenting.
|
||||
if prevlnum != prevnlnum
|
||||
return min([indent(a:curlnum), indent(prevlnum)])
|
||||
endif
|
||||
|
||||
let prevline = s:GetTrimmedLine(prevnlnum)
|
||||
|
||||
" Always indent after these operators.
|
||||
if prevline =~ s:BEGIN_BLOCK_OP
|
||||
return indent(prevnlnum) + s:ShiftWidth()
|
||||
endif
|
||||
|
||||
" Indent if the previous line starts a function block, but don't force
|
||||
" indenting if the line is non-blank (for empty function bodies.)
|
||||
if prevline =~ s:FUNCTION
|
||||
if strlen(getline(a:curlnum)) > indent(a:curlnum)
|
||||
return min([indent(prevnlnum) + s:ShiftWidth(), indent(a:curlnum)])
|
||||
else
|
||||
return indent(prevnlnum) + s:ShiftWidth()
|
||||
endif
|
||||
endif
|
||||
|
||||
" Check if continuation indenting is needed. If the line ends in a slash, make
|
||||
" sure it isn't a regex.
|
||||
if prevline =~ s:CONTINUATION_OP &&
|
||||
\ !(prevline =~ '/$' && s:IsString(prevnlnum, col([prevnlnum, '$']) - 1))
|
||||
" Don't indent if the continuation follows a closing bracket.
|
||||
if prevline =~ s:BRACKET_CONTINUATION
|
||||
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
||||
endif
|
||||
|
||||
let prevprevnlnum = s:GetPrevNormalLine(prevnlnum)
|
||||
|
||||
" Don't indent if not the first continuation.
|
||||
if prevprevnlnum && s:GetTrimmedLine(prevprevnlnum) =~ s:CONTINUATION
|
||||
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
||||
endif
|
||||
|
||||
" Continuation indenting seems to vary between programmers, so if the line
|
||||
" is non-blank, don't override the indentation
|
||||
if strlen(getline(a:curlnum)) > indent(a:curlnum)
|
||||
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
||||
endif
|
||||
|
||||
" Otherwise indent a level.
|
||||
return indent(prevnlnum) + s:ShiftWidth()
|
||||
endif
|
||||
|
||||
" Check if the previous line starts with a keyword that begins a block.
|
||||
if prevline =~ s:BEGIN_BLOCK
|
||||
" Indent if the current line doesn't start with `then` and the previous line
|
||||
" isn't a single-line statement.
|
||||
if curline !~ '\C^\<then\>' && !s:SearchCode(prevnlnum, '\C\<then\>') &&
|
||||
\ prevline !~ s:SINGLE_LINE_ELSE
|
||||
return indent(prevnlnum) + s:ShiftWidth()
|
||||
else
|
||||
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
||||
endif
|
||||
endif
|
||||
|
||||
" Indent a dot access if it's the first.
|
||||
if curline =~ s:DOT_ACCESS
|
||||
if prevline !~ s:DOT_ACCESS
|
||||
return indent(prevnlnum) + s:ShiftWidth()
|
||||
else
|
||||
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
||||
endif
|
||||
endif
|
||||
|
||||
" Outdent if a keyword breaks out of a block as long as it doesn't have a
|
||||
" postfix condition (and the postfix condition isn't a single-line statement.)
|
||||
if prevline =~ s:BREAK_BLOCK_OP
|
||||
if !s:SearchCode(prevnlnum, s:POSTFIX_CONDITION) ||
|
||||
\ s:SearchCode(prevnlnum, '\C\<then\>') &&
|
||||
\ !s:SearchCode(prevnlnum, s:CONTAINED_THEN)
|
||||
" Don't force indenting.
|
||||
return min([indent(a:curlnum), indent(prevnlnum) - s:ShiftWidth()])
|
||||
else
|
||||
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
||||
endif
|
||||
endif
|
||||
|
||||
" Check if inside brackets.
|
||||
let matchlnum = s:SearchPair(a:curlnum, a:curlnum - s:MAX_LOOKBACK,
|
||||
\ "s:IsCommentOrString(line('.'), col('.'))",
|
||||
\ '\[\|(\|{', '\]\|)\|}')
|
||||
|
||||
" If inside brackets, indent relative to the brackets, but don't outdent an
|
||||
" already indented line.
|
||||
if matchlnum
|
||||
return max([indent(a:curlnum), indent(matchlnum) + s:ShiftWidth()])
|
||||
endif
|
||||
|
||||
" No special rules applied, so use the default policy.
|
||||
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
||||
endfunction
|
||||
|
||||
" tab space
|
||||
setlocal expandtab
|
||||
setlocal tabstop=2 shiftwidth=2 softtabstop=2
|
||||
setlocal autoindent
|
@ -1,221 +0,0 @@
|
||||
" Language: CoffeeScript
|
||||
" Maintainer: Mick Koch <kchmck@gmail.com>
|
||||
" URL: http://github.com/kchmck/vim-coffee-script
|
||||
" License: WTFPL
|
||||
|
||||
" Bail if our syntax is already loaded.
|
||||
if exists('b:current_syntax') && b:current_syntax == 'coffee'
|
||||
finish
|
||||
endif
|
||||
|
||||
" Include JavaScript for coffeeEmbed.
|
||||
syn include @coffeeJS syntax/javascript.vim
|
||||
silent! unlet b:current_syntax
|
||||
|
||||
" Highlight long strings.
|
||||
syntax sync fromstart
|
||||
|
||||
" These are `matches` instead of `keywords` because vim's highlighting
|
||||
" priority for keywords is higher than matches. This causes keywords to be
|
||||
" highlighted inside matches, even if a match says it shouldn't contain them --
|
||||
" like with coffeeAssign and coffeeDot.
|
||||
syn match coffeeStatement /\<\%(return\|break\|continue\|throw\)\>/ display
|
||||
hi def link coffeeStatement Statement
|
||||
|
||||
syn match coffeeRepeat /\<\%(for\|while\|until\|loop\)\>/ display
|
||||
hi def link coffeeRepeat Repeat
|
||||
|
||||
syn match coffeeConditional /\<\%(if\|else\|unless\|switch\|when\|then\)\>/
|
||||
\ display
|
||||
hi def link coffeeConditional Conditional
|
||||
|
||||
syn match coffeeException /\<\%(try\|catch\|finally\)\>/ display
|
||||
hi def link coffeeException Exception
|
||||
|
||||
syn match coffeeKeyword /\<\%(new\|in\|of\|by\|and\|or\|not\|is\|isnt\|class\|extends\|super\|do\)\>/
|
||||
\ display
|
||||
" The `own` keyword is only a keyword after `for`.
|
||||
syn match coffeeKeyword /\<for\s\+own\>/ contained containedin=coffeeRepeat
|
||||
\ display
|
||||
hi def link coffeeKeyword Keyword
|
||||
|
||||
syn match coffeeOperator /\<\%(instanceof\|typeof\|delete\)\>/ display
|
||||
hi def link coffeeOperator Operator
|
||||
|
||||
" The first case matches symbol operators only if they have an operand before.
|
||||
syn match coffeeExtendedOp /\%(\S\s*\)\@<=[+\-*/%&|\^=!<>?.]\{-1,}\|[-=]>\|--\|++\|:/
|
||||
\ display
|
||||
syn match coffeeExtendedOp /\<\%(and\|or\)=/ display
|
||||
hi def link coffeeExtendedOp coffeeOperator
|
||||
|
||||
" This is separate from `coffeeExtendedOp` to help differentiate commas from
|
||||
" dots.
|
||||
syn match coffeeSpecialOp /[,;]/ display
|
||||
hi def link coffeeSpecialOp SpecialChar
|
||||
|
||||
syn match coffeeBoolean /\<\%(true\|on\|yes\|false\|off\|no\)\>/ display
|
||||
hi def link coffeeBoolean Boolean
|
||||
|
||||
syn match coffeeGlobal /\<\%(null\|undefined\)\>/ display
|
||||
hi def link coffeeGlobal Type
|
||||
|
||||
" A special variable
|
||||
syn match coffeeSpecialVar /\<\%(this\|prototype\|arguments\)\>/ display
|
||||
hi def link coffeeSpecialVar Special
|
||||
|
||||
" An @-variable
|
||||
syn match coffeeSpecialIdent /@\%(\%(\I\|\$\)\%(\i\|\$\)*\)\?/ display
|
||||
hi def link coffeeSpecialIdent Identifier
|
||||
|
||||
" A class-like name that starts with a capital letter
|
||||
syn match coffeeObject /\<\u\w*\>/ display
|
||||
hi def link coffeeObject Structure
|
||||
|
||||
" A constant-like name in SCREAMING_CAPS
|
||||
syn match coffeeConstant /\<\u[A-Z0-9_]\+\>/ display
|
||||
hi def link coffeeConstant Constant
|
||||
|
||||
" A variable name
|
||||
syn cluster coffeeIdentifier contains=coffeeSpecialVar,coffeeSpecialIdent,
|
||||
\ coffeeObject,coffeeConstant
|
||||
|
||||
" A non-interpolated string
|
||||
syn cluster coffeeBasicString contains=@Spell,coffeeEscape
|
||||
" An interpolated string
|
||||
syn cluster coffeeInterpString contains=@coffeeBasicString,coffeeInterp
|
||||
|
||||
" Regular strings
|
||||
syn region coffeeString start=/"/ skip=/\\\\\|\\"/ end=/"/
|
||||
\ contains=@coffeeInterpString
|
||||
syn region coffeeString start=/'/ skip=/\\\\\|\\'/ end=/'/
|
||||
\ contains=@coffeeBasicString
|
||||
hi def link coffeeString String
|
||||
|
||||
" A integer, including a leading plus or minus
|
||||
syn match coffeeNumber /\%(\i\|\$\)\@<![-+]\?\d\+\%([eE][+-]\?\d\+\)\?/ display
|
||||
" A hex, binary, or octal number
|
||||
syn match coffeeNumber /\<0[xX]\x\+\>/ display
|
||||
syn match coffeeNumber /\<0[bB][01]\+\>/ display
|
||||
syn match coffeeNumber /\<0[oO][0-7]\+\>/ display
|
||||
syn match coffeeNumber /\<\%(Infinity\|NaN\)\>/ display
|
||||
hi def link coffeeNumber Number
|
||||
|
||||
" A floating-point number, including a leading plus or minus
|
||||
syn match coffeeFloat /\%(\i\|\$\)\@<![-+]\?\d*\.\@<!\.\d\+\%([eE][+-]\?\d\+\)\?/
|
||||
\ display
|
||||
hi def link coffeeFloat Float
|
||||
|
||||
" An error for reserved keywords, taken from the RESERVED array:
|
||||
" http://coffeescript.org/documentation/docs/lexer.html#section-67
|
||||
syn match coffeeReservedError /\<\%(case\|default\|function\|var\|void\|with\|const\|let\|enum\|export\|import\|native\|__hasProp\|__extends\|__slice\|__bind\|__indexOf\|implements\|interface\|package\|private\|protected\|public\|static\|yield\)\>/
|
||||
\ display
|
||||
hi def link coffeeReservedError Error
|
||||
|
||||
" A normal object assignment
|
||||
syn match coffeeObjAssign /@\?\%(\I\|\$\)\%(\i\|\$\)*\s*\ze::\@!/ contains=@coffeeIdentifier display
|
||||
hi def link coffeeObjAssign Identifier
|
||||
|
||||
syn keyword coffeeTodo TODO FIXME XXX contained
|
||||
hi def link coffeeTodo Todo
|
||||
|
||||
syn match coffeeComment /#.*/ contains=@Spell,coffeeTodo
|
||||
hi def link coffeeComment Comment
|
||||
|
||||
syn region coffeeBlockComment start=/####\@!/ end=/###/
|
||||
\ contains=@Spell,coffeeTodo
|
||||
hi def link coffeeBlockComment coffeeComment
|
||||
|
||||
" A comment in a heregex
|
||||
syn region coffeeHeregexComment start=/#/ end=/\ze\/\/\/\|$/ contained
|
||||
\ contains=@Spell,coffeeTodo
|
||||
hi def link coffeeHeregexComment coffeeComment
|
||||
|
||||
" Embedded JavaScript
|
||||
syn region coffeeEmbed matchgroup=coffeeEmbedDelim
|
||||
\ start=/`/ skip=/\\\\\|\\`/ end=/`/ keepend
|
||||
\ contains=@coffeeJS
|
||||
hi def link coffeeEmbedDelim Delimiter
|
||||
|
||||
syn region coffeeInterp matchgroup=coffeeInterpDelim start=/#{/ end=/}/ contained
|
||||
\ contains=@coffeeAll
|
||||
hi def link coffeeInterpDelim PreProc
|
||||
|
||||
" A string escape sequence
|
||||
syn match coffeeEscape /\\\d\d\d\|\\x\x\{2\}\|\\u\x\{4\}\|\\./ contained display
|
||||
hi def link coffeeEscape SpecialChar
|
||||
|
||||
" A regex -- must not follow a parenthesis, number, or identifier, and must not
|
||||
" be followed by a number
|
||||
syn region coffeeRegex start=#\%(\%()\|\%(\i\|\$\)\@<!\d\)\s*\|\i\)\@<!/=\@!\s\@!#
|
||||
\ end=#/[gimy]\{,4}\d\@!#
|
||||
\ oneline contains=@coffeeBasicString,coffeeRegexCharSet
|
||||
syn region coffeeRegexCharSet start=/\[/ end=/]/ contained
|
||||
\ contains=@coffeeBasicString
|
||||
hi def link coffeeRegex String
|
||||
hi def link coffeeRegexCharSet coffeeRegex
|
||||
|
||||
" A heregex
|
||||
syn region coffeeHeregex start=#///# end=#///[gimy]\{,4}#
|
||||
\ contains=@coffeeInterpString,coffeeHeregexComment,
|
||||
\ coffeeHeregexCharSet
|
||||
\ fold
|
||||
syn region coffeeHeregexCharSet start=/\[/ end=/]/ contained
|
||||
\ contains=@coffeeInterpString
|
||||
hi def link coffeeHeregex coffeeRegex
|
||||
hi def link coffeeHeregexCharSet coffeeHeregex
|
||||
|
||||
" Heredoc strings
|
||||
syn region coffeeHeredoc start=/"""/ end=/"""/ contains=@coffeeInterpString
|
||||
\ fold
|
||||
syn region coffeeHeredoc start=/'''/ end=/'''/ contains=@coffeeBasicString
|
||||
\ fold
|
||||
hi def link coffeeHeredoc String
|
||||
|
||||
" An error for trailing whitespace, as long as the line isn't just whitespace
|
||||
syn match coffeeSpaceError /\S\@<=\s\+$/ display
|
||||
hi def link coffeeSpaceError Error
|
||||
|
||||
" An error for trailing semicolons, for help transitioning from JavaScript
|
||||
syn match coffeeSemicolonError /;$/ display
|
||||
hi def link coffeeSemicolonError Error
|
||||
|
||||
" Ignore reserved words in dot accesses.
|
||||
syn match coffeeDotAccess /\.\@<!\.\s*\%(\I\|\$\)\%(\i\|\$\)*/he=s+1 contains=@coffeeIdentifier
|
||||
hi def link coffeeDotAccess coffeeExtendedOp
|
||||
|
||||
" Ignore reserved words in prototype accesses.
|
||||
syn match coffeeProtoAccess /::\s*\%(\I\|\$\)\%(\i\|\$\)*/he=s+2 contains=@coffeeIdentifier
|
||||
hi def link coffeeProtoAccess coffeeExtendedOp
|
||||
|
||||
" This is required for interpolations to work.
|
||||
syn region coffeeCurlies matchgroup=coffeeCurly start=/{/ end=/}/
|
||||
\ contains=@coffeeAll
|
||||
syn region coffeeBrackets matchgroup=coffeeBracket start=/\[/ end=/\]/
|
||||
\ contains=@coffeeAll
|
||||
syn region coffeeParens matchgroup=coffeeParen start=/(/ end=/)/
|
||||
\ contains=@coffeeAll
|
||||
|
||||
" These are highlighted the same as commas since they tend to go together.
|
||||
hi def link coffeeBlock coffeeSpecialOp
|
||||
hi def link coffeeBracket coffeeBlock
|
||||
hi def link coffeeCurly coffeeBlock
|
||||
hi def link coffeeParen coffeeBlock
|
||||
|
||||
" This is used instead of TOP to keep things coffee-specific for good
|
||||
" embedding. `contained` groups aren't included.
|
||||
syn cluster coffeeAll contains=coffeeStatement,coffeeRepeat,coffeeConditional,
|
||||
\ coffeeException,coffeeKeyword,coffeeOperator,
|
||||
\ coffeeExtendedOp,coffeeSpecialOp,coffeeBoolean,
|
||||
\ coffeeGlobal,coffeeSpecialVar,coffeeSpecialIdent,
|
||||
\ coffeeObject,coffeeConstant,coffeeString,
|
||||
\ coffeeNumber,coffeeFloat,coffeeReservedError,
|
||||
\ coffeeObjAssign,coffeeComment,coffeeBlockComment,
|
||||
\ coffeeEmbed,coffeeRegex,coffeeHeregex,
|
||||
\ coffeeHeredoc,coffeeSpaceError,
|
||||
\ coffeeSemicolonError,coffeeDotAccess,
|
||||
\ coffeeProtoAccess,coffeeCurlies,coffeeBrackets,
|
||||
\ coffeeParens
|
||||
|
||||
if !exists('b:current_syntax')
|
||||
let b:current_syntax = 'coffee'
|
||||
endif
|
@ -1,3 +0,0 @@
|
||||
# Nested curlies
|
||||
" >> #{ == { { { } } } == } << "
|
||||
" >> #{ == { abc: { def: 42 } } == } << "
|
@ -1,90 +0,0 @@
|
||||
# Various operators
|
||||
abc instanceof def
|
||||
typeof abc
|
||||
delete abc
|
||||
abc::def
|
||||
|
||||
abc + def
|
||||
abc - def
|
||||
abc * def
|
||||
abc / def
|
||||
abc % def
|
||||
abc & def
|
||||
abc | def
|
||||
abc ^ def
|
||||
abc >> def
|
||||
abc << def
|
||||
abc >>> def
|
||||
abc ? def
|
||||
abc && def
|
||||
abc and def
|
||||
abc || def
|
||||
abc or def
|
||||
|
||||
abc += def
|
||||
abc -= def
|
||||
abc *= def
|
||||
abc /= def
|
||||
abc %= def
|
||||
abc &= def
|
||||
abc |= def
|
||||
abc ^= def
|
||||
abc >>= def
|
||||
abc <<= def
|
||||
abc >>>= def
|
||||
abc ?= def
|
||||
abc &&= def
|
||||
abc ||= def
|
||||
|
||||
abc and= def
|
||||
abc or= def
|
||||
|
||||
abc.def.ghi
|
||||
abc?.def?.ghi
|
||||
|
||||
abc < def
|
||||
abc > def
|
||||
abc = def
|
||||
abc == def
|
||||
abc != def
|
||||
abc <= def
|
||||
abc >= def
|
||||
|
||||
abc++
|
||||
abc--
|
||||
++abc
|
||||
--abc
|
||||
|
||||
# Nested operators
|
||||
abc[def] = ghi
|
||||
abc[def[ghi: jkl]] = 42
|
||||
@abc[def] = ghi
|
||||
|
||||
abc["#{def = 42}"] = 42
|
||||
abc["#{def.ghi = 42}"] = 42
|
||||
abc["#{def[ghi] = 42}"] = 42
|
||||
abc["#{def['ghi']}"] = 42
|
||||
|
||||
# Object assignments
|
||||
abc =
|
||||
def: 123
|
||||
DEF: 123
|
||||
@def: 123
|
||||
Def: 123
|
||||
'def': 123
|
||||
42: 123
|
||||
|
||||
# Operators shouldn't be highlighted
|
||||
vector=
|
||||
wand=
|
||||
|
||||
abc+++
|
||||
abc---
|
||||
abc ** def
|
||||
abc &&& def
|
||||
abc ^^ def
|
||||
abc ===== def
|
||||
abc <==== def
|
||||
abc >==== def
|
||||
abc +== def
|
||||
abc =^= def
|
@ -1,27 +0,0 @@
|
||||
# Should be an error
|
||||
function = 42
|
||||
var = 42
|
||||
|
||||
# Shouldn't be an error
|
||||
abc.with = 42
|
||||
function: 42
|
||||
var: 42
|
||||
|
||||
# Keywords shouldn't be highlighted
|
||||
abc.function
|
||||
abc.do
|
||||
abc.break
|
||||
abc.true
|
||||
|
||||
abc::function
|
||||
abc::do
|
||||
abc::break
|
||||
abc::true
|
||||
|
||||
abc:: function
|
||||
abc. function
|
||||
|
||||
# Numbers should be highlighted
|
||||
def.42
|
||||
def .42
|
||||
def::42
|
@ -1,3 +0,0 @@
|
||||
:coffeescript
|
||||
class Hello
|
||||
# test
|
@ -1,7 +0,0 @@
|
||||
<head>
|
||||
<script type="text/coffeescript">
|
||||
abc = {
|
||||
def: 42
|
||||
}
|
||||
</script>
|
||||
</head>
|
@ -1,20 +0,0 @@
|
||||
Copyright 2013 Terry Ma
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@ -1,96 +0,0 @@
|
||||
# vim-expand-region
|
||||
|
||||
## About
|
||||
[vim-expand-region] is a Vim plugin that allows you to visually select increasingly larger regions of text using the same key combination. It is similar to features from other editors:
|
||||
|
||||
- Emac's [expand region](https://github.com/magnars/expand-region.el)
|
||||
- IntelliJ's [syntax aware selection](http://www.jetbrains.com/idea/documentation/tips/#tips_code_editing)
|
||||
- Eclipse's [select enclosing element](http://stackoverflow.com/questions/4264047/intellij-ctrlw-equivalent-shortcut-in-eclipse)
|
||||
|
||||
<p align="center">
|
||||
<img src="https://raw.github.com/terryma/vim-expand-region/master/expand-region.gif" alt="vim-expand-region" />
|
||||
</p>
|
||||
|
||||
## Installation
|
||||
Install using [Pathogen], [Vundle], [Neobundle], or your favorite Vim package manager.
|
||||
|
||||
## Quick Start
|
||||
Press ```+``` to expand the visual selection and ```_``` to shrink it.
|
||||
|
||||
## Mapping
|
||||
Customize the key mapping if you don't like the default.
|
||||
|
||||
```
|
||||
map K <Plug>(expand_region_expand)
|
||||
map J <Plug>(expand_region_shrink)
|
||||
```
|
||||
|
||||
## Setting
|
||||
### Customize selected regions
|
||||
The plugin uses __your own__ text objects to determine the expansion. You can customize the text objects the plugin knows about with ```g:expand_region_text_objects```.
|
||||
|
||||
```vim
|
||||
" Default settings. (NOTE: Remove comments in dictionary before sourcing)
|
||||
let g:expand_region_text_objects = {
|
||||
\ 'iw' :0,
|
||||
\ 'iW' :0,
|
||||
\ 'i"' :0,
|
||||
\ 'i''' :0,
|
||||
\ 'i]' :1, " Support nesting of square brackets
|
||||
\ 'ib' :1, " Support nesting of parentheses
|
||||
\ 'iB' :1, " Support nesting of braces
|
||||
\ 'il' :0, " 'inside line'. Available through https://github.com/kana/vim-textobj-line
|
||||
\ 'ip' :0,
|
||||
\ 'ie' :0, " 'entire file'. Available through https://github.com/kana/vim-textobj-entire
|
||||
\ }
|
||||
```
|
||||
|
||||
You can extend the global default dictionary by calling ```expand_region#custom_text_objects```:
|
||||
|
||||
```vim
|
||||
" Extend the global default (NOTE: Remove comments in dictionary before sourcing)
|
||||
call expand_region#custom_text_objects({
|
||||
\ "\/\\n\\n\<CR>": 1, " Motions are supported as well. Here's a search motion that finds a blank line
|
||||
\ 'a]' :1, " Support nesting of 'around' brackets
|
||||
\ 'ab' :1, " Support nesting of 'around' parentheses
|
||||
\ 'aB' :1, " Support nesting of 'around' braces
|
||||
\ 'ii' :0, " 'inside indent'. Available through https://github.com/kana/vim-textobj-indent
|
||||
\ 'ai' :0, " 'around indent'. Available through https://github.com/kana/vim-textobj-indent
|
||||
\ })
|
||||
```
|
||||
|
||||
You can further customize the text objects dictionary on a per filetype basis by defining global variables like ```g:expand_region_text_objects_{ft}```.
|
||||
|
||||
```vim
|
||||
" Use the following setting for ruby. (NOTE: Remove comments in dictionary before sourcing)
|
||||
let g:expand_region_text_objects_ruby = {
|
||||
\ 'im' :0, " 'inner method'. Available through https://github.com/vim-ruby/vim-ruby
|
||||
\ 'am' :0, " 'around method'. Available through https://github.com/vim-ruby/vim-ruby
|
||||
\ }
|
||||
```
|
||||
|
||||
Note that this completely replaces the default dictionary. To extend the default on a per filetype basis, you can call ```expand_region#custom_text_objects``` by passing in the filetype in the first argument:
|
||||
|
||||
```vim
|
||||
" Use the global default + the following for ruby
|
||||
call expand_region#custom_text_objects('ruby', {
|
||||
\ 'im' :0,
|
||||
\ 'am' :0,
|
||||
\ })
|
||||
```
|
||||
|
||||
### Customize selection mode
|
||||
By default, after an expansion, the plugin leaves you in visual mode. If your ```selectmode```(h:selectmode)) contains ```cmd```, then the plugin will respect that setting and leave you in select mode. If you don't have ```selectmode``` set, but would like to default the expansion in select mode, you can use the global setting below:
|
||||
|
||||
```vim
|
||||
let g:expand_region_use_select_mode = 1
|
||||
```
|
||||
|
||||
[vim-expand-region]:http://github.com/terryma/vim-expand-region
|
||||
[Pathogen]:http://github.com/tpope/vim-pathogen
|
||||
[Vundle]:http://github.com/gmarik/vundle
|
||||
[Neobundle]:http://github.com/Shougo/neobundle.vim
|
||||
|
||||
|
||||
[](https://bitdeli.com/free "Bitdeli Badge")
|
||||
|
@ -1,350 +0,0 @@
|
||||
" ==============================================================================
|
||||
" File: expand_region.vim
|
||||
" Author: Terry Ma
|
||||
" Last Modified: March 30, 2013
|
||||
" ==============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" ==============================================================================
|
||||
" Settings
|
||||
" ==============================================================================
|
||||
|
||||
" Init global vars
|
||||
function! expand_region#init()
|
||||
if exists('g:expand_region_init') && g:expand_region_init
|
||||
return
|
||||
endif
|
||||
let g:expand_region_init = 1
|
||||
|
||||
" Dictionary of text objects that are supported by default. Note that some of
|
||||
" the text objects are not available in vanilla vim. '1' indicates that the
|
||||
" text object is recursive (think of nested parens or brackets)
|
||||
let g:expand_region_text_objects = get(g:, 'expand_region_text_objects', {
|
||||
\ 'iw' :0,
|
||||
\ 'iW' :0,
|
||||
\ 'i"' :0,
|
||||
\ 'i''' :0,
|
||||
\ 'i]' :1,
|
||||
\ 'ib' :1,
|
||||
\ 'iB' :1,
|
||||
\ 'il' :0,
|
||||
\ 'ip' :0,
|
||||
\ 'ie' :0,
|
||||
\})
|
||||
|
||||
" Option to default to the select mode when selecting a new region
|
||||
let g:expand_region_use_select_mode = get(g:, 'expand_region_use_select_mode', 0)
|
||||
endfunction
|
||||
call expand_region#init()
|
||||
|
||||
" ==============================================================================
|
||||
" Global Functions
|
||||
" ==============================================================================
|
||||
|
||||
" Allow user to customize the global dictionary, or the per file type dictionary
|
||||
function! expand_region#custom_text_objects(...)
|
||||
if a:0 == 1
|
||||
call extend(g:expand_region_text_objects, a:1)
|
||||
elseif a:0 == 2
|
||||
if !exists("g:expand_region_text_objects_".a:1)
|
||||
let g:expand_region_text_objects_{a:1} = {}
|
||||
call extend(g:expand_region_text_objects_{a:1}, g:expand_region_text_objects)
|
||||
endif
|
||||
call extend(g:expand_region_text_objects_{a:1}, a:2)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Returns whether we should perform the region highlighting use visual mode or
|
||||
" select mode
|
||||
function! expand_region#use_select_mode()
|
||||
return g:expand_region_use_select_mode || index(split(s:saved_selectmode, ','), 'cmd') != -1
|
||||
endfunction
|
||||
|
||||
" Main function
|
||||
function! expand_region#next(mode, direction)
|
||||
call s:expand_region(a:mode, a:direction)
|
||||
endfunction
|
||||
|
||||
" ==============================================================================
|
||||
" Variables
|
||||
" ==============================================================================
|
||||
|
||||
" The saved cursor position when user initiates expand. This is the position we
|
||||
" use to calcuate the region for all of our text objects. This is also used to
|
||||
" restore the original cursor position when the region is completely shrinked.
|
||||
let s:saved_pos = []
|
||||
|
||||
" Index into the list of filtered text objects(s:candidates), the text object
|
||||
" this points to is the currently selected region.
|
||||
let s:cur_index = -1
|
||||
|
||||
" The list of filtered text objects used to expand/shrink the visual selection.
|
||||
" This is computed when expand-region is called the first time.
|
||||
" Each item is a dictionary containing the following:
|
||||
" text_object: The actual text object string
|
||||
" start_pos: The result of getpos() on the starting position of the text object
|
||||
" end_pos: The result of getpos() on the ending position of the text object
|
||||
" length: The number of characters for the text object
|
||||
let s:candidates = []
|
||||
|
||||
" This is used to save the user's selectmode setting. If the user's selectmode
|
||||
" contains 'cmd', then our expansion should result in the region selected under
|
||||
" select mode.
|
||||
let s:saved_selectmode = &selectmode
|
||||
|
||||
" ==============================================================================
|
||||
" Functions
|
||||
" ==============================================================================
|
||||
|
||||
" Sort the text object by length in ascending order
|
||||
function! s:sort_text_object(l, r)
|
||||
return a:l.length - a:r.length
|
||||
endfunction
|
||||
|
||||
" Compare two position arrays. Each input is the result of getpos(). Return a
|
||||
" negative value if lhs occurs before rhs, positive value if after, and 0 if
|
||||
" they are the same.
|
||||
function! s:compare_pos(l, r)
|
||||
" If number lines are the same, compare columns
|
||||
return a:l[1] ==# a:r[1] ? a:l[2] - a:r[2] : a:l[1] - a:r[1]
|
||||
endfunction
|
||||
|
||||
" Boundary check on the cursor position to make sure it's inside the text object
|
||||
" region. Return 1 if the cursor is within range, 0 otherwise.
|
||||
function! s:is_cursor_inside(pos, region)
|
||||
if s:compare_pos(a:pos, a:region.start_pos) < 0
|
||||
return 0
|
||||
endif
|
||||
if s:compare_pos(a:pos, a:region.end_pos) > 0
|
||||
return 0
|
||||
endif
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
" Remove duplicates from the candidate list. Two candidates are duplicates if
|
||||
" they cover the exact same region (same length and same starting position)
|
||||
function! s:remove_duplicate(input)
|
||||
let i = len(a:input) - 1
|
||||
while i >= 1
|
||||
if a:input[i].length ==# a:input[i-1].length &&
|
||||
\ a:input[i].start_pos ==# a:input[i-1].start_pos
|
||||
call remove(a:input, i)
|
||||
endif
|
||||
let i-=1
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
" Return a single candidate dictionary. Each dictionary contains the following:
|
||||
" text_object: The actual text object string
|
||||
" start_pos: The result of getpos() on the starting position of the text object
|
||||
" end_pos: The result of getpos() on the ending position of the text object
|
||||
" length: The number of characters for the text object
|
||||
function! s:get_candidate_dict(text_object)
|
||||
" Store the current view so we can restore it at the end
|
||||
let winview = winsaveview()
|
||||
|
||||
" Use ! as much as possible
|
||||
exec 'normal! v'
|
||||
exec 'silent! normal '.a:text_object
|
||||
" The double quote is important
|
||||
exec "normal! \<Esc>"
|
||||
|
||||
let selection = s:get_visual_selection()
|
||||
let ret = {
|
||||
\ "text_object": a:text_object,
|
||||
\ "start_pos": selection.start_pos,
|
||||
\ "end_pos": selection.end_pos,
|
||||
\ "length": selection.length,
|
||||
\}
|
||||
|
||||
" Restore peace
|
||||
call winrestview(winview)
|
||||
return ret
|
||||
endfunction
|
||||
|
||||
|
||||
" Return dictionary of text objects that are to be used for the current
|
||||
" filetype. Filetype-specific dictionaries will be loaded if they exist
|
||||
" and the global dictionary will be used as a fallback.
|
||||
function! s:get_configuration()
|
||||
let configuration = {}
|
||||
for ft in split(&ft, '\.')
|
||||
if exists("g:expand_region_text_objects_".ft)
|
||||
call extend(configuration, g:expand_region_text_objects_{ft})
|
||||
endif
|
||||
endfor
|
||||
|
||||
if empty(configuration)
|
||||
call extend(configuration, g:expand_region_text_objects)
|
||||
endif
|
||||
|
||||
return configuration
|
||||
endfunction
|
||||
|
||||
" Return list of candidate dictionary. Each dictionary contains the following:
|
||||
" text_object: The actual text object string
|
||||
" start_pos: The result of getpos() on the starting position of the text object
|
||||
" length: The number of characters for the text object
|
||||
function! s:get_candidate_list()
|
||||
" Turn off wrap to allow recursive search to work without triggering errors
|
||||
let save_wrapscan = &wrapscan
|
||||
set nowrapscan
|
||||
|
||||
let config = s:get_configuration()
|
||||
|
||||
" Generate the candidate list for every defined text object
|
||||
let candidates = keys(config)
|
||||
call map(candidates, "s:get_candidate_dict(v:val)")
|
||||
|
||||
" For the ones that are recursive, generate them until they no longer match
|
||||
" any region
|
||||
let recursive_candidates = []
|
||||
for i in candidates
|
||||
" Continue if not recursive
|
||||
if !config[i.text_object]
|
||||
continue
|
||||
endif
|
||||
" If the first level is already empty, no point in going any further
|
||||
if i.length ==# 0
|
||||
continue
|
||||
endif
|
||||
let l:count = 2
|
||||
let previous = i.length
|
||||
while 1
|
||||
let test = l:count.i.text_object
|
||||
let candidate = s:get_candidate_dict(test)
|
||||
if candidate.length ==# 0
|
||||
break
|
||||
endif
|
||||
" If we're not producing larger regions, end early
|
||||
if candidate.length ==# previous
|
||||
break
|
||||
endif
|
||||
call add(recursive_candidates, candidate)
|
||||
let l:count+=1
|
||||
let previous = candidate.length
|
||||
endwhile
|
||||
endfor
|
||||
|
||||
" Restore wrapscan
|
||||
let &wrapscan = save_wrapscan
|
||||
|
||||
return extend(candidates, recursive_candidates)
|
||||
endfunction
|
||||
|
||||
" Return a dictionary containing the start position, end position and length of
|
||||
" the current visual selection.
|
||||
function! s:get_visual_selection()
|
||||
let start_pos = getpos("'<")
|
||||
let end_pos = getpos("'>")
|
||||
let [lnum1, col1] = start_pos[1:2]
|
||||
let [lnum2, col2] = end_pos[1:2]
|
||||
let lines = getline(lnum1, lnum2)
|
||||
let lines[-1] = lines[-1][: col2 - 1]
|
||||
let lines[0] = lines[0][col1 - 1:]
|
||||
return {
|
||||
\ 'start_pos': start_pos,
|
||||
\ 'end_pos': end_pos,
|
||||
\ 'length': len(join(lines, "\n"))
|
||||
\}
|
||||
endfunction
|
||||
|
||||
" Figure out whether we should compute the candidate text objects, or we're in
|
||||
" the middle of an expand/shrink.
|
||||
function! s:should_compute_candidates(mode)
|
||||
if a:mode ==# 'v'
|
||||
" Check that current visual selection is idential to our last expanded
|
||||
" region
|
||||
if s:cur_index >= 0
|
||||
let selection = s:get_visual_selection()
|
||||
if s:candidates[s:cur_index].start_pos ==# selection.start_pos
|
||||
\ && s:candidates[s:cur_index].length ==# selection.length
|
||||
return 0
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
" Computes the list of text object candidates to be used given the current
|
||||
" cursor position.
|
||||
function! s:compute_candidates(cursor_pos)
|
||||
" Reset index into the candidates list
|
||||
let s:cur_index = -1
|
||||
|
||||
" Save the current cursor position so we can restore it later
|
||||
let s:saved_pos = a:cursor_pos
|
||||
|
||||
" Compute a list of candidate regions
|
||||
let s:candidates = s:get_candidate_list()
|
||||
|
||||
" Sort them and remove the ones with 0 or 1 length
|
||||
call filter(sort(s:candidates, "s:sort_text_object"), 'v:val.length > 1')
|
||||
|
||||
" Filter out the ones where the cursor falls outside of its region. i" and i'
|
||||
" can start after the cursor position, and ib can start before, so both checks
|
||||
" are needed
|
||||
call filter(s:candidates, 's:is_cursor_inside(s:saved_pos, v:val)')
|
||||
|
||||
" Remove duplicates
|
||||
call s:remove_duplicate(s:candidates)
|
||||
endfunction
|
||||
|
||||
" Perform the visual selection at the end. If the user wants to be left in
|
||||
" select mode, do so
|
||||
function! s:select_region()
|
||||
exec 'normal! v'
|
||||
exec 'normal '.s:candidates[s:cur_index].text_object
|
||||
if expand_region#use_select_mode()
|
||||
exec "normal! \<C-g>"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Expand or shrink the visual selection to the next candidate in the text object
|
||||
" list.
|
||||
function! s:expand_region(mode, direction)
|
||||
" Save the selectmode setting, and remove the setting so our 'v' command do
|
||||
" not get interfered
|
||||
let s:saved_selectmode = &selectmode
|
||||
let &selectmode=""
|
||||
|
||||
if s:should_compute_candidates(a:mode)
|
||||
call s:compute_candidates(getpos('.'))
|
||||
else
|
||||
call setpos('.', s:saved_pos)
|
||||
endif
|
||||
|
||||
if a:direction ==# '+'
|
||||
" Expanding
|
||||
if s:cur_index ==# len(s:candidates) - 1
|
||||
normal! gv
|
||||
else
|
||||
let s:cur_index+=1
|
||||
" Associate the window view with the text object
|
||||
let s:candidates[s:cur_index].prev_winview = winsaveview()
|
||||
call s:select_region()
|
||||
endif
|
||||
else
|
||||
"Shrinking
|
||||
if s:cur_index <=# 0
|
||||
" In visual mode, doing nothing here will return us to normal mode. For
|
||||
" select mode, the following is needed.
|
||||
if expand_region#use_select_mode()
|
||||
exec "normal! gV"
|
||||
endif
|
||||
else
|
||||
" Restore the window view
|
||||
call winrestview(s:candidates[s:cur_index].prev_winview)
|
||||
let s:cur_index-=1
|
||||
call s:select_region()
|
||||
endif
|
||||
endif
|
||||
|
||||
" Restore the selectmode setting
|
||||
let &selectmode = s:saved_selectmode
|
||||
endfunction
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
@ -1,126 +0,0 @@
|
||||
*vim-expand-region.txt* Incremental visual selection
|
||||
|
||||
__ _
|
||||
___ _ ______ ____ _____ ____/ / ________ ____ _(_)___ ____
|
||||
/ _ \| |/_/ __ \/ __ `/ __ \/ __ / / ___/ _ \/ __ `/ / __ \/ __ \
|
||||
/ __/> </ /_/ / /_/ / / / / /_/ / / / / __/ /_/ / / /_/ / / / /
|
||||
\___/_/|_/ .___/\__,_/_/ /_/\__,_/ /_/ \___/\__, /_/\____/_/ /_/
|
||||
/_/ /____/
|
||||
|
||||
Reference Manual~
|
||||
|
||||
|
||||
==============================================================================
|
||||
|
||||
CONTENTS *expand-region-contents*
|
||||
1.Intro...................................|expand-region-intro|
|
||||
2.Usage...................................|expand-region-usage|
|
||||
3.Mappings................................|expand-region-mappings|
|
||||
4.Global Options..........................|expand-region-global-options|
|
||||
5.About...................................|expand-region-about|
|
||||
|
||||
==============================================================================
|
||||
1. Intro *expand-region-intro*
|
||||
|
||||
*vim-expand-regions* brings the incremental visual selection feature from
|
||||
other text editors into Vim.
|
||||
|
||||
Emac's 'expand-region': https://github.com/magnars/expand-region.el
|
||||
IntellJ's 'syntax aware selection':
|
||||
http://www.jetbrains.com/idea/documentation/tips/#tips_code_editing
|
||||
Eclipse's 'select enclosing element':
|
||||
http://stackoverflow.com/questions/4264047/intellij-ctrlw-equivalent-shortcut-in-eclipse
|
||||
|
||||
==============================================================================
|
||||
2. Usage *expand-region-usage*
|
||||
|
||||
Press '+' to expand the visual selection and '_' to shrink it.
|
||||
|
||||
==============================================================================
|
||||
2. Mappings *expand-region-mappings*
|
||||
|
||||
Customize the key mappings if you don't like the default. >
|
||||
|
||||
map K <Plug>(expand_region_expand)
|
||||
map J <Plug>(expand_region_shrink)
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
4. Global Options *expand-region-global-options*
|
||||
|
||||
*expand_region_text_objects*
|
||||
Default: See below
|
||||
Dictionary containing the text objects the plugin uses to search for the
|
||||
available regions to expand/shrink to. The value corresponding to each plugin
|
||||
indicates whether text object is recursive. A recursive text object is
|
||||
continually expanded until the region no longer gets larger. >
|
||||
|
||||
" Default settings. (NOTE: Remove comments in dictionary before sourcing)
|
||||
let g:expand_region_text_objects = {
|
||||
\ 'iw' :0,
|
||||
\ 'iW' :0,
|
||||
\ 'i"' :0,
|
||||
\ 'i''' :0,
|
||||
\ 'i]' :1, " Support nesting of square brackets
|
||||
\ 'ib' :1, " Support nesting of parentheses
|
||||
\ 'iB' :1, " Support nesting of braces
|
||||
\ 'il' :0, " 'inside line'. Available through https://github.com/kana/vim-textobj-line
|
||||
\ 'ip' :0,
|
||||
\ 'ie' :0, " 'entire file'. Available through https://github.com/kana/vim-textobj-entire
|
||||
\ }
|
||||
<
|
||||
|
||||
You can extend the global default dictionary by calling
|
||||
'expand_region#custom_text_objects'. >
|
||||
|
||||
" Extend the global default (NOTE: Remove comments in dictionary before sourcing)
|
||||
call expand_region#custom_text_objects({
|
||||
\ "\/\\n\\n\<CR>": 1, " Motions are supported as well. Here's a search motion that finds a blank line
|
||||
\ 'a]' :1, " Support nesting of 'around' brackets
|
||||
\ 'ab' :1, " Support nesting of 'around' parentheses
|
||||
\ 'aB' :1, " Support nesting of 'around' braces
|
||||
\ 'ii' :0, " 'inside indent'. Available through https://github.com/kana/vim-textobj-indent
|
||||
\ 'ai' :0, " 'around indent'. Available through https://github.com/kana/vim-textobj-indent
|
||||
\ })
|
||||
<
|
||||
|
||||
You can further customize the text objects dictionary on a per filetype basis
|
||||
by defining global variables like 'g:expand_region_text_objects_{ft}'. >
|
||||
|
||||
" Use the following setting for ruby. (NOTE: Remove comments in dictionary before sourcing)
|
||||
let g:expand_region_text_objects_ruby = {
|
||||
\ 'im' :0, " 'inner method'. Available through https://github.com/vim-ruby/vim-ruby
|
||||
\ 'am' :0, " 'around method'. Available through https://github.com/vim-ruby/vim-ruby
|
||||
\ }
|
||||
<
|
||||
|
||||
Note that this completely replaces the default dictionary. To extend the
|
||||
default on a per filetype basis, you can call
|
||||
'expand_region#custom_text_objects' by passing in the filetype in the first
|
||||
argument: >
|
||||
|
||||
" Use the global default + the following for ruby
|
||||
call expand_region#custom_text_objects('ruby', {
|
||||
\ 'im' :0,
|
||||
\ 'am' :0,
|
||||
\ })
|
||||
<
|
||||
*expand_region_use_select_mode*
|
||||
Default: 0
|
||||
By default, after an expansion, the plugin leaves you in visual mode. If your
|
||||
'selectmode' contains "cmd", then the plugin will respect that setting and
|
||||
leave you in select mode. If you don't have 'selectmode' set, but would
|
||||
like to default the expansion in select mode, you can use the global setting
|
||||
below: >
|
||||
|
||||
let g:expand_region_use_select_mode = 1
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
5. About *expand-region-about*
|
||||
==============================================================================
|
||||
|
||||
Find the latest version of the plugin here:
|
||||
http://github.com/terryma/vim-expand-region
|
||||
|
||||
vim:tw=78:sw=4:ft=help:norl:
|
Binary file not shown.
Before Width: | Height: | Size: 753 KiB |
@ -1,43 +0,0 @@
|
||||
" ==============================================================================
|
||||
" File: expand_region.vim
|
||||
" Author: Terry Ma
|
||||
" Description: Incrementally select larger regions of text in visual mode by
|
||||
" repeating the same key combination
|
||||
" Last Modified: March 30, 2013
|
||||
" ==============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" Init global vars
|
||||
call expand_region#init()
|
||||
|
||||
" ==============================================================================
|
||||
" Mappings
|
||||
" ==============================================================================
|
||||
if !hasmapto('<Plug>(expand_region_expand)')
|
||||
nmap + <Plug>(expand_region_expand)
|
||||
vmap + <Plug>(expand_region_expand)
|
||||
endif
|
||||
if !hasmapto('<Plug>(expand_region_shrink)')
|
||||
vmap _ <Plug>(expand_region_shrink)
|
||||
nmap _ <Plug>(expand_region_shrink)
|
||||
endif
|
||||
|
||||
nnoremap <silent> <Plug>(expand_region_expand)
|
||||
\ :<C-U>call expand_region#next('n', '+')<CR>
|
||||
" Map keys differently depending on which mode is desired
|
||||
if expand_region#use_select_mode()
|
||||
snoremap <silent> <Plug>(expand_region_expand)
|
||||
\ :<C-U>call expand_region#next('v', '+')<CR>
|
||||
snoremap <silent> <Plug>(expand_region_shrink)
|
||||
\ :<C-U>call expand_region#next('v', '-')<CR>
|
||||
else
|
||||
xnoremap <silent> <Plug>(expand_region_expand)
|
||||
\ :<C-U>call expand_region#next('v', '+')<CR>
|
||||
xnoremap <silent> <Plug>(expand_region_shrink)
|
||||
\ :<C-U>call expand_region#next('v', '-')<CR>
|
||||
endif
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
@ -1,103 +0,0 @@
|
||||
" Copyright 2011 The Go Authors. All rights reserved.
|
||||
" Use of this source code is governed by a BSD-style
|
||||
" license that can be found in the LICENSE file.
|
||||
"
|
||||
" This file provides a utility function that performs auto-completion of
|
||||
" package names, for use by other commands.
|
||||
|
||||
let s:goos = $GOOS
|
||||
let s:goarch = $GOARCH
|
||||
|
||||
if len(s:goos) == 0
|
||||
if exists('g:golang_goos')
|
||||
let s:goos = g:golang_goos
|
||||
elseif has('win32') || has('win64')
|
||||
let s:goos = 'windows'
|
||||
elseif has('macunix')
|
||||
let s:goos = 'darwin'
|
||||
else
|
||||
let s:goos = '*'
|
||||
endif
|
||||
endif
|
||||
|
||||
if len(s:goarch) == 0
|
||||
if exists('g:golang_goarch')
|
||||
let s:goarch = g:golang_goarch
|
||||
else
|
||||
let s:goarch = '*'
|
||||
endif
|
||||
endif
|
||||
|
||||
function! go#complete#PackageMembers(package, member)
|
||||
silent! let content = system('godoc ' . a:package)
|
||||
if v:shell_error || !len(content)
|
||||
return []
|
||||
endif
|
||||
let lines = filter(split(content, "\n"),"v:val !~ '^\\s\\+$'")
|
||||
try
|
||||
let mx1 = '^\s\+\(\S+\)\s\+=\s\+.*'
|
||||
let mx2 = '^\%(const\|var\|type\|func\) \([A-Z][^ (]\+\).*'
|
||||
let candidates =
|
||||
\ map(filter(copy(lines), 'v:val =~ mx1'), 'substitute(v:val, mx1, "\\1", "")')
|
||||
\ + map(filter(copy(lines), 'v:val =~ mx2'), 'substitute(v:val, mx2, "\\1", "")')
|
||||
return filter(candidates, '!stridx(v:val, a:member)')
|
||||
catch
|
||||
return []
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
function! go#complete#Package(ArgLead, CmdLine, CursorPos)
|
||||
let dirs = []
|
||||
|
||||
let words = split(a:CmdLine, '\s\+', 1)
|
||||
if len(words) > 2
|
||||
" Complete package members
|
||||
return go#complete#PackageMembers(words[1], words[2])
|
||||
endif
|
||||
|
||||
if executable('go')
|
||||
let goroot = substitute(system('go env GOROOT'), '\n', '', 'g')
|
||||
if v:shell_error
|
||||
echomsg '\'go env GOROOT\' failed'
|
||||
endif
|
||||
else
|
||||
let goroot = $GOROOT
|
||||
endif
|
||||
|
||||
if len(goroot) != 0 && isdirectory(goroot)
|
||||
let dirs += [goroot]
|
||||
endif
|
||||
|
||||
let pathsep = ':'
|
||||
if s:goos == 'windows'
|
||||
let pathsep = ';'
|
||||
endif
|
||||
let workspaces = split($GOPATH, pathsep)
|
||||
if workspaces != []
|
||||
let dirs += workspaces
|
||||
endif
|
||||
|
||||
if len(dirs) == 0
|
||||
" should not happen
|
||||
return []
|
||||
endif
|
||||
|
||||
let ret = {}
|
||||
for dir in dirs
|
||||
" this may expand to multiple lines
|
||||
let root = split(expand(dir . '/pkg/' . s:goos . '_' . s:goarch), "\n")
|
||||
call add(root, expand(dir . '/src'))
|
||||
for r in root
|
||||
for i in split(globpath(r, a:ArgLead.'*'), "\n")
|
||||
if isdirectory(i)
|
||||
let i .= '/'
|
||||
elseif i !~ '\.a$'
|
||||
continue
|
||||
endif
|
||||
let i = substitute(substitute(i[len(r)+1:], '[\\]', '/', 'g'), '\.a$', '', 'g')
|
||||
let ret[i] = i
|
||||
endfor
|
||||
endfor
|
||||
endfor
|
||||
return sort(keys(ret))
|
||||
endfunction
|
@ -1,30 +0,0 @@
|
||||
" Copyright 2013 The Go Authors. All rights reserved.
|
||||
" Use of this source code is governed by a BSD-style
|
||||
" license that can be found in the LICENSE file.
|
||||
"
|
||||
" compiler/go.vim: Vim compiler file for Go.
|
||||
|
||||
if exists("current_compiler")
|
||||
finish
|
||||
endif
|
||||
let current_compiler = "go"
|
||||
|
||||
if exists(":CompilerSet") != 2
|
||||
command -nargs=* CompilerSet setlocal <args>
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo-=C
|
||||
|
||||
CompilerSet makeprg=go\ build
|
||||
CompilerSet errorformat=
|
||||
\%-G#\ %.%#,
|
||||
\%A%f:%l:%c:\ %m,
|
||||
\%A%f:%l:\ %m,
|
||||
\%C%*\\s%m,
|
||||
\%-G%.%#
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim:ts=4:sw=4:et
|
@ -1,23 +0,0 @@
|
||||
" We take care to preserve the user's fileencodings and fileformats,
|
||||
" because those settings are global (not buffer local), yet we want
|
||||
" to override them for loading Go files, which are defined to be UTF-8.
|
||||
let s:current_fileformats = ''
|
||||
let s:current_fileencodings = ''
|
||||
|
||||
" define fileencodings to open as utf-8 encoding even if it's ascii.
|
||||
function! s:gofiletype_pre()
|
||||
let s:current_fileformats = &g:fileformats
|
||||
let s:current_fileencodings = &g:fileencodings
|
||||
set fileencodings=utf-8 fileformats=unix
|
||||
setlocal filetype=go
|
||||
endfunction
|
||||
|
||||
" restore fileencodings as others
|
||||
function! s:gofiletype_post()
|
||||
let &g:fileformats = s:current_fileformats
|
||||
let &g:fileencodings = s:current_fileencodings
|
||||
endfunction
|
||||
|
||||
au BufNewFile *.go setlocal filetype=go fileencoding=utf-8 fileformat=unix
|
||||
au BufRead *.go call s:gofiletype_pre()
|
||||
au BufReadPost *.go call s:gofiletype_post()
|
@ -1,17 +0,0 @@
|
||||
" Copyright 2013 The Go Authors. All rights reserved.
|
||||
" Use of this source code is governed by a BSD-style
|
||||
" license that can be found in the LICENSE file.
|
||||
"
|
||||
" go.vim: Vim filetype plugin for Go.
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
setlocal comments=s1:/*,mb:*,ex:*/,://
|
||||
setlocal commentstring=//\ %s
|
||||
|
||||
let b:undo_ftplugin = "setl com< cms<"
|
||||
|
||||
" vim:ts=4:sw=4:et
|
@ -1,69 +0,0 @@
|
||||
" Copyright 2011 The Go Authors. All rights reserved.
|
||||
" Use of this source code is governed by a BSD-style
|
||||
" license that can be found in the LICENSE file.
|
||||
"
|
||||
" fmt.vim: Vim command to format Go files with gofmt.
|
||||
"
|
||||
" This filetype plugin add a new commands for go buffers:
|
||||
"
|
||||
" :Fmt
|
||||
"
|
||||
" Filter the current Go buffer through gofmt.
|
||||
" It tries to preserve cursor position and avoids
|
||||
" replacing the buffer with stderr output.
|
||||
"
|
||||
" Options:
|
||||
"
|
||||
" g:go_fmt_commands [default=1]
|
||||
"
|
||||
" Flag to indicate whether to enable the commands listed above.
|
||||
"
|
||||
" g:gofmt_command [default="gofmt"]
|
||||
"
|
||||
" Flag naming the gofmt executable to use.
|
||||
"
|
||||
if exists("b:did_ftplugin_go_fmt")
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists("g:go_fmt_commands")
|
||||
let g:go_fmt_commands = 1
|
||||
endif
|
||||
|
||||
if !exists("g:gofmt_command")
|
||||
let g:gofmt_command = "gofmt"
|
||||
endif
|
||||
|
||||
if g:go_fmt_commands
|
||||
command! -buffer Fmt call s:GoFormat()
|
||||
endif
|
||||
|
||||
function! s:GoFormat()
|
||||
let view = winsaveview()
|
||||
silent execute "%!" . g:gofmt_command
|
||||
if v:shell_error
|
||||
let errors = []
|
||||
for line in getline(1, line('$'))
|
||||
let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)')
|
||||
if !empty(tokens)
|
||||
call add(errors, {"filename": @%,
|
||||
\"lnum": tokens[2],
|
||||
\"col": tokens[3],
|
||||
\"text": tokens[4]})
|
||||
endif
|
||||
endfor
|
||||
if empty(errors)
|
||||
% | " Couldn't detect gofmt error format, output errors
|
||||
endif
|
||||
undo
|
||||
if !empty(errors)
|
||||
call setqflist(errors, 'r')
|
||||
endif
|
||||
echohl Error | echomsg "Gofmt returned error" | echohl None
|
||||
endif
|
||||
call winrestview(view)
|
||||
endfunction
|
||||
|
||||
let b:did_ftplugin_go_fmt = 1
|
||||
|
||||
" vim:ts=4:sw=4:et
|
@ -1,250 +0,0 @@
|
||||
" Copyright 2011 The Go Authors. All rights reserved.
|
||||
" Use of this source code is governed by a BSD-style
|
||||
" license that can be found in the LICENSE file.
|
||||
"
|
||||
" import.vim: Vim commands to import/drop Go packages.
|
||||
"
|
||||
" This filetype plugin adds three new commands for go buffers:
|
||||
"
|
||||
" :Import {path}
|
||||
"
|
||||
" Import ensures that the provided package {path} is imported
|
||||
" in the current Go buffer, using proper style and ordering.
|
||||
" If {path} is already being imported, an error will be
|
||||
" displayed and the buffer will be untouched.
|
||||
"
|
||||
" :ImportAs {localname} {path}
|
||||
"
|
||||
" Same as Import, but uses a custom local name for the package.
|
||||
"
|
||||
" :Drop {path}
|
||||
"
|
||||
" Remove the import line for the provided package {path}, if
|
||||
" present in the current Go buffer. If {path} is not being
|
||||
" imported, an error will be displayed and the buffer will be
|
||||
" untouched.
|
||||
"
|
||||
" If you would like to add shortcuts, you can do so by doing the following:
|
||||
"
|
||||
" Import fmt
|
||||
" au Filetype go nnoremap <buffer> <LocalLeader>f :Import fmt<CR>
|
||||
"
|
||||
" Drop fmt
|
||||
" au Filetype go nnoremap <buffer> <LocalLeader>F :Drop fmt<CR>
|
||||
"
|
||||
" Import the word under your cursor
|
||||
" au Filetype go nnoremap <buffer> <LocalLeader>k
|
||||
" \ :exe 'Import ' . expand('<cword>')<CR>
|
||||
"
|
||||
" The backslash '\' is the default maplocalleader, so it is possible that
|
||||
" your vim is set to use a different character (:help maplocalleader).
|
||||
"
|
||||
" Options:
|
||||
"
|
||||
" g:go_import_commands [default=1]
|
||||
"
|
||||
" Flag to indicate whether to enable the commands listed above.
|
||||
"
|
||||
if exists("b:did_ftplugin_go_import")
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists("g:go_import_commands")
|
||||
let g:go_import_commands = 1
|
||||
endif
|
||||
|
||||
if g:go_import_commands
|
||||
command! -buffer -nargs=? -complete=customlist,go#complete#Package Drop call s:SwitchImport(0, '', <f-args>)
|
||||
command! -buffer -nargs=1 -complete=customlist,go#complete#Package Import call s:SwitchImport(1, '', <f-args>)
|
||||
command! -buffer -nargs=* -complete=customlist,go#complete#Package ImportAs call s:SwitchImport(1, <f-args>)
|
||||
endif
|
||||
|
||||
function! s:SwitchImport(enabled, localname, path)
|
||||
let view = winsaveview()
|
||||
let path = a:path
|
||||
|
||||
" Quotes are not necessary, so remove them if provided.
|
||||
if path[0] == '"'
|
||||
let path = strpart(path, 1)
|
||||
endif
|
||||
if path[len(path)-1] == '"'
|
||||
let path = strpart(path, 0, len(path) - 1)
|
||||
endif
|
||||
if path == ''
|
||||
call s:Error('Import path not provided')
|
||||
return
|
||||
endif
|
||||
|
||||
" Extract any site prefix (e.g. github.com/).
|
||||
" If other imports with the same prefix are grouped separately,
|
||||
" we will add this new import with them.
|
||||
" Only up to and including the first slash is used.
|
||||
let siteprefix = matchstr(path, "^[^/]*/")
|
||||
|
||||
let qpath = '"' . path . '"'
|
||||
if a:localname != ''
|
||||
let qlocalpath = a:localname . ' ' . qpath
|
||||
else
|
||||
let qlocalpath = qpath
|
||||
endif
|
||||
let indentstr = 0
|
||||
let packageline = -1 " Position of package name statement
|
||||
let appendline = -1 " Position to introduce new import
|
||||
let deleteline = -1 " Position of line with existing import
|
||||
let linesdelta = 0 " Lines added/removed
|
||||
|
||||
" Find proper place to add/remove import.
|
||||
let line = 0
|
||||
while line <= line('$')
|
||||
let linestr = getline(line)
|
||||
|
||||
if linestr =~# '^package\s'
|
||||
let packageline = line
|
||||
let appendline = line
|
||||
|
||||
elseif linestr =~# '^import\s\+('
|
||||
let appendstr = qlocalpath
|
||||
let indentstr = 1
|
||||
let appendline = line
|
||||
let firstblank = -1
|
||||
let lastprefix = ""
|
||||
while line <= line("$")
|
||||
let line = line + 1
|
||||
let linestr = getline(line)
|
||||
let m = matchlist(getline(line), '^\()\|\(\s\+\)\(\S*\s*\)"\(.\+\)"\)')
|
||||
if empty(m)
|
||||
if siteprefix == "" && a:enabled
|
||||
" must be in the first group
|
||||
break
|
||||
endif
|
||||
" record this position, but keep looking
|
||||
if firstblank < 0
|
||||
let firstblank = line
|
||||
endif
|
||||
continue
|
||||
endif
|
||||
if m[1] == ')'
|
||||
" if there's no match, add it to the first group
|
||||
if appendline < 0 && firstblank >= 0
|
||||
let appendline = firstblank
|
||||
endif
|
||||
break
|
||||
endif
|
||||
let lastprefix = matchstr(m[4], "^[^/]*/")
|
||||
if a:localname != '' && m[3] != ''
|
||||
let qlocalpath = printf('%-' . (len(m[3])-1) . 's %s', a:localname, qpath)
|
||||
endif
|
||||
let appendstr = m[2] . qlocalpath
|
||||
let indentstr = 0
|
||||
if m[4] == path
|
||||
let appendline = -1
|
||||
let deleteline = line
|
||||
break
|
||||
elseif m[4] < path
|
||||
" don't set candidate position if we have a site prefix,
|
||||
" we've passed a blank line, and this doesn't share the same
|
||||
" site prefix.
|
||||
if siteprefix == "" || firstblank < 0 || match(m[4], "^" . siteprefix) >= 0
|
||||
let appendline = line
|
||||
endif
|
||||
elseif siteprefix != "" && match(m[4], "^" . siteprefix) >= 0
|
||||
" first entry of site group
|
||||
let appendline = line - 1
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
break
|
||||
|
||||
elseif linestr =~# '^import '
|
||||
if appendline == packageline
|
||||
let appendstr = 'import ' . qlocalpath
|
||||
let appendline = line - 1
|
||||
endif
|
||||
let m = matchlist(linestr, '^import\(\s\+\)\(\S*\s*\)"\(.\+\)"')
|
||||
if !empty(m)
|
||||
if m[3] == path
|
||||
let appendline = -1
|
||||
let deleteline = line
|
||||
break
|
||||
endif
|
||||
if m[3] < path
|
||||
let appendline = line
|
||||
endif
|
||||
if a:localname != '' && m[2] != ''
|
||||
let qlocalpath = printf("%s %" . len(m[2])-1 . "s", a:localname, qpath)
|
||||
endif
|
||||
let appendstr = 'import' . m[1] . qlocalpath
|
||||
endif
|
||||
|
||||
elseif linestr =~# '^\(var\|const\|type\|func\)\>'
|
||||
break
|
||||
|
||||
endif
|
||||
let line = line + 1
|
||||
endwhile
|
||||
|
||||
" Append or remove the package import, as requested.
|
||||
if a:enabled
|
||||
if deleteline != -1
|
||||
call s:Error(qpath . ' already being imported')
|
||||
elseif appendline == -1
|
||||
call s:Error('No package line found')
|
||||
else
|
||||
if appendline == packageline
|
||||
call append(appendline + 0, '')
|
||||
call append(appendline + 1, 'import (')
|
||||
call append(appendline + 2, ')')
|
||||
let appendline += 2
|
||||
let linesdelta += 3
|
||||
let appendstr = qlocalpath
|
||||
let indentstr = 1
|
||||
endif
|
||||
call append(appendline, appendstr)
|
||||
execute appendline + 1
|
||||
if indentstr
|
||||
execute 'normal >>'
|
||||
endif
|
||||
let linesdelta += 1
|
||||
endif
|
||||
else
|
||||
if deleteline == -1
|
||||
call s:Error(qpath . ' not being imported')
|
||||
else
|
||||
execute deleteline . 'd'
|
||||
let linesdelta -= 1
|
||||
|
||||
if getline(deleteline-1) =~# '^import\s\+(' && getline(deleteline) =~# '^)'
|
||||
" Delete empty import block
|
||||
let deleteline -= 1
|
||||
execute deleteline . "d"
|
||||
execute deleteline . "d"
|
||||
let linesdelta -= 2
|
||||
endif
|
||||
|
||||
if getline(deleteline) == '' && getline(deleteline - 1) == ''
|
||||
" Delete spacing for removed line too.
|
||||
execute deleteline . "d"
|
||||
let linesdelta -= 1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
" Adjust view for any changes.
|
||||
let view.lnum += linesdelta
|
||||
let view.topline += linesdelta
|
||||
if view.topline < 0
|
||||
let view.topline = 0
|
||||
endif
|
||||
|
||||
" Put buffer back where it was.
|
||||
call winrestview(view)
|
||||
|
||||
endfunction
|
||||
|
||||
function! s:Error(s)
|
||||
echohl Error | echo a:s | echohl None
|
||||
endfunction
|
||||
|
||||
let b:did_ftplugin_go_import = 1
|
||||
|
||||
" vim:ts=4:sw=4:et
|
@ -1,78 +0,0 @@
|
||||
#!/bin/bash -e
|
||||
#
|
||||
# Copyright 2012 The Go Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
#
|
||||
# Tests for import.vim.
|
||||
|
||||
cd $(dirname $0)
|
||||
|
||||
cat > base.go <<EOF
|
||||
package test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"net"
|
||||
|
||||
"mycorp/foo"
|
||||
)
|
||||
EOF
|
||||
|
||||
fail=0
|
||||
|
||||
# usage: test_one command pattern
|
||||
# Pattern is a PCRE expression that will match across lines.
|
||||
test_one() {
|
||||
echo 2>&1 -n "$1: "
|
||||
vim -e -s -u /dev/null -U /dev/null --noplugin -c "source import.vim" \
|
||||
-c "$1" -c 'wq! test.go' base.go
|
||||
# ensure blank lines are treated correctly
|
||||
if ! gofmt test.go | cmp test.go -; then
|
||||
echo 2>&1 "gofmt conflict"
|
||||
gofmt test.go | diff -u test.go - | sed "s/^/ /" 2>&1
|
||||
fail=1
|
||||
return
|
||||
fi
|
||||
if ! [[ $(cat test.go) =~ $2 ]]; then
|
||||
echo 2>&1 "$2 did not match"
|
||||
cat test.go | sed "s/^/ /" 2>&1
|
||||
fail=1
|
||||
return
|
||||
fi
|
||||
echo 2>&1 "ok"
|
||||
}
|
||||
|
||||
# Tests for Import
|
||||
|
||||
test_one "Import baz" '"baz".*"bytes"'
|
||||
test_one "Import io/ioutil" '"io".*"io/ioutil".*"net"'
|
||||
test_one "Import myc" '"io".*"myc".*"net"' # prefix of a site prefix
|
||||
test_one "Import nat" '"io".*"nat".*"net"'
|
||||
test_one "Import net/http" '"net".*"net/http".*"mycorp/foo"'
|
||||
test_one "Import zoo" '"net".*"zoo".*"mycorp/foo"'
|
||||
test_one "Import mycorp/bar" '"net".*"mycorp/bar".*"mycorp/foo"'
|
||||
test_one "Import mycorp/goo" '"net".*"mycorp/foo".*"mycorp/goo"'
|
||||
|
||||
# Tests for Drop
|
||||
|
||||
cat > base.go <<EOF
|
||||
package test
|
||||
|
||||
import (
|
||||
"foo"
|
||||
|
||||
"something"
|
||||
"zoo"
|
||||
)
|
||||
EOF
|
||||
|
||||
test_one "Drop something" '\([^"]*"foo"[^"]*"zoo"[^"]*\)'
|
||||
|
||||
rm -f base.go test.go
|
||||
if [ $fail -gt 0 ]; then
|
||||
echo 2>&1 "FAIL"
|
||||
exit 1
|
||||
fi
|
||||
echo 2>&1 "PASS"
|
@ -1,65 +0,0 @@
|
||||
" Copyright 2011 The Go Authors. All rights reserved.
|
||||
" Use of this source code is governed by a BSD-style
|
||||
" license that can be found in the LICENSE file.
|
||||
"
|
||||
" indent/go.vim: Vim indent file for Go.
|
||||
"
|
||||
" TODO:
|
||||
" - function invocations split across lines
|
||||
" - general line splits (line ends in an operator)
|
||||
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
" C indentation is too far off useful, mainly due to Go's := operator.
|
||||
" Let's just define our own.
|
||||
setlocal nolisp
|
||||
setlocal autoindent
|
||||
setlocal indentexpr=GoIndent(v:lnum)
|
||||
setlocal indentkeys+=<:>,0=},0=)
|
||||
|
||||
if exists("*GoIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! GoIndent(lnum)
|
||||
let prevlnum = prevnonblank(a:lnum-1)
|
||||
if prevlnum == 0
|
||||
" top of file
|
||||
return 0
|
||||
endif
|
||||
|
||||
" grab the previous and current line, stripping comments.
|
||||
let prevl = substitute(getline(prevlnum), '//.*$', '', '')
|
||||
let thisl = substitute(getline(a:lnum), '//.*$', '', '')
|
||||
let previ = indent(prevlnum)
|
||||
|
||||
let ind = previ
|
||||
|
||||
if prevl =~ '[({]\s*$'
|
||||
" previous line opened a block
|
||||
let ind += &sw
|
||||
endif
|
||||
if prevl =~# '^\s*\(case .*\|default\):$'
|
||||
" previous line is part of a switch statement
|
||||
let ind += &sw
|
||||
endif
|
||||
" TODO: handle if the previous line is a label.
|
||||
|
||||
if thisl =~ '^\s*[)}]'
|
||||
" this line closed a block
|
||||
let ind -= &sw
|
||||
endif
|
||||
|
||||
" Colons are tricky.
|
||||
" We want to outdent if it's part of a switch ("case foo:" or "default:").
|
||||
" We ignore trying to deal with jump labels because (a) they're rare, and
|
||||
" (b) they're hard to disambiguate from a composite literal key.
|
||||
if thisl =~# '^\s*\(case .*\|default\):$'
|
||||
let ind -= &sw
|
||||
endif
|
||||
|
||||
return ind
|
||||
endfunction
|
@ -1,6 +0,0 @@
|
||||
This is a mirror of the misc/vim portion of the official Go repository. It is
|
||||
automatically updated.
|
||||
|
||||
Any contributions or issues should be made to the official repository.
|
||||
|
||||
http://golang.org/doc/contribute.html
|
@ -1,130 +0,0 @@
|
||||
" Copyright 2011 The Go Authors. All rights reserved.
|
||||
" Use of this source code is governed by a BSD-style
|
||||
" license that can be found in the LICENSE file.
|
||||
"
|
||||
" godoc.vim: Vim command to see godoc.
|
||||
"
|
||||
"
|
||||
" Commands:
|
||||
"
|
||||
" :Godoc
|
||||
"
|
||||
" Open the relevant Godoc for either the word[s] passed to the command or
|
||||
" the, by default, the word under the cursor.
|
||||
"
|
||||
" Options:
|
||||
"
|
||||
" g:go_godoc_commands [default=1]
|
||||
"
|
||||
" Flag to indicate whether to enable the commands listed above.
|
||||
|
||||
if exists("g:loaded_godoc")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_godoc = 1
|
||||
|
||||
let s:buf_nr = -1
|
||||
let s:last_word = ''
|
||||
|
||||
if !exists('g:go_godoc_commands')
|
||||
let g:go_godoc_commands = 1
|
||||
endif
|
||||
|
||||
if g:go_godoc_commands
|
||||
command! -nargs=* -range -complete=customlist,go#complete#Package Godoc :call s:Godoc(<f-args>)
|
||||
endif
|
||||
|
||||
nnoremap <silent> <Plug>(godoc-keyword) :<C-u>call <SID>Godoc('')<CR>
|
||||
|
||||
function! s:GodocView()
|
||||
if !bufexists(s:buf_nr)
|
||||
leftabove new
|
||||
file `="[Godoc]"`
|
||||
let s:buf_nr = bufnr('%')
|
||||
elseif bufwinnr(s:buf_nr) == -1
|
||||
leftabove split
|
||||
execute s:buf_nr . 'buffer'
|
||||
delete _
|
||||
elseif bufwinnr(s:buf_nr) != bufwinnr('%')
|
||||
execute bufwinnr(s:buf_nr) . 'wincmd w'
|
||||
endif
|
||||
|
||||
setlocal filetype=godoc
|
||||
setlocal bufhidden=delete
|
||||
setlocal buftype=nofile
|
||||
setlocal noswapfile
|
||||
setlocal nobuflisted
|
||||
setlocal modifiable
|
||||
setlocal nocursorline
|
||||
setlocal nocursorcolumn
|
||||
setlocal iskeyword+=:
|
||||
setlocal iskeyword-=-
|
||||
|
||||
nnoremap <buffer> <silent> K :Godoc<cr>
|
||||
|
||||
au BufHidden <buffer> call let <SID>buf_nr = -1
|
||||
endfunction
|
||||
|
||||
function! s:GodocWord(word)
|
||||
if !executable('godoc')
|
||||
echohl WarningMsg
|
||||
echo "godoc command not found."
|
||||
echo " install with: go get code.google.com/p/go.tools/cmd/godoc"
|
||||
echohl None
|
||||
return 0
|
||||
endif
|
||||
let word = a:word
|
||||
silent! let content = system('godoc ' . word)
|
||||
if v:shell_error || !len(content)
|
||||
if len(s:last_word)
|
||||
silent! let content = system('godoc ' . s:last_word.'/'.word)
|
||||
if v:shell_error || !len(content)
|
||||
echo 'No documentation found for "' . word . '".'
|
||||
return 0
|
||||
endif
|
||||
let word = s:last_word.'/'.word
|
||||
else
|
||||
echo 'No documentation found for "' . word . '".'
|
||||
return 0
|
||||
endif
|
||||
endif
|
||||
let s:last_word = word
|
||||
silent! call s:GodocView()
|
||||
setlocal modifiable
|
||||
silent! %d _
|
||||
silent! put! =content
|
||||
silent! normal gg
|
||||
setlocal nomodifiable
|
||||
setfiletype godoc
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! s:Godoc(...)
|
||||
if !len(a:000)
|
||||
let oldiskeyword = &iskeyword
|
||||
setlocal iskeyword+=.
|
||||
let word = expand('<cword>')
|
||||
let &iskeyword = oldiskeyword
|
||||
let word = substitute(word, '[^a-zA-Z0-9\\/._~-]', '', 'g')
|
||||
let words = split(word, '\.\ze[^./]\+$')
|
||||
else
|
||||
let words = a:000
|
||||
endif
|
||||
if !len(words)
|
||||
return
|
||||
endif
|
||||
if s:GodocWord(words[0])
|
||||
if len(words) > 1
|
||||
if search('^\%(const\|var\|type\|\s\+\) ' . words[1] . '\s\+=\s')
|
||||
return
|
||||
endif
|
||||
if search('^func ' . words[1] . '(')
|
||||
silent! normal zt
|
||||
return
|
||||
endif
|
||||
echo 'No documentation found for "' . words[1] . '".'
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" vim:ts=4:sw=4:et
|
@ -1,101 +0,0 @@
|
||||
Vim plugins for Go (http://golang.org)
|
||||
======================================
|
||||
|
||||
To use all the Vim plugins, add these lines to your $HOME/.vimrc.
|
||||
|
||||
" Some Linux distributions set filetype in /etc/vimrc.
|
||||
" Clear filetype flags before changing runtimepath to force Vim to reload them.
|
||||
filetype off
|
||||
filetype plugin indent off
|
||||
set runtimepath+=$GOROOT/misc/vim
|
||||
filetype plugin indent on
|
||||
syntax on
|
||||
|
||||
If you want to select fewer plugins, use the instructions in the rest of
|
||||
this file.
|
||||
|
||||
A popular configuration is to gofmt Go source files when they are saved.
|
||||
To do that, add this line to the end of your $HOME/.vimrc.
|
||||
|
||||
autocmd FileType go autocmd BufWritePre <buffer> Fmt
|
||||
|
||||
|
||||
Vim syntax highlighting
|
||||
-----------------------
|
||||
|
||||
To install automatic syntax highlighting for GO programs:
|
||||
|
||||
1. Copy or link the filetype detection script to the ftdetect directory
|
||||
underneath your vim runtime directory (normally $HOME/.vim/ftdetect)
|
||||
2. Copy or link syntax/go.vim to the syntax directory underneath your vim
|
||||
runtime directory (normally $HOME/.vim/syntax). Linking this file rather
|
||||
than just copying it will ensure any changes are automatically reflected
|
||||
in your syntax highlighting.
|
||||
3. Add the following line to your .vimrc file (normally $HOME/.vimrc):
|
||||
|
||||
syntax on
|
||||
|
||||
In a typical unix environment you might accomplish this using the following
|
||||
commands:
|
||||
|
||||
mkdir -p $HOME/.vim/ftdetect
|
||||
mkdir -p $HOME/.vim/syntax
|
||||
mkdir -p $HOME/.vim/autoload/go
|
||||
ln -s $GOROOT/misc/vim/ftdetect/gofiletype.vim $HOME/.vim/ftdetect/
|
||||
ln -s $GOROOT/misc/vim/syntax/go.vim $HOME/.vim/syntax
|
||||
ln -s $GOROOT/misc/vim/autoload/go/complete.vim $HOME/.vim/autoload/go
|
||||
echo "syntax on" >> $HOME/.vimrc
|
||||
|
||||
|
||||
Vim filetype plugins
|
||||
--------------------
|
||||
|
||||
To install one of the available filetype plugins:
|
||||
|
||||
1. Same as 1 above.
|
||||
2. Copy or link ftplugin/go.vim to the ftplugin directory underneath your vim
|
||||
runtime directory (normally $HOME/.vim/ftplugin). Copy or link one or more
|
||||
additional plugins from ftplugin/go/*.vim to the Go-specific subdirectory
|
||||
in the same place ($HOME/.vim/ftplugin/go/*.vim).
|
||||
3. Add the following line to your .vimrc file (normally $HOME/.vimrc):
|
||||
|
||||
filetype plugin on
|
||||
|
||||
|
||||
Vim indentation plugin
|
||||
----------------------
|
||||
|
||||
To install automatic indentation:
|
||||
|
||||
1. Same as 1 above.
|
||||
2. Copy or link indent/go.vim to the indent directory underneath your vim
|
||||
runtime directory (normally $HOME/.vim/indent).
|
||||
3. Add the following line to your .vimrc file (normally $HOME/.vimrc):
|
||||
|
||||
filetype indent on
|
||||
|
||||
|
||||
Vim compiler plugin
|
||||
-------------------
|
||||
|
||||
To install the compiler plugin:
|
||||
|
||||
1. Same as 1 above.
|
||||
2. Copy or link compiler/go.vim to the compiler directory underneath your vim
|
||||
runtime directory (normally $HOME/.vim/compiler).
|
||||
3. Activate the compiler plugin with ":compiler go". To always enable the
|
||||
compiler plugin in Go source files add an autocommand to your .vimrc file
|
||||
(normally $HOME/.vimrc):
|
||||
|
||||
autocmd FileType go compiler go
|
||||
|
||||
|
||||
Godoc plugin
|
||||
------------
|
||||
|
||||
To install godoc plugin:
|
||||
|
||||
1. Same as 1 above.
|
||||
2. Copy or link plugin/godoc.vim to $HOME/.vim/plugin/godoc,
|
||||
syntax/godoc.vim to $HOME/.vim/syntax/godoc.vim,
|
||||
and autoload/go/complete.vim to $HOME/.vim/autoload/go/complete.vim.
|
@ -1,207 +0,0 @@
|
||||
" Copyright 2009 The Go Authors. All rights reserved.
|
||||
" Use of this source code is governed by a BSD-style
|
||||
" license that can be found in the LICENSE file.
|
||||
"
|
||||
" go.vim: Vim syntax file for Go.
|
||||
"
|
||||
" Options:
|
||||
" There are some options for customizing the highlighting; the recommended
|
||||
" settings are the default values, but you can write:
|
||||
" let OPTION_NAME = 0
|
||||
" in your ~/.vimrc file to disable particular options. You can also write:
|
||||
" let OPTION_NAME = 1
|
||||
" to enable particular options. At present, all options default to on.
|
||||
"
|
||||
" - go_highlight_array_whitespace_error
|
||||
" Highlights white space after "[]".
|
||||
" - go_highlight_chan_whitespace_error
|
||||
" Highlights white space around the communications operator that don't follow
|
||||
" the standard style.
|
||||
" - go_highlight_extra_types
|
||||
" Highlights commonly used library types (io.Reader, etc.).
|
||||
" - go_highlight_space_tab_error
|
||||
" Highlights instances of tabs following spaces.
|
||||
" - go_highlight_trailing_whitespace_error
|
||||
" Highlights trailing white space.
|
||||
|
||||
" Quit when a (custom) syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists("go_highlight_array_whitespace_error")
|
||||
let go_highlight_array_whitespace_error = 1
|
||||
endif
|
||||
if !exists("go_highlight_chan_whitespace_error")
|
||||
let go_highlight_chan_whitespace_error = 1
|
||||
endif
|
||||
if !exists("go_highlight_extra_types")
|
||||
let go_highlight_extra_types = 1
|
||||
endif
|
||||
if !exists("go_highlight_space_tab_error")
|
||||
let go_highlight_space_tab_error = 1
|
||||
endif
|
||||
if !exists("go_highlight_trailing_whitespace_error")
|
||||
let go_highlight_trailing_whitespace_error = 1
|
||||
endif
|
||||
|
||||
syn case match
|
||||
|
||||
syn keyword goDirective package import
|
||||
syn keyword goDeclaration var const type
|
||||
syn keyword goDeclType struct interface
|
||||
|
||||
hi def link goDirective Statement
|
||||
hi def link goDeclaration Keyword
|
||||
hi def link goDeclType Keyword
|
||||
|
||||
" Keywords within functions
|
||||
syn keyword goStatement defer go goto return break continue fallthrough
|
||||
syn keyword goConditional if else switch select
|
||||
syn keyword goLabel case default
|
||||
syn keyword goRepeat for range
|
||||
|
||||
hi def link goStatement Statement
|
||||
hi def link goConditional Conditional
|
||||
hi def link goLabel Label
|
||||
hi def link goRepeat Repeat
|
||||
|
||||
" Predefined types
|
||||
syn keyword goType chan map bool string error
|
||||
syn keyword goSignedInts int int8 int16 int32 int64 rune
|
||||
syn keyword goUnsignedInts byte uint uint8 uint16 uint32 uint64 uintptr
|
||||
syn keyword goFloats float32 float64
|
||||
syn keyword goComplexes complex64 complex128
|
||||
|
||||
hi def link goType Type
|
||||
hi def link goSignedInts Type
|
||||
hi def link goUnsignedInts Type
|
||||
hi def link goFloats Type
|
||||
hi def link goComplexes Type
|
||||
|
||||
" Treat func specially: it's a declaration at the start of a line, but a type
|
||||
" elsewhere. Order matters here.
|
||||
syn match goType /\<func\>/
|
||||
syn match goDeclaration /^func\>/
|
||||
|
||||
" Predefined functions and values
|
||||
syn keyword goBuiltins append cap close complex copy delete imag len
|
||||
syn keyword goBuiltins make new panic print println real recover
|
||||
syn keyword goConstants iota true false nil
|
||||
|
||||
hi def link goBuiltins Keyword
|
||||
hi def link goConstants Keyword
|
||||
|
||||
" Comments; their contents
|
||||
syn keyword goTodo contained TODO FIXME XXX BUG
|
||||
syn cluster goCommentGroup contains=goTodo
|
||||
syn region goComment start="/\*" end="\*/" contains=@goCommentGroup,@Spell
|
||||
syn region goComment start="//" end="$" contains=@goCommentGroup,@Spell
|
||||
|
||||
hi def link goComment Comment
|
||||
hi def link goTodo Todo
|
||||
|
||||
" Go escapes
|
||||
syn match goEscapeOctal display contained "\\[0-7]\{3}"
|
||||
syn match goEscapeC display contained +\\[abfnrtv\\'"]+
|
||||
syn match goEscapeX display contained "\\x\x\{2}"
|
||||
syn match goEscapeU display contained "\\u\x\{4}"
|
||||
syn match goEscapeBigU display contained "\\U\x\{8}"
|
||||
syn match goEscapeError display contained +\\[^0-7xuUabfnrtv\\'"]+
|
||||
|
||||
hi def link goEscapeOctal goSpecialString
|
||||
hi def link goEscapeC goSpecialString
|
||||
hi def link goEscapeX goSpecialString
|
||||
hi def link goEscapeU goSpecialString
|
||||
hi def link goEscapeBigU goSpecialString
|
||||
hi def link goSpecialString Special
|
||||
hi def link goEscapeError Error
|
||||
|
||||
" Strings and their contents
|
||||
syn cluster goStringGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU,goEscapeError
|
||||
syn region goString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@goStringGroup
|
||||
syn region goRawString start=+`+ end=+`+
|
||||
|
||||
hi def link goString String
|
||||
hi def link goRawString String
|
||||
|
||||
" Characters; their contents
|
||||
syn cluster goCharacterGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU
|
||||
syn region goCharacter start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@goCharacterGroup
|
||||
|
||||
hi def link goCharacter Character
|
||||
|
||||
" Regions
|
||||
syn region goBlock start="{" end="}" transparent fold
|
||||
syn region goParen start='(' end=')' transparent
|
||||
|
||||
" Integers
|
||||
syn match goDecimalInt "\<\d\+\([Ee]\d\+\)\?\>"
|
||||
syn match goHexadecimalInt "\<0x\x\+\>"
|
||||
syn match goOctalInt "\<0\o\+\>"
|
||||
syn match goOctalError "\<0\o*[89]\d*\>"
|
||||
|
||||
hi def link goDecimalInt Integer
|
||||
hi def link goHexadecimalInt Integer
|
||||
hi def link goOctalInt Integer
|
||||
hi def link Integer Number
|
||||
|
||||
" Floating point
|
||||
syn match goFloat "\<\d\+\.\d*\([Ee][-+]\d\+\)\?\>"
|
||||
syn match goFloat "\<\.\d\+\([Ee][-+]\d\+\)\?\>"
|
||||
syn match goFloat "\<\d\+[Ee][-+]\d\+\>"
|
||||
|
||||
hi def link goFloat Float
|
||||
|
||||
" Imaginary literals
|
||||
syn match goImaginary "\<\d\+i\>"
|
||||
syn match goImaginary "\<\d\+\.\d*\([Ee][-+]\d\+\)\?i\>"
|
||||
syn match goImaginary "\<\.\d\+\([Ee][-+]\d\+\)\?i\>"
|
||||
syn match goImaginary "\<\d\+[Ee][-+]\d\+i\>"
|
||||
|
||||
hi def link goImaginary Number
|
||||
|
||||
" Spaces after "[]"
|
||||
if go_highlight_array_whitespace_error != 0
|
||||
syn match goSpaceError display "\(\[\]\)\@<=\s\+"
|
||||
endif
|
||||
|
||||
" Spacing errors around the 'chan' keyword
|
||||
if go_highlight_chan_whitespace_error != 0
|
||||
" receive-only annotation on chan type
|
||||
syn match goSpaceError display "\(<-\)\@<=\s\+\(chan\>\)\@="
|
||||
" send-only annotation on chan type
|
||||
syn match goSpaceError display "\(\<chan\)\@<=\s\+\(<-\)\@="
|
||||
" value-ignoring receives in a few contexts
|
||||
syn match goSpaceError display "\(\(^\|[={(,;]\)\s*<-\)\@<=\s\+"
|
||||
endif
|
||||
|
||||
" Extra types commonly seen
|
||||
if go_highlight_extra_types != 0
|
||||
syn match goExtraType /\<bytes\.\(Buffer\)\>/
|
||||
syn match goExtraType /\<io\.\(Reader\|Writer\|ReadWriter\|ReadWriteCloser\)\>/
|
||||
syn match goExtraType /\<reflect\.\(Kind\|Type\|Value\)\>/
|
||||
syn match goExtraType /\<unsafe\.Pointer\>/
|
||||
endif
|
||||
|
||||
" Space-tab error
|
||||
if go_highlight_space_tab_error != 0
|
||||
syn match goSpaceError display " \+\t"me=e-1
|
||||
endif
|
||||
|
||||
" Trailing white space error
|
||||
if go_highlight_trailing_whitespace_error != 0
|
||||
syn match goSpaceError display excludenl "\s\+$"
|
||||
endif
|
||||
|
||||
hi def link goExtraType Type
|
||||
hi def link goSpaceError Error
|
||||
|
||||
" Search backwards for a global declaration to start processing the syntax.
|
||||
"syn sync match goSync grouphere NONE /^\(const\|var\|type\|func\)\>/
|
||||
|
||||
" There's a bug in the implementation of grouphere. For now, use the
|
||||
" following as a more expensive/less precise workaround.
|
||||
syn sync minlines=500
|
||||
|
||||
let b:current_syntax = "go"
|
@ -1,20 +0,0 @@
|
||||
" Copyright 2011 The Go Authors. All rights reserved.
|
||||
" Use of this source code is governed by a BSD-style
|
||||
" license that can be found in the LICENSE file.
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syn case match
|
||||
syn match godocTitle "^\([A-Z][A-Z ]*\)$"
|
||||
|
||||
command -nargs=+ HiLink hi def link <args>
|
||||
|
||||
HiLink godocTitle Title
|
||||
|
||||
delcommand HiLink
|
||||
|
||||
let b:current_syntax = "godoc"
|
||||
|
||||
" vim:ts=4 sts=2 sw=2:
|
2
bundle/vim-indent-object/.gitignore
vendored
2
bundle/vim-indent-object/.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
tags
|
||||
|
@ -1,120 +0,0 @@
|
||||
*indent-object.txt* Text objects based on indent levels.
|
||||
|
||||
Copyright (c) 2010 Michael Smith
|
||||
|
||||
Indent Text Objects
|
||||
|
||||
INTRODUCTION |idntobj-introduction|
|
||||
TEXT OBJECTS |idntobj-objects|
|
||||
BLANK LINES |idntobj-blanklines|
|
||||
ABOUT |idntobj-about|
|
||||
|
||||
|
||||
==============================================================================
|
||||
INTRODUCTION *idntobj-introduction*
|
||||
|
||||
Vim text objects provide a convenient way to select and operate on various
|
||||
types of objects. These objects include regions surrounded by various types of
|
||||
brackets and various parts of language (ie sentences, paragraphs, etc).
|
||||
|
||||
This plugin defines a new text object, based on indentation levels. This is
|
||||
very useful in languages such as Python, in which the syntax defines scope in
|
||||
terms of indentation. Using the objects defined in this plugin, an entire if
|
||||
structure can be quickly selected, for example.
|
||||
|
||||
|
||||
==============================================================================
|
||||
TEXT OBJECTS *ai* *ii* *aI* *iI* *idntobj-objects*
|
||||
|
||||
This plugin defines two new text objects. These are very similar - they differ
|
||||
only in whether they include the line below the block or not.
|
||||
|
||||
Key Mapping Description ~
|
||||
>
|
||||
<count>ai (A)n (I)ndentation level and line above.
|
||||
<count>ii (I)nner (I)ndentation level (no line above).
|
||||
<count>aI (A)n (I)ndentation level and lines above/below.
|
||||
<count>iI (I)nner (I)ndentation level (no lines above/below).
|
||||
<
|
||||
|
||||
Note that the iI mapping is mostly included simply for completeness, it is
|
||||
effectively a synonym for ii.
|
||||
|
||||
Just like regular text objects, these mappings can be used either with
|
||||
operators expecting a motion, such as 'd' or 'c', as well as in visual mode.
|
||||
In visual mode the mapping can be repeated, which has the effect of
|
||||
iteratively increasing the scope of indentation block selected. Specifying a
|
||||
count can be used to achieve the same effect.
|
||||
|
||||
The difference between |ai| and |aI| is that |ai| includes the line
|
||||
immediately above the indentation block, whereas aI includes not only that,
|
||||
but also the line below. Which of these is most useful largely depends on the
|
||||
structure of the language being edited.
|
||||
|
||||
For example, when editing the Python code, |ai| is generally more useful, as
|
||||
the line above the indentation block is usually related to it. For example, in
|
||||
the following code (* is used to indicate the cursor position):
|
||||
>
|
||||
if foo > 3:
|
||||
log("foo is big") *
|
||||
foo = 3
|
||||
do_something_else()
|
||||
<
|
||||
the if clause is logically related to the code block, whereas the function
|
||||
call below is not. It is unlikely we would want to select the line below when
|
||||
we are interested in the if block.
|
||||
|
||||
However, in other languages, such as Vim scripts, control structures are
|
||||
usually terminated with something like 'endif'. Therefore, in this example:
|
||||
>
|
||||
if foo > 3
|
||||
echo "foo is big" *
|
||||
let foo = 3
|
||||
endif
|
||||
call do_something_else()
|
||||
<
|
||||
we would more likely want to include the endif when we select the if
|
||||
structure.
|
||||
|
||||
|
||||
==============================================================================
|
||||
BLANK LINES *idntobj-blanklines*
|
||||
|
||||
When scanning code blocks, the plugin usually ignores blank lines. There is an
|
||||
exception to this, however, when the block being selected is not indented. In
|
||||
this case if blank lines are ignored, then the entire file would be selected.
|
||||
Instead when code at the top level is being indented blank lines are
|
||||
considered to delimit the block.
|
||||
|
||||
|
||||
==============================================================================
|
||||
ABOUT *idntobj-about*
|
||||
|
||||
vim-indent-object was written by Michael Smith <msmith@msmith.id.au>. The
|
||||
project repository is kept at:
|
||||
|
||||
http://github.com/michaeljsmith/vim-indent-object
|
||||
|
||||
Any feedback or criticism is welcome, and can be mailed to the author at the
|
||||
above email address. Alternatively issues can be raised on the project
|
||||
website.
|
||||
|
||||
Licence:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
@ -1,224 +0,0 @@
|
||||
"--------------------------------------------------------------------------------
|
||||
"
|
||||
" Copyright (c) 2010 Michael Smith <msmith@msmith.id.au>
|
||||
"
|
||||
" http://github.com/michaeljsmith/vim-indent-object
|
||||
"
|
||||
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
" of this software and associated documentation files (the "Software"), to
|
||||
" deal in the Software without restriction, including without limitation the
|
||||
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
" sell copies of the Software, and to permit persons to whom the Software is
|
||||
" furnished to do so, subject to the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included in
|
||||
" all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
" IN THE SOFTWARE.
|
||||
"
|
||||
"--------------------------------------------------------------------------------
|
||||
|
||||
" Mappings excluding line below.
|
||||
onoremap <silent>ai :<C-u>cal <Sid>HandleTextObjectMapping(0, 0, 0, [line("."), line("."), col("."), col(".")])<CR>
|
||||
onoremap <silent>ii :<C-u>cal <Sid>HandleTextObjectMapping(1, 0, 0, [line("."), line("."), col("."), col(".")])<CR>
|
||||
vnoremap <silent>ai :<C-u>cal <Sid>HandleTextObjectMapping(0, 0, 1, [line("'<"), line("'>"), col("'<"), col("'>")])<CR><Esc>gv
|
||||
vnoremap <silent>ii :<C-u>cal <Sid>HandleTextObjectMapping(1, 0, 1, [line("'<"), line("'>"), col("'<"), col("'>")])<CR><Esc>gv
|
||||
|
||||
" Mappings including line below.
|
||||
onoremap <silent>aI :<C-u>cal <Sid>HandleTextObjectMapping(0, 1, 0, [line("."), line("."), col("."), col(".")])<CR>
|
||||
onoremap <silent>iI :<C-u>cal <Sid>HandleTextObjectMapping(1, 1, 0, [line("."), line("."), col("."), col(".")])<CR>
|
||||
vnoremap <silent>aI :<C-u>cal <Sid>HandleTextObjectMapping(0, 1, 1, [line("'<"), line("'>"), col("'<"), col("'>")])<CR><Esc>gv
|
||||
vnoremap <silent>iI :<C-u>cal <Sid>HandleTextObjectMapping(1, 1, 1, [line("'<"), line("'>"), col("'<"), col("'>")])<CR><Esc>gv
|
||||
|
||||
let s:l0 = -1
|
||||
let s:l1 = -1
|
||||
let s:c0 = -1
|
||||
let s:c1 = -1
|
||||
|
||||
function! <Sid>TextObject(inner, incbelow, vis, range, count)
|
||||
|
||||
" Record the current state of the visual region.
|
||||
let vismode = "V"
|
||||
|
||||
" Detect if this is a completely new visual selction session.
|
||||
let new_vis = 0
|
||||
let new_vis = new_vis || s:l0 != a:range[0]
|
||||
let new_vis = new_vis || s:l1 != a:range[1]
|
||||
let new_vis = new_vis || s:c0 != a:range[2]
|
||||
let new_vis = new_vis || s:c1 != a:range[3]
|
||||
|
||||
let s:l0 = a:range[0]
|
||||
let s:l1 = a:range[1]
|
||||
let s:c0 = a:range[2]
|
||||
let s:c1 = a:range[3]
|
||||
|
||||
" Repeatedly increase the scope of the selection.
|
||||
let itr_cnt = 0
|
||||
let cnt = a:count
|
||||
while cnt > 0
|
||||
|
||||
" Look for the minimum indentation in the current visual region.
|
||||
let l = s:l0
|
||||
let idnt_invalid = 1000
|
||||
let idnt = idnt_invalid
|
||||
while l <= s:l1
|
||||
if !(getline(l) =~ "^\\s*$")
|
||||
let idnt = min([idnt, indent(l)])
|
||||
endif
|
||||
let l += 1
|
||||
endwhile
|
||||
|
||||
" Keep track of where the range should be expanded to.
|
||||
let l_1 = s:l0
|
||||
let l_1o = l_1
|
||||
let l2 = s:l1
|
||||
let l2o = l2
|
||||
|
||||
" If we are highlighting only blank lines, we may not have found a
|
||||
" valid indent. In this case we need to look for the next and previous
|
||||
" non blank lines and check which of those has the largest indent.
|
||||
if idnt == idnt_invalid
|
||||
let idnt = 0
|
||||
let pnb = prevnonblank(s:l0)
|
||||
if pnb
|
||||
let idnt = max([idnt, indent(pnb)])
|
||||
let l_1 = pnb
|
||||
endif
|
||||
let nnb = nextnonblank(s:l0)
|
||||
if nnb
|
||||
let idnt = max([idnt, indent(nnb)])
|
||||
endif
|
||||
|
||||
" If we are in whitespace at the beginning of a block, skip over
|
||||
" it when we are selecting the range. Similarly, if we are in
|
||||
" whitespace at the end, ignore it.
|
||||
if idnt > indent(pnb)
|
||||
let l_1 = nnb
|
||||
endif
|
||||
if idnt > indent(nnb)
|
||||
let l2 = pnb
|
||||
endif
|
||||
endif
|
||||
|
||||
" Search backward for the first line with less indent than the target
|
||||
" indent (skipping blank lines).
|
||||
let blnk = getline(l_1) =~ "^\\s*$"
|
||||
while l_1 > 0 && ((idnt == 0 && !blnk) || (idnt != 0 && (blnk || indent(l_1) >= idnt)))
|
||||
if !blnk || !a:inner
|
||||
let l_1o = l_1
|
||||
endif
|
||||
let l_1 -= 1
|
||||
let blnk = getline(l_1) =~ "^\\s*$"
|
||||
endwhile
|
||||
|
||||
" Search forward for the first line with more indent than the target
|
||||
" indent (skipping blank lines).
|
||||
let line_cnt = line("$")
|
||||
let blnk = getline(l2) =~ "^\\s*$"
|
||||
while l2 <= line_cnt && ((idnt == 0 && !blnk) || (idnt != 0 && (blnk || indent(l2) >= idnt)))
|
||||
if !blnk || !a:inner
|
||||
let l2o = l2
|
||||
endif
|
||||
let l2 += 1
|
||||
let blnk = getline(l2) =~ "^\\s*$"
|
||||
endwhile
|
||||
|
||||
" Determine which of these extensions to include. Include neither if
|
||||
" we are selecting an 'inner' object. Exclude the bottom unless are
|
||||
" told to include it.
|
||||
let idnt2 = max([indent(l_1), indent(l2)])
|
||||
if indent(l_1) < idnt2 || a:inner
|
||||
let l_1 = l_1o
|
||||
endif
|
||||
if indent(l2) < idnt2 || a:inner || !a:incbelow
|
||||
let l2 = l2o
|
||||
endif
|
||||
let l_1 = max([l_1, 1])
|
||||
let l2 = min([l2, line("$")])
|
||||
|
||||
" Extend the columns to the start and end.
|
||||
" If inner is selected, set the final cursor pos to the start
|
||||
" of the text in the line.
|
||||
let c_1 = 1
|
||||
if a:inner
|
||||
let c_1 = match(getline(l_1), "\\c\\S") + 1
|
||||
endif
|
||||
let c2 = len(getline(l2))
|
||||
if !a:inner
|
||||
let c2 += 1
|
||||
endif
|
||||
|
||||
" Make sure there's no change if we haven't really made a
|
||||
" significant change in linewise mode - this makes sure that
|
||||
" we can iteratively increase selection in linewise mode.
|
||||
if itr_cnt == 0 && vismode ==# 'V' && s:l0 == l_1 && s:l1 == l2
|
||||
let c_1 = s:c0
|
||||
let c2 = s:c1
|
||||
endif
|
||||
|
||||
" Check whether the visual region has changed.
|
||||
let chg = 0
|
||||
let chg = chg || s:l0 != l_1
|
||||
let chg = chg || s:l1 != l2
|
||||
let chg = chg || s:c0 != c_1
|
||||
let chg = chg || s:c1 != c2
|
||||
|
||||
if vismode ==# 'V' && new_vis
|
||||
let chg = 1
|
||||
endif
|
||||
|
||||
" Update the vars.
|
||||
let s:l0 = l_1
|
||||
let s:l1 = l2
|
||||
let s:c0 = c_1
|
||||
let s:c1 = c2
|
||||
|
||||
" If there was no change, then don't decrement the count (it didn't
|
||||
" count because it didn't do anything).
|
||||
if chg
|
||||
let cnt = cnt - 1
|
||||
else
|
||||
" Since this didn't work, push the selection back one char. This
|
||||
" will have the effect of getting the enclosing block. Do it at
|
||||
" the beginning rather than the end - the beginning is very likely
|
||||
" to be only one indentation level different.
|
||||
if s:l0 == 0
|
||||
return
|
||||
endif
|
||||
let s:l0 -= 1
|
||||
let s:c0 = len(getline(s:l0))
|
||||
endif
|
||||
|
||||
let itr_cnt += 1
|
||||
|
||||
endwhile
|
||||
|
||||
" Apply the range we have found. Make sure to use the current visual mode.
|
||||
call cursor(s:l0, s:c0)
|
||||
exe "normal! " . vismode
|
||||
call cursor(s:l1, s:c1)
|
||||
normal! o
|
||||
|
||||
" Update these static variables - we need to keep these up-to-date between
|
||||
" invocations because it's the only way we can detect whether it's a new
|
||||
" visual mode. We need to know if it's a new visual mode because otherwise
|
||||
" if there's a single line block in visual line mode and we select it with
|
||||
" "V", we can't tell whether it's already been selected using Vii.
|
||||
exe "normal! \<Esc>"
|
||||
let s:l0 = line("'<")
|
||||
let s:l1 = line("'>")
|
||||
let s:c0 = col("'<")
|
||||
let s:c1 = col("'>")
|
||||
normal gv
|
||||
|
||||
endfunction
|
||||
|
||||
function! <Sid>HandleTextObjectMapping(inner, incbelow, vis, range)
|
||||
call <Sid>TextObject(a:inner, a:incbelow, a:vis, a:range, v:count1)
|
||||
endfunction
|
@ -1 +0,0 @@
|
||||
Subproject commit d881b93dc4a8ed1374ad44439aeeb47808a6b91a
|
Loading…
Reference in New Issue
Block a user