diff --git a/bundle/nginx-vim/README.md b/bundle/nginx-vim/README.md deleted file mode 100755 index 8124452e..00000000 --- a/bundle/nginx-vim/README.md +++ /dev/null @@ -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 - - diff --git a/bundle/nginx-vim/ftdetect/nginx.vim b/bundle/nginx-vim/ftdetect/nginx.vim deleted file mode 100755 index d12c2bf1..00000000 --- a/bundle/nginx-vim/ftdetect/nginx.vim +++ /dev/null @@ -1,2 +0,0 @@ -au BufRead,BufNewFile /etc/nginx/* set ft=nginx -au BufRead,BufNewFile /usr/local/nginx/conf/* set ft=nginx diff --git a/bundle/nginx-vim/indent/nginx.vim b/bundle/nginx-vim/indent/nginx.vim deleted file mode 100755 index 51115e91..00000000 --- a/bundle/nginx-vim/indent/nginx.vim +++ /dev/null @@ -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# diff --git a/bundle/nginx-vim/syntax/nginx.vim b/bundle/nginx-vim/syntax/nginx.vim deleted file mode 100755 index ccd47680..00000000 --- a/bundle/nginx-vim/syntax/nginx.vim +++ /dev/null @@ -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 -" 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 -" 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 Basic Authentication using PAM. -syn keyword ngxDirectiveThirdParty auth_pam -syn keyword ngxDirectiveThirdParty auth_pam_service_name - -" Cache Purge Module -" 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 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 -" 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 -" 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 -" 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 -" Privides options for start/stop events. -syn keyword ngxDirectiveThirdParty on_start -syn keyword ngxDirectiveThirdParty on_stop - -" EY Balancer Module -" 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 -" 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) -" Country code lookups via the MaxMind GeoIP API. -syn keyword ngxDirectiveThirdParty geoip_country_file - -" Headers More Module -" 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 -" 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 > -" 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 -" 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 -" 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 -" 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 -" 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 -" 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 -" Serve static file to POST requests. -syn keyword ngxDirectiveThirdParty notice -syn keyword ngxDirectiveThirdParty notice_type - -" Phusion Passenger -" 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 -" 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 -" This module provides an HTTP interface to RRDtool's graphing facilities. -syn keyword ngxDirectiveThirdParty rrd_graph -syn keyword ngxDirectiveThirdParty rrd_graph_root - -" Secure Download -" 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 -" 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 -" Whitespace remover. -syn keyword ngxDirectiveThirdParty strip - -" Substitutions Module -" 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 -" 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 -" 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 -" 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 -" 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 -" Select backend based on Consistent hash ring. -syn keyword ngxDirectiveThirdParty consistent_hash - -" Upstream Hash Module -" Provides simple upstream load distribution by hashing a configurable variable. -syn keyword ngxDirectiveThirdParty hash -syn keyword ngxDirectiveThirdParty hash_again - -" XSS 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" diff --git a/bundle/nginx.vim/README b/bundle/nginx.vim/README deleted file mode 100644 index 91ceb224..00000000 --- a/bundle/nginx.vim/README +++ /dev/null @@ -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). diff --git a/bundle/nginx.vim/syntax/nginx.vim b/bundle/nginx.vim/syntax/nginx.vim deleted file mode 100644 index ccd47680..00000000 --- a/bundle/nginx.vim/syntax/nginx.vim +++ /dev/null @@ -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 -" 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 -" 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 Basic Authentication using PAM. -syn keyword ngxDirectiveThirdParty auth_pam -syn keyword ngxDirectiveThirdParty auth_pam_service_name - -" Cache Purge Module -" 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 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 -" 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 -" 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 -" 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 -" Privides options for start/stop events. -syn keyword ngxDirectiveThirdParty on_start -syn keyword ngxDirectiveThirdParty on_stop - -" EY Balancer Module -" 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 -" 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) -" Country code lookups via the MaxMind GeoIP API. -syn keyword ngxDirectiveThirdParty geoip_country_file - -" Headers More Module -" 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 -" 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 > -" 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 -" 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 -" 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 -" 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 -" 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 -" 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 -" Serve static file to POST requests. -syn keyword ngxDirectiveThirdParty notice -syn keyword ngxDirectiveThirdParty notice_type - -" Phusion Passenger -" 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 -" 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 -" This module provides an HTTP interface to RRDtool's graphing facilities. -syn keyword ngxDirectiveThirdParty rrd_graph -syn keyword ngxDirectiveThirdParty rrd_graph_root - -" Secure Download -" 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 -" 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 -" Whitespace remover. -syn keyword ngxDirectiveThirdParty strip - -" Substitutions Module -" 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 -" 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 -" 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 -" 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 -" 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 -" Select backend based on Consistent hash ring. -syn keyword ngxDirectiveThirdParty consistent_hash - -" Upstream Hash Module -" Provides simple upstream load distribution by hashing a configurable variable. -syn keyword ngxDirectiveThirdParty hash -syn keyword ngxDirectiveThirdParty hash_again - -" XSS 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" diff --git a/bundle/open_file_under_cursor.vim/plugin/open_file_under_cursor.vim b/bundle/open_file_under_cursor.vim/plugin/open_file_under_cursor.vim deleted file mode 100644 index 7d35c91d..00000000 --- a/bundle/open_file_under_cursor.vim/plugin/open_file_under_cursor.vim +++ /dev/null @@ -1,28 +0,0 @@ -" ----- Emulate 'gf' but recognize :line format ----- -function! GotoFile(w) - let curword = expand("") - 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("") -nnoremap f :call GotoFile("new") -nnoremap :call GotoFile("new") diff --git a/bundle/taglist.vim/README b/bundle/taglist.vim/README deleted file mode 100644 index 56bf86fb..00000000 --- a/bundle/taglist.vim/README +++ /dev/null @@ -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. diff --git a/bundle/taglist.vim/doc/taglist.txt b/bundle/taglist.vim/doc/taglist.txt deleted file mode 100644 index 6a62b396..00000000 --- a/bundle/taglist.vim/doc/taglist.txt +++ /dev/null @@ -1,1501 +0,0 @@ -*taglist.txt* Plugin for browsing source code - -Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com) -For Vim version 6.0 and above -Last change: 2007 May 24 - -1. Overview |taglist-intro| -2. Taglist on the internet |taglist-internet| -3. Requirements |taglist-requirements| -4. Installation |taglist-install| -5. Usage |taglist-using| -6. Options |taglist-options| -7. Commands |taglist-commands| -8. Global functions |taglist-functions| -9. Extending |taglist-extend| -10. FAQ |taglist-faq| -11. License |taglist-license| -12. Todo |taglist-todo| - -============================================================================== - *taglist-intro* -1. Overview~ - -The "Tag List" plugin is a source code browser plugin for Vim. This plugin -allows you to efficiently browse through source code files for different -programming languages. The "Tag List" plugin provides the following features: - - * Displays the tags (functions, classes, structures, variables, etc.) - defined in a file in a vertically or horizontally split Vim window. - * In GUI Vim, optionally displays the tags in the Tags drop-down menu and - in the popup menu. - * Automatically updates the taglist window as you switch between - files/buffers. As you open new files, the tags defined in the new files - are added to the existing file list and the tags defined in all the - files are displayed grouped by the filename. - * When a tag name is selected from the taglist window, positions the - cursor at the definition of the tag in the source file. - * Automatically highlights the current tag name. - * Groups the tags by their type and displays them in a foldable tree. - * Can display the prototype and scope of a tag. - * Can optionally display the tag prototype instead of the tag name in the - taglist window. - * The tag list can be sorted either by name or by chronological order. - * Supports the following language files: Assembly, ASP, Awk, Beta, C, - C++, C#, Cobol, Eiffel, Erlang, Fortran, HTML, Java, Javascript, Lisp, - Lua, Make, Pascal, Perl, PHP, Python, Rexx, Ruby, Scheme, Shell, Slang, - SML, Sql, TCL, Verilog, Vim and Yacc. - * Can be easily extended to support new languages. Support for - existing languages can be modified easily. - * Provides functions to display the current tag name in the Vim status - line or the window title bar. - * The list of tags and files in the taglist can be saved and - restored across Vim sessions. - * Provides commands to get the name and prototype of the current tag. - * Runs in both console/terminal and GUI versions of Vim. - * Works with the winmanager plugin. Using the winmanager plugin, you - can use Vim plugins like the file explorer, buffer explorer and the - taglist plugin at the same time like an IDE. - * Can be used in both Unix and MS-Windows systems. - -============================================================================== - *taglist-internet* -2. Taglist on the internet~ - -The home page of the taglist plugin is at: -> - http://vim-taglist.sourceforge.net/ -< -You can subscribe to the taglist mailing list to post your questions or -suggestions for improvement or to send bug reports. Visit the following page -for subscribing to the mailing list: -> - http://groups.yahoo.com/group/taglist -< -============================================================================== - *taglist-requirements* -3. Requirements~ - -The taglist plugin requires the following: - - * Vim version 6.0 and above - * Exuberant ctags 5.0 and above - -The taglist plugin will work on all the platforms where the exuberant ctags -utility and Vim are supported (this includes MS-Windows and Unix based -systems). - -The taglist plugin relies on the exuberant ctags utility to dynamically -generate the tag listing. The exuberant ctags utility must be installed in -your system to use this plugin. The exuberant ctags utility is shipped with -most of the Linux distributions. You can download the exuberant ctags utility -from -> - http://ctags.sourceforge.net -< -The taglist plugin doesn't use or create a tags file and there is no need to -create a tags file to use this plugin. The taglist plugin will not work with -the GNU ctags or the Unix ctags utility. - -This plugin relies on the Vim "filetype" detection mechanism to determine the -type of the current file. You have to turn on the Vim filetype detection by -adding the following line to your .vimrc file: -> - filetype on -< -The taglist plugin will not work if you run Vim in the restricted mode (using -the -Z command-line argument). - -The taglist plugin uses the Vim system() function to invoke the exuberant -ctags utility. If Vim is compiled without the system() function then you -cannot use the taglist plugin. Some of the Linux distributions (Suse) compile -Vim without the system() function for security reasons. - -============================================================================== - *taglist-install* -4. Installation~ - -1. Download the taglist.zip file and unzip the files to the $HOME/.vim or the - $HOME/vimfiles or the $VIM/vimfiles directory. After this step, you should - have the following two files (the directory structure should be preserved): - - plugin/taglist.vim - main taglist plugin file - doc/taglist.txt - documentation (help) file - - Refer to the |add-plugin|and |'runtimepath'| Vim help pages for more - details about installing Vim plugins. -2. Change to the $HOME/.vim/doc or $HOME/vimfiles/doc or $VIM/vimfiles/doc - directory, start Vim and run the ":helptags ." command to process the - taglist help file. Without this step, you cannot jump to the taglist help - topics. -3. If the exuberant ctags utility is not present in one of the directories in - the PATH environment variable, then set the 'Tlist_Ctags_Cmd' variable to - point to the location of the exuberant ctags utility (not to the directory) - in the .vimrc file. -4. If you are running a terminal/console version of Vim and the terminal - doesn't support changing the window width then set the - 'Tlist_Inc_Winwidth' variable to 0 in the .vimrc file. -5. Restart Vim. -6. You can now use the ":TlistToggle" command to open/close the taglist - window. You can use the ":help taglist" command to get more information - about using the taglist plugin. - -To uninstall the taglist plugin, remove the plugin/taglist.vim and -doc/taglist.txt files from the $HOME/.vim or $HOME/vimfiles directory. - -============================================================================== - *taglist-using* -5. Usage~ - -The taglist plugin can be used in several different ways. - -1. You can keep the taglist window open during the entire editing session. On - opening the taglist window, the tags defined in all the files in the Vim - buffer list will be displayed in the taglist window. As you edit files, the - tags defined in them will be added to the taglist window. You can select a - tag from the taglist window and jump to it. The current tag will be - highlighted in the taglist window. You can close the taglist window when - you no longer need the window. -2. You can configure the taglist plugin to process the tags defined in all the - edited files always. In this configuration, even if the taglist window is - closed and the taglist menu is not displayed, the taglist plugin will - processes the tags defined in newly edited files. You can then open the - taglist window only when you need to select a tag and then automatically - close the taglist window after selecting the tag. -3. You can configure the taglist plugin to display only the tags defined in - the current file in the taglist window. By default, the taglist plugin - displays the tags defined in all the files in the Vim buffer list. As you - switch between files, the taglist window will be refreshed to display only - the tags defined in the current file. -4. In GUI Vim, you can use the Tags pull-down and popup menu created by the - taglist plugin to display the tags defined in the current file and select a - tag to jump to it. You can use the menu without opening the taglist window. - By default, the Tags menu is disabled. -5. You can configure the taglist plugin to display the name of the current tag - in the Vim window status line or in the Vim window title bar. For this to - work without the taglist window or menu, you need to configure the taglist - plugin to process the tags defined in a file always. -6. You can save the tags defined in multiple files to a taglist session file - and load it when needed. You can also configure the taglist plugin to not - update the taglist window when editing new files. You can then manually add - files to the taglist window. - -Opening the taglist window~ -You can open the taglist window using the ":TlistOpen" or the ":TlistToggle" -commands. The ":TlistOpen" command opens the taglist window and jumps to it. -The ":TlistToggle" command opens or closes (toggle) the taglist window and the -cursor remains in the current window. If the 'Tlist_GainFocus_On_ToggleOpen' -variable is set to 1, then the ":TlistToggle" command opens the taglist window -and moves the cursor to the taglist window. - -You can map a key to invoke these commands. For example, the following command -creates a normal mode mapping for the key to toggle the taglist window. -> - nnoremap :TlistToggle -< -Add the above mapping to your ~/.vimrc or $HOME/_vimrc file. - -To automatically open the taglist window on Vim startup, set the -'Tlist_Auto_Open' variable to 1. - -You can also open the taglist window on startup using the following command -line: -> - $ vim +TlistOpen -< -Closing the taglist window~ -You can close the taglist window from the taglist window by pressing 'q' or -using the Vim ":q" command. You can also use any of the Vim window commands to -close the taglist window. Invoking the ":TlistToggle" command when the taglist -window is opened, closes the taglist window. You can also use the -":TlistClose" command to close the taglist window. - -To automatically close the taglist window when a tag or file is selected, you -can set the 'Tlist_Close_On_Select' variable to 1. To exit Vim when only the -taglist window is present, set the 'Tlist_Exit_OnlyWindow' variable to 1. - -Jumping to a tag or a file~ -You can select a tag in the taglist window either by pressing the key -or by double clicking the tag name using the mouse. To jump to a tag on a -single mouse click set the 'Tlist_Use_SingleClick' variable to 1. - -If the selected file is already opened in a window, then the cursor is moved -to that window. If the file is not currently opened in a window then the file -is opened in the window used by the taglist plugin to show the previously -selected file. If there are no usable windows, then the file is opened in a -new window. The file is not opened in special windows like the quickfix -window, preview window and windows containing buffer with the 'buftype' option -set. - -To jump to the tag in a new window, press the 'o' key. To open the file in the -previous window (Ctrl-W_p) use the 'P' key. You can press the 'p' key to jump -to the tag but still keep the cursor in the taglist window (preview). - -To open the selected file in a tab, use the 't' key. If the file is already -present in a tab then the cursor is moved to that tab otherwise the file is -opened in a new tab. To jump to a tag in a new tab press Ctrl-t. The taglist -window is automatically opened in the newly created tab. - -Instead of jumping to a tag, you can open a file by pressing the key -or by double clicking the file name using the mouse. - -In the taglist window, you can use the [[ or key to jump to the -beginning of the previous file. You can use the ]] or key to jump to the -beginning of the next file. When you reach the first or last file, the search -wraps around and the jumps to the next/previous file. - -Highlighting the current tag~ -The taglist plugin automatically highlights the name of the current tag in the -taglist window. The Vim |CursorHold| autocmd event is used for this. If the -current tag name is not visible in the taglist window, then the taglist window -contents are scrolled to make that tag name visible. You can also use the -":TlistHighlightTag" command to force the highlighting of the current tag. - -The tag name is highlighted if no activity is performed for |'updatetime'| -milliseconds. The default value for this Vim option is 4 seconds. To avoid -unexpected problems, you should not set the |'updatetime'| option to a very -low value. - -To disable the automatic highlighting of the current tag name in the taglist -window, set the 'Tlist_Auto_Highlight_Tag' variable to zero. - -When entering a Vim buffer/window, the taglist plugin automatically highlights -the current tag in that buffer/window. If you like to disable the automatic -highlighting of the current tag when entering a buffer, set the -'Tlist_Highlight_Tag_On_BufEnter' variable to zero. - -Adding files to the taglist~ -When the taglist window is opened, all the files in the Vim buffer list are -processed and the supported files are added to the taglist. When you edit a -file in Vim, the taglist plugin automatically processes this file and adds it -to the taglist. If you close the taglist window, the tag information in the -taglist is retained. - -To process files even when the taglist window is not open, set the -'Tlist_Process_File_Always' variable to 1. - -You can manually add multiple files to the taglist without opening them using -the ":TlistAddFiles" and the ":TlistAddFilesRecursive" commands. - -For example, to add all the C files in the /my/project/dir directory to the -taglist, you can use the following command: -> - :TlistAddFiles /my/project/dir/*.c -< -Note that when adding several files with a large number of tags or a large -number of files, it will take several seconds to several minutes for the -taglist plugin to process all the files. You should not interrupt the taglist -plugin by pressing . - -You can recursively add multiple files from a directory tree using the -":TlistAddFilesRecursive" command: -> - :TlistAddFilesRecursive /my/project/dir *.c -< -This command takes two arguments. The first argument specifies the directory -from which to recursively add the files. The second optional argument -specifies the wildcard matching pattern for selecting the files to add. The -default pattern is * and all the files are added. - -Displaying tags for only one file~ -The taglist window displays the tags for all the files in the Vim buffer list -and all the manually added files. To display the tags for only the current -active buffer, set the 'Tlist_Show_One_File' variable to 1. - -Removing files from the taglist~ -You can remove a file from the taglist window, by pressing the 'd' key when the -cursor is on one of the tags listed for the file in the taglist window. The -removed file will no longer be displayed in the taglist window in the current -Vim session. To again display the tags for the file, open the file in a Vim -window and then use the ":TlistUpdate" command or use ":TlistAddFiles" command -to add the file to the taglist. - -When a buffer is removed from the Vim buffer list using the ":bdelete" or the -":bwipeout" command, the taglist is updated to remove the stored information -for this buffer. - -Updating the tags displayed for a file~ -The taglist plugin keeps track of the modification time of a file. When the -modification time changes (the file is modified), the taglist plugin -automatically updates the tags listed for that file. The modification time of -a file is checked when you enter a window containing that file or when you -load that file. - -You can also update or refresh the tags displayed for a file by pressing the -"u" key in the taglist window. If an existing file is modified, after the file -is saved, the taglist plugin automatically updates the tags displayed for the -file. - -You can also use the ":TlistUpdate" command to update the tags for the current -buffer after you made some changes to it. You should save the modified buffer -before you update the taglist window. Otherwise the listed tags will not -include the new tags created in the buffer. - -If you have deleted the tags displayed for a file in the taglist window using -the 'd' key, you can again display the tags for that file using the -":TlistUpdate" command. - -Controlling the taglist updates~ -To disable the automatic processing of new files or modified files, you can -set the 'Tlist_Auto_Update' variable to zero. When this variable is set to -zero, the taglist is updated only when you use the ":TlistUpdate" command or -the ":TlistAddFiles" or the ":TlistAddFilesRecursive" commands. You can use -this option to control which files are added to the taglist. - -You can use the ":TlistLock" command to lock the taglist contents. After this -command is executed, new files are not automatically added to the taglist. -When the taglist is locked, you can use the ":TlistUpdate" command to add the -current file or the ":TlistAddFiles" or ":TlistAddFilesRecursive" commands to -add new files to the taglist. To unlock the taglist, use the ":TlistUnlock" -command. - -Displaying the tag prototype~ -To display the prototype of the tag under the cursor in the taglist window, -press the space bar. If you place the cursor on a tag name in the taglist -window, then the tag prototype is displayed at the Vim status line after -|'updatetime'| milliseconds. The default value for the |'updatetime'| Vim -option is 4 seconds. - -You can get the name and prototype of a tag without opening the taglist window -and the taglist menu using the ":TlistShowTag" and the ":TlistShowPrototype" -commands. These commands will work only if the current file is already present -in the taglist. To use these commands without opening the taglist window, set -the 'Tlist_Process_File_Always' variable to 1. - -You can use the ":TlistShowTag" command to display the name of the tag at or -before the specified line number in the specified file. If the file name and -line number are not supplied, then this command will display the name of the -current tag. For example, -> - :TlistShowTag - :TlistShowTag myfile.java 100 -< -You can use the ":TlistShowPrototype" command to display the prototype of the -tag at or before the specified line number in the specified file. If the file -name and the line number are not supplied, then this command will display the -prototype of the current tag. For example, -> - :TlistShowPrototype - :TlistShowPrototype myfile.c 50 -< -In the taglist window, when the mouse is moved over a tag name, the tag -prototype is displayed in a balloon. This works only in GUI versions where -balloon evaluation is supported. - -Taglist window contents~ -The taglist window contains the tags defined in various files in the taglist -grouped by the filename and by the tag type (variable, function, class, etc.). -For tags with scope information (like class members, structures inside -structures, etc.), the scope information is displayed in square brackets "[]" -after the tag name. - -The contents of the taglist buffer/window are managed by the taglist plugin. -The |'filetype'| for the taglist buffer is set to 'taglist'. The Vim -|'modifiable'| option is turned off for the taglist buffer. You should not -manually edit the taglist buffer, by setting the |'modifiable'| flag. If you -manually edit the taglist buffer contents, then the taglist plugin will be out -of sync with the taglist buffer contents and the plugin will no longer work -correctly. To redisplay the taglist buffer contents again, close the taglist -window and reopen it. - -Opening and closing the tag and file tree~ -In the taglist window, the tag names are displayed as a foldable tree using -the Vim folding support. You can collapse the tree using the '-' key or using -the Vim |zc| fold command. You can open the tree using the '+' key or using -the Vim |zo| fold command. You can open all the folds using the '*' key or -using the Vim |zR| fold command. You can also use the mouse to open/close the -folds. You can close all the folds using the '=' key. You should not manually -create or delete the folds in the taglist window. - -To automatically close the fold for the inactive files/buffers and open only -the fold for the current buffer in the taglist window, set the -'Tlist_File_Fold_Auto_Close' variable to 1. - -Sorting the tags for a file~ -The tags displayed in the taglist window can be sorted either by their name or -by their chronological order. The default sorting method is by the order in -which the tags appear in a file. You can change the default sort method by -setting the 'Tlist_Sort_Type' variable to either "name" or "order". You can -sort the tags by their name by pressing the "s" key in the taglist window. You -can again sort the tags by their chronological order using the "s" key. Each -file in the taglist window can be sorted using different order. - -Zooming in and out of the taglist window~ -You can press the 'x' key in the taglist window to maximize the taglist -window width/height. The window will be maximized to the maximum possible -width/height without closing the other existing windows. You can again press -'x' to restore the taglist window to the default width/height. - - *taglist-session* -Taglist Session~ -A taglist session refers to the group of files and their tags stored in the -taglist in a Vim session. - -You can save and restore a taglist session (and all the displayed tags) using -the ":TlistSessionSave" and ":TlistSessionLoad" commands. - -To save the information about the tags and files in the taglist to a file, use -the ":TlistSessionSave" command and specify the filename: -> - :TlistSessionSave -< -To load a saved taglist session, use the ":TlistSessionLoad" command: > - - :TlistSessionLoad -< -When you load a taglist session file, the tags stored in the file will be -added to the tags already stored in the taglist. - -The taglist session feature can be used to save the tags for large files or a -group of frequently used files (like a project). By using the taglist session -file, you can minimize the amount to time it takes to load/refresh the taglist -for multiple files. - -You can create more than one taglist session file for multiple groups of -files. - -Displaying the tag name in the Vim status line or the window title bar~ -You can use the Tlist_Get_Tagname_By_Line() function provided by the taglist -plugin to display the current tag name in the Vim status line or the window -title bar. Similarly, you can use the Tlist_Get_Tag_Prototype_By_Line() -function to display the current tag prototype in the Vim status line or the -window title bar. - -For example, the following command can be used to display the current tag name -in the status line: -> - :set statusline=%<%f%=%([%{Tlist_Get_Tagname_By_Line()}]%) -< -The following command can be used to display the current tag name in the -window title bar: -> - :set title titlestring=%<%f\ %([%{Tlist_Get_Tagname_By_Line()}]%) -< -Note that the current tag name can be displayed only after the file is -processed by the taglist plugin. For this, you have to either set the -'Tlist_Process_File_Always' variable to 1 or open the taglist window or use -the taglist menu. For more information about configuring the Vim status line, -refer to the documentation for the Vim |'statusline'| option. - -Changing the taglist window highlighting~ -The following Vim highlight groups are defined and used to highlight the -various entities in the taglist window: - - TagListTagName - Used for tag names - TagListTagScope - Used for tag scope - TagListTitle - Used for tag titles - TagListComment - Used for comments - TagListFileName - Used for filenames - -By default, these highlight groups are linked to the standard Vim highlight -groups. If you want to change the colors used for these highlight groups, -prefix the highlight group name with 'My' and define it in your .vimrc or -.gvimrc file: MyTagListTagName, MyTagListTagScope, MyTagListTitle, -MyTagListComment and MyTagListFileName. For example, to change the colors -used for tag names, you can use the following command: -> - :highlight MyTagListTagName guifg=blue ctermfg=blue -< -Controlling the taglist window~ -To use a horizontally split taglist window, instead of a vertically split -window, set the 'Tlist_Use_Horiz_Window' variable to 1. - -To use a vertically split taglist window on the rightmost side of the Vim -window, set the 'Tlist_Use_Right_Window' variable to 1. - -You can specify the width of the vertically split taglist window, by setting -the 'Tlist_WinWidth' variable. You can specify the height of the horizontally -split taglist window, by setting the 'Tlist_WinHeight' variable. - -When opening a vertically split taglist window, the Vim window width is -increased to accommodate the new taglist window. When the taglist window is -closed, the Vim window is reduced. To disable this, set the -'Tlist_Inc_Winwidth' variable to zero. - -To reduce the number of empty lines in the taglist window, set the -'Tlist_Compact_Format' variable to 1. - -To not display the Vim fold column in the taglist window, set the -'Tlist_Enable_Fold_Column' variable to zero. - -To display the tag prototypes instead of the tag names in the taglist window, -set the 'Tlist_Display_Prototype' variable to 1. - -To not display the scope of the tags next to the tag names, set the -'Tlist_Display_Tag_Scope' variable to zero. - - *taglist-keys* -Taglist window key list~ -The following table lists the description of the keys that can be used -in the taglist window. - - Key Description~ - - Jump to the location where the tag under cursor is - defined. - o Jump to the location where the tag under cursor is - defined in a new window. - P Jump to the tag in the previous (Ctrl-W_p) window. - p Display the tag definition in the file window and - keep the cursor in the taglist window itself. - t Jump to the tag in a new tab. If the file is already - opened in a tab, move to that tab. - Ctrl-t Jump to the tag in a new tab. - Display the prototype of the tag under the cursor. - For file names, display the full path to the file, - file type and the number of tags. For tag types, display the - tag type and the number of tags. - u Update the tags listed in the taglist window - s Change the sort order of the tags (by name or by order) - d Remove the tags for the file under the cursor - x Zoom-in or Zoom-out the taglist window - + Open a fold - - Close a fold - * Open all folds - = Close all folds - [[ Jump to the beginning of the previous file - Jump to the beginning of the previous file - ]] Jump to the beginning of the next file - Jump to the beginning of the next file - q Close the taglist window - Display help - -The above keys will work in both the normal mode and the insert mode. - - *taglist-menu* -Taglist menu~ -When using GUI Vim, the taglist plugin can display the tags defined in the -current file in the drop-down menu and the popup menu. By default, this -feature is turned off. To turn on this feature, set the 'Tlist_Show_Menu' -variable to 1. - -You can jump to a tag by selecting the tag name from the menu. You can use the -taglist menu independent of the taglist window i.e. you don't need to open the -taglist window to get the taglist menu. - -When you switch between files/buffers, the taglist menu is automatically -updated to display the tags defined in the current file/buffer. - -The tags are grouped by their type (variables, functions, classes, methods, -etc.) and displayed as a separate sub-menu for each type. If all the tags -defined in a file are of the same type (e.g. functions), then the sub-menu is -not used. - -If the number of items in a tag type submenu exceeds the value specified by -the 'Tlist_Max_Submenu_Items' variable, then the submenu will be split into -multiple submenus. The default setting for 'Tlist_Max_Submenu_Items' is 25. -The first and last tag names in the submenu are used to form the submenu name. -The menu items are prefixed by alpha-numeric characters for easy selection by -keyboard. - -If the popup menu support is enabled (the |'mousemodel'| option contains -"popup"), then the tags menu is added to the popup menu. You can access -the popup menu by right clicking on the GUI window. - -You can regenerate the tags menu by selecting the 'Tags->Refresh menu' entry. -You can sort the tags listed in the menu either by name or by order by -selecting the 'Tags->Sort menu by->Name/Order' menu entry. - -You can tear-off the Tags menu and keep it on the side of the Vim window -for quickly locating the tags. - -Using the taglist plugin with the winmanager plugin~ -You can use the taglist plugin with the winmanager plugin. This will allow you -to use the file explorer, buffer explorer and the taglist plugin at the same -time in different windows. To use the taglist plugin with the winmanager -plugin, set 'TagList' in the 'winManagerWindowLayout' variable. For example, -to use the file explorer plugin and the taglist plugin at the same time, use -the following setting: > - - let winManagerWindowLayout = 'FileExplorer|TagList' -< -Getting help~ -If you have installed the taglist help file (this file), then you can use the -Vim ":help taglist-" command to get help on the various taglist -topics. - -You can press the key in the taglist window to display the help -information about using the taglist window. If you again press the key, -the help information is removed from the taglist window. - - *taglist-debug* -Debugging the taglist plugin~ -You can use the ":TlistDebug" command to enable logging of the debug messages -from the taglist plugin. To display the logged debug messages, you can use the -":TlistMessages" command. To disable the logging of the debug messages, use -the ":TlistUndebug" command. - -You can specify a file name to the ":TlistDebug" command to log the debug -messages to a file. Otherwise, the debug messages are stored in a script-local -variable. In the later case, to minimize memory usage, only the last 3000 -characters from the debug messages are stored. - -============================================================================== - *taglist-options* -6. Options~ - -A number of Vim variables control the behavior of the taglist plugin. These -variables are initialized to a default value. By changing these variables you -can change the behavior of the taglist plugin. You need to change these -settings only if you want to change the behavior of the taglist plugin. You -should use the |:let| command in your .vimrc file to change the setting of any -of these variables. - -The configurable taglist variables are listed below. For a detailed -description of these variables refer to the text below this table. - -|'Tlist_Auto_Highlight_Tag'| Automatically highlight the current tag in the - taglist. -|'Tlist_Auto_Open'| Open the taglist window when Vim starts. -|'Tlist_Auto_Update'| Automatically update the taglist to include - newly edited files. -|'Tlist_Close_On_Select'| Close the taglist window when a file or tag is - selected. -|'Tlist_Compact_Format'| Remove extra information and blank lines from - the taglist window. -|'Tlist_Ctags_Cmd'| Specifies the path to the ctags utility. -|'Tlist_Display_Prototype'| Show prototypes and not tags in the taglist - window. -|'Tlist_Display_Tag_Scope'| Show tag scope next to the tag name. -|'Tlist_Enable_Fold_Column'| Show the fold indicator column in the taglist - window. -|'Tlist_Exit_OnlyWindow'| Close Vim if the taglist is the only window. -|'Tlist_File_Fold_Auto_Close'| Close tag folds for inactive buffers. -|'Tlist_GainFocus_On_ToggleOpen'| - Jump to taglist window on open. -|'Tlist_Highlight_Tag_On_BufEnter'| - On entering a buffer, automatically highlight - the current tag. -|'Tlist_Inc_Winwidth'| Increase the Vim window width to accommodate - the taglist window. -|'Tlist_Max_Submenu_Items'| Maximum number of items in a tags sub-menu. -|'Tlist_Max_Tag_Length'| Maximum tag length used in a tag menu entry. -|'Tlist_Process_File_Always'| Process files even when the taglist window is - closed. -|'Tlist_Show_Menu'| Display the tags menu. -|'Tlist_Show_One_File'| Show tags for the current buffer only. -|'Tlist_Sort_Type'| Sort method used for arranging the tags. -|'Tlist_Use_Horiz_Window'| Use a horizontally split window for the - taglist window. -|'Tlist_Use_Right_Window'| Place the taglist window on the right side. -|'Tlist_Use_SingleClick'| Single click on a tag jumps to it. -|'Tlist_WinHeight'| Horizontally split taglist window height. -|'Tlist_WinWidth'| Vertically split taglist window width. - - *'Tlist_Auto_Highlight_Tag'* -Tlist_Auto_Highlight_Tag~ -The taglist plugin will automatically highlight the current tag in the taglist -window. If you want to disable this, then you can set the -'Tlist_Auto_Highlight_Tag' variable to zero. Note that even though the current -tag highlighting is disabled, the tags for a new file will still be added to -the taglist window. -> - let Tlist_Auto_Highlight_Tag = 0 -< -With the above variable set to 1, you can use the ":TlistHighlightTag" command -to highlight the current tag. - - *'Tlist_Auto_Open'* -Tlist_Auto_Open~ -To automatically open the taglist window, when you start Vim, you can set the -'Tlist_Auto_Open' variable to 1. By default, this variable is set to zero and -the taglist window will not be opened automatically on Vim startup. -> - let Tlist_Auto_Open = 1 -< -The taglist window is opened only when a supported type of file is opened on -Vim startup. For example, if you open text files, then the taglist window will -not be opened. - - *'Tlist_Auto_Update'* -Tlist_Auto_Update~ -When a new file is edited, the tags defined in the file are automatically -processed and added to the taglist. To stop adding new files to the taglist, -set the 'Tlist_Auto_Update' variable to zero. By default, this variable is set -to 1. -> - let Tlist_Auto_Update = 0 -< -With the above variable set to 1, you can use the ":TlistUpdate" command to -add the tags defined in the current file to the taglist. - - *'Tlist_Close_On_Select'* -Tlist_Close_On_Select~ -If you want to close the taglist window when a file or tag is selected, then -set the 'Tlist_Close_On_Select' variable to 1. By default, this variable is -set zero and when you select a tag or file from the taglist window, the window -is not closed. -> - let Tlist_Close_On_Select = 1 -< - *'Tlist_Compact_Format'* -Tlist_Compact_Format~ -By default, empty lines are used to separate different tag types displayed for -a file and the tags displayed for different files in the taglist window. If -you want to display as many tags as possible in the taglist window, you can -set the 'Tlist_Compact_Format' variable to 1 to get a compact display. -> - let Tlist_Compact_Format = 1 -< - *'Tlist_Ctags_Cmd'* -Tlist_Ctags_Cmd~ -The 'Tlist_Ctags_Cmd' variable specifies the location (path) of the exuberant -ctags utility. If exuberant ctags is present in any one of the directories in -the PATH environment variable, then there is no need to set this variable. - -The exuberant ctags tool can be installed under different names. When the -taglist plugin starts up, if the 'Tlist_Ctags_Cmd' variable is not set, it -checks for the names exuberant-ctags, exctags, ctags, ctags.exe and tags in -the PATH environment variable. If any one of the named executable is found, -then the Tlist_Ctags_Cmd variable is set to that name. - -If exuberant ctags is not present in one of the directories specified in the -PATH environment variable, then set this variable to point to the location of -the ctags utility in your system. Note that this variable should point to the -fully qualified exuberant ctags location and NOT to the directory in which -exuberant ctags is installed. If the exuberant ctags tool is not found in -either PATH or in the specified location, then the taglist plugin will not be -loaded. Examples: -> - let Tlist_Ctags_Cmd = 'd:\tools\ctags.exe' - let Tlist_Ctags_Cmd = '/usr/local/bin/ctags' -< - *'Tlist_Display_Prototype'* -Tlist_Display_Prototype~ -By default, only the tag name will be displayed in the taglist window. If you -like to see tag prototypes instead of names, set the 'Tlist_Display_Prototype' -variable to 1. By default, this variable is set to zero and only tag names -will be displayed. -> - let Tlist_Display_Prototype = 1 -< - *'Tlist_Display_Tag_Scope'* -Tlist_Display_Tag_Scope~ -By default, the scope of a tag (like a C++ class) will be displayed in -square brackets next to the tag name. If you don't want the tag scopes -to be displayed, then set the 'Tlist_Display_Tag_Scope' to zero. By default, -this variable is set to 1 and the tag scopes will be displayed. -> - let Tlist_Display_Tag_Scope = 0 -< - *'Tlist_Enable_Fold_Column'* -Tlist_Enable_Fold_Column~ -By default, the Vim fold column is enabled and displayed in the taglist -window. If you wish to disable this (for example, when you are working with a -narrow Vim window or terminal), you can set the 'Tlist_Enable_Fold_Column' -variable to zero. -> - let Tlist_Enable_Fold_Column = 1 -< - *'Tlist_Exit_OnlyWindow'* -Tlist_Exit_OnlyWindow~ -If you want to exit Vim if only the taglist window is currently opened, then -set the 'Tlist_Exit_OnlyWindow' variable to 1. By default, this variable is -set to zero and the Vim instance will not be closed if only the taglist window -is present. -> - let Tlist_Exit_OnlyWindow = 1 -< - *'Tlist_File_Fold_Auto_Close'* -Tlist_File_Fold_Auto_Close~ -By default, the tags tree displayed in the taglist window for all the files is -opened. You can close/fold the tags tree for the files manually. To -automatically close the tags tree for inactive files, you can set the -'Tlist_File_Fold_Auto_Close' variable to 1. When this variable is set to 1, -the tags tree for the current buffer is automatically opened and for all the -other buffers is closed. -> - let Tlist_File_Fold_Auto_Close = 1 -< - *'Tlist_GainFocus_On_ToggleOpen'* -Tlist_GainFocus_On_ToggleOpen~ -When the taglist window is opened using the ':TlistToggle' command, this -option controls whether the cursor is moved to the taglist window or remains -in the current window. By default, this option is set to 0 and the cursor -remains in the current window. When this variable is set to 1, the cursor -moves to the taglist window after opening the taglist window. -> - let Tlist_GainFocus_On_ToggleOpen = 1 -< - *'Tlist_Highlight_Tag_On_BufEnter'* -Tlist_Highlight_Tag_On_BufEnter~ -When you enter a Vim buffer/window, the current tag in that buffer/window is -automatically highlighted in the taglist window. If the current tag name is -not visible in the taglist window, then the taglist window contents are -scrolled to make that tag name visible. If you like to disable the automatic -highlighting of the current tag when entering a buffer, you can set the -'Tlist_Highlight_Tag_On_BufEnter' variable to zero. The default setting for -this variable is 1. -> - let Tlist_Highlight_Tag_On_BufEnter = 0 -< - *'Tlist_Inc_Winwidth'* -Tlist_Inc_Winwidth~ -By default, when the width of the window is less than 100 and a new taglist -window is opened vertically, then the window width is increased by the value -set in the 'Tlist_WinWidth' variable to accommodate the new window. The value -of this variable is used only if you are using a vertically split taglist -window. - -If your terminal doesn't support changing the window width from Vim (older -version of xterm running in a Unix system) or if you see any weird problems in -the screen due to the change in the window width or if you prefer not to -adjust the window width then set the 'Tlist_Inc_Winwidth' variable to zero. -CAUTION: If you are using the MS-Windows version of Vim in a MS-DOS command -window then you must set this variable to zero, otherwise the system may hang -due to a Vim limitation (explained in :help win32-problems) -> - let Tlist_Inc_Winwidth = 0 -< - *'Tlist_Max_Submenu_Items'* -Tlist_Max_Submenu_Items~ -If a file contains too many tags of a particular type (function, variable, -class, etc.), greater than that specified by the 'Tlist_Max_Submenu_Items' -variable, then the menu for that tag type will be split into multiple -sub-menus. The default setting for the 'Tlist_Max_Submenu_Items' variable is -25. This can be changed by setting the 'Tlist_Max_Submenu_Items' variable: -> - let Tlist_Max_Submenu_Items = 20 -< -The name of the submenu is formed using the names of the first and the last -tag entries in that submenu. - - *'Tlist_Max_Tag_Length'* -Tlist_Max_Tag_Length~ -Only the first 'Tlist_Max_Tag_Length' characters from the tag names will be -used to form the tag type submenu name. The default value for this variable is -10. Change the 'Tlist_Max_Tag_Length' setting if you want to include more or -less characters: -> - let Tlist_Max_Tag_Length = 10 -< - *'Tlist_Process_File_Always'* -Tlist_Process_File_Always~ -By default, the taglist plugin will generate and process the tags defined in -the newly opened files only when the taglist window is opened or when the -taglist menu is enabled. When the taglist window is closed, the taglist plugin -will stop processing the tags for newly opened files. - -You can set the 'Tlist_Process_File_Always' variable to 1 to generate the list -of tags for new files even when the taglist window is closed and the taglist -menu is disabled. -> - let Tlist_Process_File_Always = 1 -< -To use the ":TlistShowTag" and the ":TlistShowPrototype" commands without the -taglist window and the taglist menu, you should set this variable to 1. - - *'Tlist_Show_Menu'* -Tlist_Show_Menu~ -When using GUI Vim, you can display the tags defined in the current file in a -menu named "Tags". By default, this feature is turned off. To turn on this -feature, set the 'Tlist_Show_Menu' variable to 1: -> - let Tlist_Show_Menu = 1 -< - *'Tlist_Show_One_File'* -Tlist_Show_One_File~ -By default, the taglist plugin will display the tags defined in all the loaded -buffers in the taglist window. If you prefer to display the tags defined only -in the current buffer, then you can set the 'Tlist_Show_One_File' to 1. When -this variable is set to 1, as you switch between buffers, the taglist window -will be refreshed to display the tags for the current buffer and the tags for -the previous buffer will be removed. -> - let Tlist_Show_One_File = 1 -< - *'Tlist_Sort_Type'* -Tlist_Sort_Type~ -The 'Tlist_Sort_Type' variable specifies the sort order for the tags in the -taglist window. The tags can be sorted either alphabetically by their name or -by the order of their appearance in the file (chronological order). By -default, the tag names will be listed by the order in which they are defined -in the file. You can change the sort type (from name to order or from order to -name) by pressing the "s" key in the taglist window. You can also change the -default sort order by setting 'Tlist_Sort_Type' to "name" or "order": -> - let Tlist_Sort_Type = "name" -< - *'Tlist_Use_Horiz_Window'* -Tlist_Use_Horiz_Window~ -Be default, the tag names are displayed in a vertically split window. If you -prefer a horizontally split window, then set the 'Tlist_Use_Horiz_Window' -variable to 1. If you are running MS-Windows version of Vim in a MS-DOS -command window, then you should use a horizontally split window instead of a -vertically split window. Also, if you are using an older version of xterm in a -Unix system that doesn't support changing the xterm window width, you should -use a horizontally split window. -> - let Tlist_Use_Horiz_Window = 1 -< - *'Tlist_Use_Right_Window'* -Tlist_Use_Right_Window~ -By default, the vertically split taglist window will appear on the left hand -side. If you prefer to open the window on the right hand side, you can set the -'Tlist_Use_Right_Window' variable to 1: -> - let Tlist_Use_Right_Window = 1 -< - *'Tlist_Use_SingleClick'* -Tlist_Use_SingleClick~ -By default, when you double click on the tag name using the left mouse -button, the cursor will be positioned at the definition of the tag. You -can set the 'Tlist_Use_SingleClick' variable to 1 to jump to a tag when -you single click on the tag name using the mouse. By default this variable -is set to zero. -> - let Tlist_Use_SingleClick = 1 -< -Due to a bug in Vim, if you set 'Tlist_Use_SingleClick' to 1 and try to resize -the taglist window using the mouse, then Vim will crash. This problem is fixed -in Vim 6.3 and above. In the meantime, instead of resizing the taglist window -using the mouse, you can use normal Vim window resizing commands to resize the -taglist window. - - *'Tlist_WinHeight'* -Tlist_WinHeight~ -The default height of the horizontally split taglist window is 10. This can be -changed by modifying the 'Tlist_WinHeight' variable: -> - let Tlist_WinHeight = 20 -< -The |'winfixheight'| option is set for the taglist window, to maintain the -height of the taglist window, when new Vim windows are opened and existing -windows are closed. - - *'Tlist_WinWidth'* -Tlist_WinWidth~ -The default width of the vertically split taglist window is 30. This can be -changed by modifying the 'Tlist_WinWidth' variable: -> - let Tlist_WinWidth = 20 -< -Note that the value of the |'winwidth'| option setting determines the minimum -width of the current window. If you set the 'Tlist_WinWidth' variable to a -value less than that of the |'winwidth'| option setting, then Vim will use the -value of the |'winwidth'| option. - -When new Vim windows are opened and existing windows are closed, the taglist -plugin will try to maintain the width of the taglist window to the size -specified by the 'Tlist_WinWidth' variable. - -============================================================================== - *taglist-commands* -7. Commands~ - -The taglist plugin provides the following ex-mode commands: - -|:TlistAddFiles| Add multiple files to the taglist. -|:TlistAddFilesRecursive| - Add files recursively to the taglist. -|:TlistClose| Close the taglist window. -|:TlistDebug| Start logging of taglist debug messages. -|:TlistLock| Stop adding new files to the taglist. -|:TlistMessages| Display the logged taglist plugin debug messages. -|:TlistOpen| Open and jump to the taglist window. -|:TlistSessionSave| Save the information about files and tags in the - taglist to a session file. -|:TlistSessionLoad| Load the information about files and tags stored - in a session file to taglist. -|:TlistShowPrototype| Display the prototype of the tag at or before the - specified line number. -|:TlistShowTag| Display the name of the tag defined at or before the - specified line number. -|:TlistHighlightTag| Highlight the current tag in the taglist window. -|:TlistToggle| Open or close (toggle) the taglist window. -|:TlistUndebug| Stop logging of taglist debug messages. -|:TlistUnlock| Start adding new files to the taglist. -|:TlistUpdate| Update the tags for the current buffer. - - *:TlistAddFiles* -:TlistAddFiles {file(s)} [file(s) ...] - Add one or more specified files to the taglist. You can - specify multiple filenames using wildcards. To specify a - file name with space character, you should escape the space - character with a backslash. - Examples: -> - :TlistAddFiles *.c *.cpp - :TlistAddFiles file1.html file2.html -< - If you specify a large number of files, then it will take some - time for the taglist plugin to process all of them. The - specified files will not be edited in a Vim window and will - not be added to the Vim buffer list. - - *:TlistAddFilesRecursive* -:TlistAddFilesRecursive {directory} [ {pattern} ] - Add files matching {pattern} recursively from the specified - {directory} to the taglist. If {pattern} is not specified, - then '*' is assumed. To specify the current directory, use "." - for {directory}. To specify a directory name with space - character, you should escape the space character with a - backslash. - Examples: -> - :TlistAddFilesRecursive myproject *.java - :TlistAddFilesRecursive smallproject -< - If large number of files are present in the specified - directory tree, then it will take some time for the taglist - plugin to process all of them. - - *:TlistClose* -:TlistClose Close the taglist window. This command can be used from any - one of the Vim windows. - - *:TlistDebug* -:TlistDebug [filename] - Start logging of debug messages from the taglist plugin. - If {filename} is specified, then the debug messages are stored - in the specified file. Otherwise, the debug messages are - stored in a script local variable. If the file {filename} is - already present, then it is overwritten. - - *:TlistLock* -:TlistLock - Lock the taglist and don't process new files. After this - command is executed, newly edited files will not be added to - the taglist. - - *:TlistMessages* -:TlistMessages - Display the logged debug messages from the taglist plugin - in a window. This command works only when logging to a - script-local variable. - - *:TlistOpen* -:TlistOpen Open and jump to the taglist window. Creates the taglist - window, if the window is not opened currently. After executing - this command, the cursor is moved to the taglist window. When - the taglist window is opened for the first time, all the files - in the buffer list are processed and the tags defined in them - are displayed in the taglist window. - - *:TlistSessionSave* -:TlistSessionSave {filename} - Saves the information about files and tags in the taglist to - the specified file. This command can be used to save and - restore the taglist contents across Vim sessions. - - *:TlistSessionLoad* -:TlistSessionLoad {filename} - Load the information about files and tags stored in the - specified session file to the taglist. - - *:TlistShowPrototype* -:TlistShowPrototype [filename] [linenumber] - Display the prototype of the tag at or before the specified - line number. If the file name and the line number are not - specified, then the current file name and line number are - used. A tag spans multiple lines starting from the line where - it is defined to the line before the next tag. This command - displays the prototype for the tag for any line number in this - range. - - *:TlistShowTag* -:TlistShowTag [filename] [linenumber] - Display the name of the tag defined at or before the specified - line number. If the file name and the line number are not - specified, then the current file name and line number are - used. A tag spans multiple lines starting from the line where - it is defined to the line before the next tag. This command - displays the tag name for any line number in this range. - - *:TlistHighlightTag* -:TlistHighlightTag - Highlight the current tag in the taglist window. By default, - the taglist plugin periodically updates the taglist window to - highlight the current tag. This command can be used to force - the taglist plugin to highlight the current tag. - - *:TlistToggle* -:TlistToggle Open or close (toggle) the taglist window. Opens the taglist - window, if the window is not opened currently. Closes the - taglist window, if the taglist window is already opened. When - the taglist window is opened for the first time, all the files - in the buffer list are processed and the tags are displayed in - the taglist window. After executing this command, the cursor - is not moved from the current window to the taglist window. - - *:TlistUndebug* -:TlistUndebug - Stop logging of debug messages from the taglist plugin. - - *:TlistUnlock* -:TlistUnlock - Unlock the taglist and start processing newly edited files. - - *:TlistUpdate* -:TlistUpdate Update the tags information for the current buffer. This - command can be used to re-process the current file/buffer and - get the tags information. As the taglist plugin uses the file - saved in the disk (instead of the file displayed in a Vim - buffer), you should save a modified buffer before you update - the taglist. Otherwise the listed tags will not include the - new tags created in the buffer. You can use this command even - when the taglist window is not opened. - -============================================================================== - *taglist-functions* -8. Global functions~ - -The taglist plugin provides several global functions that can be used from -other Vim plugins to interact with the taglist plugin. These functions are -described below. - -|Tlist_Update_File_Tags()| Update the tags for the specified file -|Tlist_Get_Tag_Prototype_By_Line()| Return the prototype of the tag at or - before the specified line number in the - specified file. -|Tlist_Get_Tagname_By_Line()| Return the name of the tag at or - before the specified line number in - the specified file. -|Tlist_Set_App()| Set the name of the application - controlling the taglist window. - - *Tlist_Update_File_Tags()* -Tlist_Update_File_Tags({filename}, {filetype}) - Update the tags for the file {filename}. The second argument - specifies the Vim filetype for the file. If the taglist plugin - has not processed the file previously, then the exuberant - ctags tool is invoked to generate the tags for the file. - - *Tlist_Get_Tag_Prototype_By_Line()* -Tlist_Get_Tag_Prototype_By_Line([{filename}, {linenumber}]) - Return the prototype of the tag at or before the specified - line number in the specified file. If the filename and line - number are not specified, then the current buffer name and the - current line number are used. - - *Tlist_Get_Tagname_By_Line()* -Tlist_Get_Tagname_By_Line([{filename}, {linenumber}]) - Return the name of the tag at or before the specified line - number in the specified file. If the filename and line number - are not specified, then the current buffer name and the - current line number are used. - - *Tlist_Set_App()* -Tlist_Set_App({appname}) - Set the name of the plugin that controls the taglist plugin - window and buffer. This can be used to integrate the taglist - plugin with other Vim plugins. - - For example, the winmanager plugin and the Cream package use - this function and specify the appname as "winmanager" and - "cream" respectively. - - By default, the taglist plugin is a stand-alone plugin and - controls the taglist window and buffer. If the taglist window - is controlled by an external plugin, then the appname should - be set appropriately. - -============================================================================== - *taglist-extend* -9. Extending~ - -The taglist plugin supports all the languages supported by the exuberant ctags -tool, which includes the following languages: Assembly, ASP, Awk, Beta, C, -C++, C#, Cobol, Eiffel, Erlang, Fortran, HTML, Java, Javascript, Lisp, Lua, -Make, Pascal, Perl, PHP, Python, Rexx, Ruby, Scheme, Shell, Slang, SML, Sql, -TCL, Verilog, Vim and Yacc. - -You can extend the taglist plugin to add support for new languages and also -modify the support for the above listed languages. - -You should NOT make modifications to the taglist plugin script file to add -support for new languages. You will lose these changes when you upgrade to the -next version of the taglist plugin. Instead you should follow the below -described instructions to extend the taglist plugin. - -You can extend the taglist plugin by setting variables in the .vimrc or _vimrc -file. The name of these variables depends on the language name and is -described below. - -Modifying support for an existing language~ -To modify the support for an already supported language, you have to set the -tlist_xxx_settings variable in the ~/.vimrc or $HOME/_vimrc file. Replace xxx -with the Vim filetype name for the language file. For example, to modify the -support for the perl language files, you have to set the tlist_perl_settings -variable. To modify the support for java files, you have to set the -tlist_java_settings variable. - -To determine the filetype name used by Vim for a file, use the following -command in the buffer containing the file: - - :set filetype - -The above command will display the Vim filetype for the current buffer. - -The format of the value set in the tlist_xxx_settings variable is - - ;flag1:name1;flag2:name2;flag3:name3 - -The different fields in the value are separated by the ';' character. - -The first field 'language_name' is the name used by exuberant ctags to refer -to this language file. This name can be different from the file type name used -by Vim. For example, for C++, the language name used by ctags is 'c++' but the -filetype name used by Vim is 'cpp'. To get the list of language names -supported by exuberant ctags, use the following command: - - $ ctags --list-maps=all - -The remaining fields follow the format "flag:name". The sub-field 'flag' is -the language specific flag used by exuberant ctags to generate the -corresponding tags. For example, for the C language, to list only the -functions, the 'f' flag is used. To get the list of flags supported by -exuberant ctags for the various languages use the following command: - - $ ctags --list-kinds=all - -The sub-field 'name' specifies the title text to use for displaying the tags -of a particular type. For example, 'name' can be set to 'functions'. This -field can be set to any text string name. - -For example, to list only the classes and functions defined in a C++ language -file, add the following line to your .vimrc file: - - let tlist_cpp_settings = 'c++;c:class;f:function' - -In the above setting, 'cpp' is the Vim filetype name and 'c++' is the name -used by the exuberant ctags tool. 'c' and 'f' are the flags passed to -exuberant ctags to list C++ classes and functions and 'class' is the title -used for the class tags and 'function' is the title used for the function tags -in the taglist window. - -For example, to display only functions defined in a C file and to use "My -Functions" as the title for the function tags, use - - let tlist_c_settings = 'c;f:My Functions' - -When you set the tlist_xxx_settings variable, you will override the default -setting used by the taglist plugin for the 'xxx' language. You cannot add to -the default options used by the taglist plugin for a particular file type. To -add to the options used by the taglist plugin for a language, copy the option -values from the taglist plugin file to your .vimrc file and modify it. - -Adding support for a new language~ -If you want to add support for a new language to the taglist plugin, you need -to first extend the exuberant ctags tool. For more information about extending -exuberant ctags, visit the following page: - - http://ctags.sourceforge.net/EXTENDING.html - -To add support for a new language, set the tlist_xxx_settings variable in the -~/.vimrc file appropriately as described above. Replace 'xxx' in the variable -name with the Vim filetype name for the new language. - -For example, to extend the taglist plugin to support the latex language, you -can use the following line (assuming, you have already extended exuberant -ctags to support the latex language): - - let tlist_tex_settings='latex;b:bibitem;c:command;l:label' - -With the above line, when you edit files of filetype "tex" in Vim, the taglist -plugin will invoke the exuberant ctags tool passing the "latex" filetype and -the flags b, c and l to generate the tags. The text heading 'bibitem', -'command' and 'label' will be used in the taglist window for the tags which -are generated for the flags b, c and l respectively. - -============================================================================== - *taglist-faq* -10. Frequently Asked Questions~ - -Q. The taglist plugin doesn't work. The taglist window is empty and the tags - defined in a file are not displayed. -A. Are you using Vim version 6.0 and above? The taglist plugin relies on the - features supported by Vim version 6.0 and above. You can use the following - command to get the Vim version: -> - $ vim --version -< - Are you using exuberant ctags version 5.0 and above? The taglist plugin - relies on the features supported by exuberant ctags and will not work with - GNU ctags or the Unix ctags utility. You can use the following command to - determine whether the ctags installed in your system is exuberant ctags: -> - $ ctags --version -< - Is exuberant ctags present in one of the directories in your PATH? If not, - you need to set the Tlist_Ctags_Cmd variable to point to the location of - exuberant ctags. Use the following Vim command to verify that this is setup - correctly: -> - :echo system(Tlist_Ctags_Cmd . ' --version') -< - The above command should display the version information for exuberant - ctags. - - Did you turn on the Vim filetype detection? The taglist plugin relies on - the filetype detected by Vim and passes the filetype to the exuberant ctags - utility to parse the tags. Check the output of the following Vim command: -> - :filetype -< - The output of the above command should contain "filetype detection:ON". - To turn on the filetype detection, add the following line to the .vimrc or - _vimrc file: -> - filetype on -< - Is your version of Vim compiled with the support for the system() function? - The following Vim command should display 1: -> - :echo exists('*system') -< - In some Linux distributions (particularly Suse Linux), the default Vim - installation is built without the support for the system() function. The - taglist plugin uses the system() function to invoke the exuberant ctags - utility. You need to rebuild Vim after enabling the support for the - system() function. If you use the default build options, the system() - function will be supported. - - Do you have the |'shellslash'| option set? You can try disabling the - |'shellslash'| option. When the taglist plugin invokes the exuberant ctags - utility with the path to the file, if the incorrect slashes are used, then - you will see errors. - - Check the shell related Vim options values using the following command: -> - :set shell? shellcmdflag? shellpipe? - :set shellquote? shellredir? shellxquote? -< - If these options are set in your .vimrc or _vimrc file, try removing those - lines. - - Are you using a Unix shell in a MS-Windows environment? For example, - the Unix shell from the MKS-toolkit. Do you have the SHELL environment - set to point to this shell? You can try resetting the SHELL environment - variable. - - If you are using a Unix shell on MS-Windows, you should try to use - exuberant ctags that is compiled for Unix-like environments so that - exuberant ctags will understand path names with forward slash characters. - - Is your filetype supported by the exuberant ctags utility? The file types - supported by the exuberant ctags utility are listed in the ctags help. If a - file type is not supported, you have to extend exuberant ctags. You can use - the following command to list the filetypes supported by exuberant ctags: -> - ctags --list-languages -< - Run the following command from the shell prompt and check whether the tags - defined in your file are listed in the output from exuberant ctags: -> - ctags -f - --format=2 --excmd=pattern --fields=nks -< - If you see your tags in the output from the above command, then the - exuberant ctags utility is properly parsing your file. - - Do you have the .ctags or _ctags or the ctags.cnf file in your home - directory for specifying default options or for extending exuberant ctags? - If you do have this file, check the options in this file and make sure - these options are not interfering with the operation of the taglist plugin. - - If you are using MS-Windows, check the value of the TEMP and TMP - environment variables. If these environment variables are set to a path - with space characters in the name, then try using the DOS 8.3 short name - for the path or set them to a path without the space characters in the - name. For example, if the temporary directory name is "C:\Documents and - Settings\xyz\Local Settings\Temp", then try setting the TEMP variable to - the following: -> - set TEMP=C:\DOCUMEN~1\xyz\LOCALS~1\Temp -< - If exuberant ctags is installed in a directory with space characters in the - name, then try adding the directory to the PATH environment variable or try - setting the 'Tlist_Ctags_Cmd' variable to the shortest path name to ctags - or try copying the exuberant ctags to a path without space characters in - the name. For example, if exuberant ctags is installed in the directory - "C:\Program Files\Ctags", then try setting the 'Tlist_Ctags_Cmd' variable - as below: -> - let Tlist_Ctags_Cmd='C:\Progra~1\Ctags\ctags.exe' -< - If you are using a cygwin compiled version of exuberant ctags on MS-Windows, - make sure that either you have the cygwin compiled sort utility installed - and available in your PATH or compile exuberant ctags with internal sort - support. Otherwise, when exuberant ctags sorts the tags output by invoking - the sort utility, it may end up invoking the MS-Windows version of - sort.exe, thereby resulting in failure. - -Q. When I try to open the taglist window, I am seeing the following error - message. How do I fix this problem? - - Taglist: Failed to generate tags for /my/path/to/file - ctags: illegal option -- -^@usage: ctags [-BFadtuwvx] [-f tagsfile] file ... - -A. The taglist plugin will work only with the exuberant ctags tool. You - cannot use the GNU ctags or the Unix ctags program with the taglist plugin. - You will see an error message similar to the one shown above, if you try - use a non-exuberant ctags program with Vim. To fix this problem, either add - the exuberant ctags tool location to the PATH environment variable or set - the 'Tlist_Ctags_Cmd' variable. - -Q. A file has more than one tag with the same name. When I select a tag name - from the taglist window, the cursor is positioned at the incorrect tag - location. -A. The taglist plugin uses the search pattern generated by the exuberant ctags - utility to position the cursor at the location of a tag definition. If a - file has more than one tag with the same name and same prototype, then the - search pattern will be the same. In this case, when searching for the tag - pattern, the cursor may be positioned at the incorrect location. - -Q. I have made some modifications to my file and introduced new - functions/classes/variables. I have not yet saved my file. The taglist - plugin is not displaying the new tags when I update the taglist window. -A. The exuberant ctags utility will process only files that are present in the - disk. To list the tags defined in a file, you have to save the file and - then update the taglist window. - -Q. I have created a ctags file using the exuberant ctags utility for my source - tree. How do I configure the taglist plugin to use this tags file? -A. The taglist plugin doesn't use a tags file stored in disk. For every opened - file, the taglist plugin invokes the exuberant ctags utility to get the - list of tags dynamically. The Vim system() function is used to invoke - exuberant ctags and get the ctags output. This function internally uses a - temporary file to store the output. This file is deleted after the output - from the command is read. So you will never see the file that contains the - output of exuberant ctags. - -Q. When I set the |'updatetime'| option to a low value (less than 1000) and if - I keep pressing a key with the taglist window open, the current buffer - contents are changed. Why is this? -A. The taglist plugin uses the |CursorHold| autocmd to highlight the current - tag. The CursorHold autocmd triggers for every |'updatetime'| milliseconds. - If the |'updatetime'| option is set to a low value, then the CursorHold - autocmd will be triggered frequently. As the taglist plugin changes - the focus to the taglist window to highlight the current tag, this could - interfere with the key movement resulting in changing the contents of - the current buffer. The workaround for this problem is to not set the - |'updatetime'| option to a low value. - -============================================================================== - *taglist-license* -11. License~ -Permission is hereby granted to use and distribute the taglist plugin, with or -without modifications, provided that this copyright notice is copied with it. -Like anything else that's free, taglist.vim is provided *as is* and comes with -no warranty of any kind, either expressed or implied. In no event will the -copyright holder be liable for any damamges resulting from the use of this -software. - -============================================================================== - *taglist-todo* -12. Todo~ - -1. Group tags according to the scope and display them. For example, - group all the tags belonging to a C++/Java class -2. Support for displaying tags in a modified (not-yet-saved) file. -3. Automatically open the taglist window only for selected filetypes. - For other filetypes, close the taglist window. -4. When using the shell from the MKS toolkit, the taglist plugin - doesn't work. -5. The taglist plugin doesn't work with files edited remotely using the - netrw plugin. The exuberant ctags utility cannot process files over - scp/rcp/ftp, etc. - -============================================================================== - -vim:tw=78:ts=8:noet:ft=help: diff --git a/bundle/taglist.vim/plugin/taglist.vim b/bundle/taglist.vim/plugin/taglist.vim deleted file mode 100644 index 59901f64..00000000 --- a/bundle/taglist.vim/plugin/taglist.vim +++ /dev/null @@ -1,4546 +0,0 @@ -" File: taglist.vim -" Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com) -" Version: 4.5 -" Last Modified: September 21, 2007 -" Copyright: Copyright (C) 2002-2007 Yegappan Lakshmanan -" Permission is hereby granted to use and distribute this code, -" with or without modifications, provided that this copyright -" notice is copied with it. Like anything else that's free, -" taglist.vim is provided *as is* and comes with no warranty of any -" kind, either expressed or implied. In no event will the copyright -" holder be liable for any damamges resulting from the use of this -" software. -" -" The "Tag List" plugin is a source code browser plugin for Vim and provides -" an overview of the structure of the programming language 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. -" -" Installation -" ------------ -" 1. Download the taglist.zip file and unzip the files to the $HOME/.vim -" or the $HOME/vimfiles or the $VIM/vimfiles directory. This should -" unzip the following two files (the directory structure should be -" preserved): -" -" plugin/taglist.vim - main taglist plugin file -" doc/taglist.txt - documentation (help) file -" -" Refer to the 'add-plugin', 'add-global-plugin' and 'runtimepath' -" Vim help pages for more details about installing Vim plugins. -" 2. Change to the $HOME/.vim/doc or $HOME/vimfiles/doc or -" $VIM/vimfiles/doc directory, start Vim and run the ":helptags ." -" command to process the taglist help file. -" 3. If the exuberant ctags utility is not present in your PATH, then set the -" Tlist_Ctags_Cmd variable to point to the location of the exuberant ctags -" utility (not to the directory) in the .vimrc file. -" 4. If you are running a terminal/console version of Vim and the -" terminal doesn't support changing the window width then set the -" 'Tlist_Inc_Winwidth' variable to 0 in the .vimrc file. -" 5. Restart Vim. -" 6. You can now use the ":TlistToggle" command to open/close the taglist -" window. You can use the ":help taglist" command to get more -" information about using the taglist plugin. -" -" ****************** Do not modify after this line ************************ - -" Line continuation used here -let s:cpo_save = &cpo -set cpo&vim - -if !exists('loaded_taglist') - " First time loading the taglist plugin - " - " To speed up the loading of Vim, the taglist plugin uses autoload - " mechanism to load the taglist functions. - " Only define the configuration variables, user commands and some - " auto-commands and finish sourcing the file - - " The taglist plugin requires the built-in Vim system() function. If this - " function is not available, then don't load the plugin. - if !exists('*system') - echomsg 'Taglist: Vim system() built-in function is not available. ' . - \ 'Plugin is not loaded.' - let loaded_taglist = 'no' - let &cpo = s:cpo_save - finish - endif - - " Location of the exuberant ctags tool - if !exists('Tlist_Ctags_Cmd') - if executable('exuberant-ctags') - " On Debian Linux, exuberant ctags is installed - " as exuberant-ctags - let Tlist_Ctags_Cmd = 'exuberant-ctags' - elseif executable('exctags') - " On Free-BSD, exuberant ctags is installed as exctags - let Tlist_Ctags_Cmd = 'exctags' - elseif executable('ctags') - let Tlist_Ctags_Cmd = 'ctags' - elseif executable('ctags.exe') - let Tlist_Ctags_Cmd = 'ctags.exe' - elseif executable('tags') - let Tlist_Ctags_Cmd = 'tags' - else - echomsg 'Taglist: Exuberant ctags (http://ctags.sf.net) ' . - \ 'not found in PATH. Plugin is not loaded.' - " Skip loading the plugin - let loaded_taglist = 'no' - let &cpo = s:cpo_save - finish - endif - endif - - - " Automatically open the taglist window on Vim startup - if !exists('Tlist_Auto_Open') - let Tlist_Auto_Open = 0 - endif - - " When the taglist window is toggle opened, move the cursor to the - " taglist window - if !exists('Tlist_GainFocus_On_ToggleOpen') - let Tlist_GainFocus_On_ToggleOpen = 0 - endif - - " Process files even when the taglist window is not open - if !exists('Tlist_Process_File_Always') - let Tlist_Process_File_Always = 0 - endif - - if !exists('Tlist_Show_Menu') - let Tlist_Show_Menu = 0 - endif - - " Tag listing sort type - 'name' or 'order' - if !exists('Tlist_Sort_Type') - let Tlist_Sort_Type = 'order' - endif - - " Tag listing window split (horizontal/vertical) control - if !exists('Tlist_Use_Horiz_Window') - let Tlist_Use_Horiz_Window = 0 - endif - - " Open the vertically split taglist window on the left or on the right - " side. This setting is relevant only if Tlist_Use_Horiz_Window is set to - " zero (i.e. only for vertically split windows) - if !exists('Tlist_Use_Right_Window') - let Tlist_Use_Right_Window = 0 - endif - - " Increase Vim window width to display vertically split taglist window. - " For MS-Windows version of Vim running in a MS-DOS window, this must be - " set to 0 otherwise the system may hang due to a Vim limitation. - if !exists('Tlist_Inc_Winwidth') - if (has('win16') || has('win95')) && !has('gui_running') - let Tlist_Inc_Winwidth = 0 - else - let Tlist_Inc_Winwidth = 1 - endif - endif - - " Vertically split taglist window width setting - if !exists('Tlist_WinWidth') - let Tlist_WinWidth = 30 - endif - - " Horizontally split taglist window height setting - if !exists('Tlist_WinHeight') - let Tlist_WinHeight = 10 - endif - - " Display tag prototypes or tag names in the taglist window - if !exists('Tlist_Display_Prototype') - let Tlist_Display_Prototype = 0 - endif - - " Display tag scopes in the taglist window - if !exists('Tlist_Display_Tag_Scope') - let Tlist_Display_Tag_Scope = 1 - endif - - " Use single left mouse click to jump to a tag. By default this is disabled. - " Only double click using the mouse will be processed. - if !exists('Tlist_Use_SingleClick') - let Tlist_Use_SingleClick = 0 - endif - - " Control whether additional help is displayed as part of the taglist or - " not. Also, controls whether empty lines are used to separate the tag - " tree. - if !exists('Tlist_Compact_Format') - let Tlist_Compact_Format = 0 - endif - - " Exit Vim if only the taglist window is currently open. By default, this is - " set to zero. - if !exists('Tlist_Exit_OnlyWindow') - let Tlist_Exit_OnlyWindow = 0 - endif - - " Automatically close the folds for the non-active files in the taglist - " window - if !exists('Tlist_File_Fold_Auto_Close') - let Tlist_File_Fold_Auto_Close = 0 - endif - - " Close the taglist window when a tag is selected - if !exists('Tlist_Close_On_Select') - let Tlist_Close_On_Select = 0 - endif - - " Automatically update the taglist window to display tags for newly - " edited files - if !exists('Tlist_Auto_Update') - let Tlist_Auto_Update = 1 - endif - - " Automatically highlight the current tag - if !exists('Tlist_Auto_Highlight_Tag') - let Tlist_Auto_Highlight_Tag = 1 - endif - - " Automatically highlight the current tag on entering a buffer - if !exists('Tlist_Highlight_Tag_On_BufEnter') - let Tlist_Highlight_Tag_On_BufEnter = 1 - endif - - " Enable fold column to display the folding for the tag tree - if !exists('Tlist_Enable_Fold_Column') - let Tlist_Enable_Fold_Column = 1 - endif - - " Display the tags for only one file in the taglist window - if !exists('Tlist_Show_One_File') - let Tlist_Show_One_File = 0 - endif - - if !exists('Tlist_Max_Submenu_Items') - let Tlist_Max_Submenu_Items = 20 - endif - - if !exists('Tlist_Max_Tag_Length') - let Tlist_Max_Tag_Length = 10 - endif - - " Do not change the name of the taglist title variable. The winmanager - " plugin relies on this name to determine the title for the taglist - " plugin. - let TagList_title = "__Tag_List__" - - " Taglist debug messages - let s:tlist_msg = '' - - " Define the taglist autocommand to automatically open the taglist window - " on Vim startup - if g:Tlist_Auto_Open - autocmd VimEnter * nested call s:Tlist_Window_Check_Auto_Open() - endif - - " Refresh the taglist - if g:Tlist_Process_File_Always - autocmd BufEnter * call s:Tlist_Refresh() - endif - - if g:Tlist_Show_Menu - autocmd GUIEnter * call s:Tlist_Menu_Init() - endif - - " When the taglist buffer is created when loading a Vim session file, - " the taglist buffer needs to be initialized. The BufFilePost event - " is used to handle this case. - autocmd BufFilePost __Tag_List__ call s:Tlist_Vim_Session_Load() - - " Define the user commands to manage the taglist window - command! -nargs=0 -bar TlistToggle call s:Tlist_Window_Toggle() - command! -nargs=0 -bar TlistOpen call s:Tlist_Window_Open() - " For backwards compatiblity define the Tlist command - command! -nargs=0 -bar Tlist TlistToggle - command! -nargs=+ -complete=file TlistAddFiles - \ call s:Tlist_Add_Files() - command! -nargs=+ -complete=dir TlistAddFilesRecursive - \ call s:Tlist_Add_Files_Recursive() - command! -nargs=0 -bar TlistClose call s:Tlist_Window_Close() - command! -nargs=0 -bar TlistUpdate call s:Tlist_Update_Current_File() - command! -nargs=0 -bar TlistHighlightTag call s:Tlist_Window_Highlight_Tag( - \ fnamemodify(bufname('%'), ':p'), line('.'), 2, 1) - " For backwards compatiblity define the TlistSync command - command! -nargs=0 -bar TlistSync TlistHighlightTag - command! -nargs=* -complete=buffer TlistShowPrototype - \ echo Tlist_Get_Tag_Prototype_By_Line() - command! -nargs=* -complete=buffer TlistShowTag - \ echo Tlist_Get_Tagname_By_Line() - command! -nargs=* -complete=file TlistSessionLoad - \ call s:Tlist_Session_Load() - command! -nargs=* -complete=file TlistSessionSave - \ call s:Tlist_Session_Save() - command! -bar TlistLock let Tlist_Auto_Update=0 - command! -bar TlistUnlock let Tlist_Auto_Update=1 - - " Commands for enabling/disabling debug and to display debug messages - command! -nargs=? -complete=file -bar TlistDebug - \ call s:Tlist_Debug_Enable() - command! -nargs=0 -bar TlistUndebug call s:Tlist_Debug_Disable() - command! -nargs=0 -bar TlistMessages call s:Tlist_Debug_Show() - - " Define autocommands to autoload the taglist plugin when needed. - - " Trick to get the current script ID - map xx xx - let s:tlist_sid = substitute(maparg('xx'), '\(\d\+_\)xx$', - \ '\1', '') - unmap xx - - exe 'autocmd FuncUndefined *' . s:tlist_sid . 'Tlist_* source ' . - \ escape(expand(''), ' ') - exe 'autocmd FuncUndefined *' . s:tlist_sid . 'Tlist_Window_* source ' . - \ escape(expand(''), ' ') - exe 'autocmd FuncUndefined *' . s:tlist_sid . 'Tlist_Menu_* source ' . - \ escape(expand(''), ' ') - exe 'autocmd FuncUndefined Tlist_* source ' . - \ escape(expand(''), ' ') - exe 'autocmd FuncUndefined TagList_* source ' . - \ escape(expand(''), ' ') - - let loaded_taglist = 'fast_load_done' - - if g:Tlist_Show_Menu && has('gui_running') - call s:Tlist_Menu_Init() - endif - - " restore 'cpo' - let &cpo = s:cpo_save - finish -endif - -if !exists('s:tlist_sid') - " Two or more versions of taglist plugin are installed. Don't - " load this version of the plugin. - finish -endif - -unlet! s:tlist_sid - -if loaded_taglist != 'fast_load_done' - " restore 'cpo' - let &cpo = s:cpo_save - finish -endif - -" Taglist plugin functionality is available -let loaded_taglist = 'available' - -"------------------- end of user configurable options -------------------- - -" Default language specific settings for supported file types and tag types -" -" Variable name format: -" -" s:tlist_def_{vim_ftype}_settings -" -" vim_ftype - Filetype detected by Vim -" -" Value format: -" -" ;:;:;... -" -" ctags_ftype - File type supported by exuberant ctags -" flag - Flag supported by exuberant ctags to generate a tag type -" name - Name of the tag type used in the taglist window to display the -" tags of this type -" - -" assembly language -let s:tlist_def_asm_settings = 'asm;d:define;l:label;m:macro;t:type' - -" aspperl language -let s:tlist_def_aspperl_settings = 'asp;f:function;s:sub;v:variable' - -" aspvbs language -let s:tlist_def_aspvbs_settings = 'asp;f:function;s:sub;v:variable' - -" awk language -let s:tlist_def_awk_settings = 'awk;f:function' - -" beta language -let s:tlist_def_beta_settings = 'beta;f:fragment;s:slot;v:pattern' - -" c language -let s:tlist_def_c_settings = 'c;d:macro;g:enum;s:struct;u:union;t:typedef;' . - \ 'v:variable;f:function' - -" c++ language -let s:tlist_def_cpp_settings = 'c++;n:namespace;v:variable;d:macro;t:typedef;' . - \ 'c:class;g:enum;s:struct;u:union;f:function' - -" c# language -let s:tlist_def_cs_settings = 'c#;d:macro;t:typedef;n:namespace;c:class;' . - \ 'E:event;g:enum;s:struct;i:interface;' . - \ 'p:properties;m:method' - -" cobol language -let s:tlist_def_cobol_settings = 'cobol;d:data;f:file;g:group;p:paragraph;' . - \ 'P:program;s:section' - -" eiffel language -let s:tlist_def_eiffel_settings = 'eiffel;c:class;f:feature' - -" erlang language -let s:tlist_def_erlang_settings = 'erlang;d:macro;r:record;m:module;f:function' - -" expect (same as tcl) language -let s:tlist_def_expect_settings = 'tcl;c:class;f:method;p:procedure' - -" fortran language -let s:tlist_def_fortran_settings = 'fortran;p:program;b:block data;' . - \ 'c:common;e:entry;i:interface;k:type;l:label;m:module;' . - \ 'n:namelist;t:derived;v:variable;f:function;s:subroutine' - -" HTML language -let s:tlist_def_html_settings = 'html;a:anchor;f:javascript function' - -" java language -let s:tlist_def_java_settings = 'java;p:package;c:class;i:interface;' . - \ 'f:field;m:method' - -" javascript language -let s:tlist_def_javascript_settings = 'javascript;f:function' - -" lisp language -let s:tlist_def_lisp_settings = 'lisp;f:function' - -" lua language -let s:tlist_def_lua_settings = 'lua;f:function' - -" makefiles -let s:tlist_def_make_settings = 'make;m:macro' - -" pascal language -let s:tlist_def_pascal_settings = 'pascal;f:function;p:procedure' - -" perl language -let s:tlist_def_perl_settings = 'perl;c:constant;l:label;p:package;s:subroutine' - -" php language -let s:tlist_def_php_settings = 'php;c:class;d:constant;v:variable;f:function' - -" python language -let s:tlist_def_python_settings = 'python;c:class;m:member;f:function' - -" rexx language -let s:tlist_def_rexx_settings = 'rexx;s:subroutine' - -" ruby language -let s:tlist_def_ruby_settings = 'ruby;c:class;f:method;F:function;' . - \ 'm:singleton method' - -" scheme language -let s:tlist_def_scheme_settings = 'scheme;s:set;f:function' - -" shell language -let s:tlist_def_sh_settings = 'sh;f:function' - -" C shell language -let s:tlist_def_csh_settings = 'sh;f:function' - -" Z shell language -let s:tlist_def_zsh_settings = 'sh;f:function' - -" slang language -let s:tlist_def_slang_settings = 'slang;n:namespace;f:function' - -" sml language -let s:tlist_def_sml_settings = 'sml;e:exception;c:functor;s:signature;' . - \ 'r:structure;t:type;v:value;f:function' - -" sql language -let s:tlist_def_sql_settings = 'sql;c:cursor;F:field;P:package;r:record;' . - \ 's:subtype;t:table;T:trigger;v:variable;f:function;p:procedure' - -" tcl language -let s:tlist_def_tcl_settings = 'tcl;c:class;f:method;m:method;p:procedure' - -" vera language -let s:tlist_def_vera_settings = 'vera;c:class;d:macro;e:enumerator;' . - \ 'f:function;g:enum;m:member;p:program;' . - \ 'P:prototype;t:task;T:typedef;v:variable;' . - \ 'x:externvar' - -"verilog language -let s:tlist_def_verilog_settings = 'verilog;m:module;c:constant;P:parameter;' . - \ 'e:event;r:register;t:task;w:write;p:port;v:variable;f:function' - -" vim language -let s:tlist_def_vim_settings = 'vim;a:autocmds;v:variable;f:function' - -" yacc language -let s:tlist_def_yacc_settings = 'yacc;l:label' - -"------------------- end of language specific options -------------------- - -" Vim window size is changed by the taglist plugin or not -let s:tlist_winsize_chgd = -1 -" Taglist window is maximized or not -let s:tlist_win_maximized = 0 -" Name of files in the taglist -let s:tlist_file_names='' -" Number of files in the taglist -let s:tlist_file_count = 0 -" Number of filetypes supported by taglist -let s:tlist_ftype_count = 0 -" Is taglist part of other plugins like winmanager or cream? -let s:tlist_app_name = "none" -" Are we displaying brief help text -let s:tlist_brief_help = 1 -" List of files removed on user request -let s:tlist_removed_flist = "" -" Index of current file displayed in the taglist window -let s:tlist_cur_file_idx = -1 -" Taglist menu is empty or not -let s:tlist_menu_empty = 1 - -" An autocommand is used to refresh the taglist window when entering any -" buffer. We don't want to refresh the taglist window if we are entering the -" file window from one of the taglist functions. The 'Tlist_Skip_Refresh' -" variable is used to skip the refresh of the taglist window and is set -" and cleared appropriately. -let s:Tlist_Skip_Refresh = 0 - -" Tlist_Window_Display_Help() -function! s:Tlist_Window_Display_Help() - if s:tlist_app_name == "winmanager" - " To handle a bug in the winmanager plugin, add a space at the - " last line - call setline('$', ' ') - endif - - if s:tlist_brief_help - " Add the brief help - call append(0, '" Press to display help text') - else - " Add the extensive help - call append(0, '" : Jump to tag definition') - call append(1, '" o : Jump to tag definition in new window') - call append(2, '" p : Preview the tag definition') - call append(3, '" : Display tag prototype') - call append(4, '" u : Update tag list') - call append(5, '" s : Select sort field') - call append(6, '" d : Remove file from taglist') - call append(7, '" x : Zoom-out/Zoom-in taglist window') - call append(8, '" + : Open a fold') - call append(9, '" - : Close a fold') - call append(10, '" * : Open all folds') - call append(11, '" = : Close all folds') - call append(12, '" [[ : Move to the start of previous file') - call append(13, '" ]] : Move to the start of next file') - call append(14, '" q : Close the taglist window') - call append(15, '" : Remove help text') - endif -endfunction - -" Tlist_Window_Toggle_Help_Text() -" Toggle taglist plugin help text between the full version and the brief -" version -function! s:Tlist_Window_Toggle_Help_Text() - if g:Tlist_Compact_Format - " In compact display mode, do not display help - return - endif - - " Include the empty line displayed after the help text - let brief_help_size = 1 - let full_help_size = 16 - - setlocal modifiable - - " Set report option to a huge value to prevent informational messages - " while deleting the lines - let old_report = &report - set report=99999 - - " Remove the currently highlighted tag. Otherwise, the help text - " might be highlighted by mistake - match none - - " Toggle between brief and full help text - if s:tlist_brief_help - let s:tlist_brief_help = 0 - - " Remove the previous help - exe '1,' . brief_help_size . ' delete _' - - " Adjust the start/end line numbers for the files - call s:Tlist_Window_Update_Line_Offsets(0, 1, full_help_size - brief_help_size) - else - let s:tlist_brief_help = 1 - - " Remove the previous help - exe '1,' . full_help_size . ' delete _' - - " Adjust the start/end line numbers for the files - call s:Tlist_Window_Update_Line_Offsets(0, 0, full_help_size - brief_help_size) - endif - - call s:Tlist_Window_Display_Help() - - " Restore the report option - let &report = old_report - - setlocal nomodifiable -endfunction - -" Taglist debug support -let s:tlist_debug = 0 - -" File for storing the debug messages -let s:tlist_debug_file = '' - -" Tlist_Debug_Enable -" Enable logging of taglist debug messages. -function! s:Tlist_Debug_Enable(...) - let s:tlist_debug = 1 - - " Check whether a valid file name is supplied. - if a:1 != '' - let s:tlist_debug_file = fnamemodify(a:1, ':p') - - " Empty the log file - exe 'redir! > ' . s:tlist_debug_file - redir END - - " Check whether the log file is present/created - if !filewritable(s:tlist_debug_file) - call s:Tlist_Warning_Msg('Taglist: Unable to create log file ' - \ . s:tlist_debug_file) - let s:tlist_debug_file = '' - endif - endif -endfunction - -" Tlist_Debug_Disable -" Disable logging of taglist debug messages. -function! s:Tlist_Debug_Disable(...) - let s:tlist_debug = 0 - let s:tlist_debug_file = '' -endfunction - -" Tlist_Debug_Show -" Display the taglist debug messages in a new window -function! s:Tlist_Debug_Show() - if s:tlist_msg == '' - call s:Tlist_Warning_Msg('Taglist: No debug messages') - return - endif - - " Open a new window to display the taglist debug messages - new taglist_debug.txt - " Delete all the lines (if the buffer already exists) - silent! %delete _ - " Add the messages - silent! put =s:tlist_msg - " Move the cursor to the first line - normal! gg -endfunction - -" Tlist_Log_Msg -" Log the supplied debug message along with the time -function! s:Tlist_Log_Msg(msg) - if s:tlist_debug - if s:tlist_debug_file != '' - exe 'redir >> ' . s:tlist_debug_file - silent echon strftime('%H:%M:%S') . ': ' . a:msg . "\n" - redir END - else - " Log the message into a variable - " Retain only the last 3000 characters - let len = strlen(s:tlist_msg) - if len > 3000 - let s:tlist_msg = strpart(s:tlist_msg, len - 3000) - endif - let s:tlist_msg = s:tlist_msg . strftime('%H:%M:%S') . ': ' . - \ a:msg . "\n" - endif - endif -endfunction - -" Tlist_Warning_Msg() -" Display a message using WarningMsg highlight group -function! s:Tlist_Warning_Msg(msg) - echohl WarningMsg - echomsg a:msg - echohl None -endfunction - -" Last returned file index for file name lookup. -" Used to speed up file lookup -let s:tlist_file_name_idx_cache = -1 - -" Tlist_Get_File_Index() -" Return the index of the specified filename -function! s:Tlist_Get_File_Index(fname) - if s:tlist_file_count == 0 || a:fname == '' - return -1 - endif - - " If the new filename is same as the last accessed filename, then - " return that index - if s:tlist_file_name_idx_cache != -1 && - \ s:tlist_file_name_idx_cache < s:tlist_file_count - if s:tlist_{s:tlist_file_name_idx_cache}_filename == a:fname - " Same as the last accessed file - return s:tlist_file_name_idx_cache - endif - endif - - " First, check whether the filename is present - let s_fname = a:fname . "\n" - let i = stridx(s:tlist_file_names, s_fname) - if i == -1 - let s:tlist_file_name_idx_cache = -1 - return -1 - endif - - " Second, compute the file name index - let nl_txt = substitute(strpart(s:tlist_file_names, 0, i), "[^\n]", '', 'g') - let s:tlist_file_name_idx_cache = strlen(nl_txt) - return s:tlist_file_name_idx_cache -endfunction - -" Last returned file index for line number lookup. -" Used to speed up file lookup -let s:tlist_file_lnum_idx_cache = -1 - -" Tlist_Window_Get_File_Index_By_Linenum() -" Return the index of the filename present in the specified line number -" Line number refers to the line number in the taglist window -function! s:Tlist_Window_Get_File_Index_By_Linenum(lnum) - call s:Tlist_Log_Msg('Tlist_Window_Get_File_Index_By_Linenum (' . a:lnum . ')') - - " First try to see whether the new line number is within the range - " of the last returned file - if s:tlist_file_lnum_idx_cache != -1 && - \ s:tlist_file_lnum_idx_cache < s:tlist_file_count - if a:lnum >= s:tlist_{s:tlist_file_lnum_idx_cache}_start && - \ a:lnum <= s:tlist_{s:tlist_file_lnum_idx_cache}_end - return s:tlist_file_lnum_idx_cache - endif - endif - - let fidx = -1 - - if g:Tlist_Show_One_File - " Displaying only one file in the taglist window. Check whether - " the line is within the tags displayed for that file - if s:tlist_cur_file_idx != -1 - if a:lnum >= s:tlist_{s:tlist_cur_file_idx}_start - \ && a:lnum <= s:tlist_{s:tlist_cur_file_idx}_end - let fidx = s:tlist_cur_file_idx - endif - - endif - else - " Do a binary search in the taglist - let left = 0 - let right = s:tlist_file_count - 1 - - while left < right - let mid = (left + right) / 2 - - if a:lnum >= s:tlist_{mid}_start && a:lnum <= s:tlist_{mid}_end - let s:tlist_file_lnum_idx_cache = mid - return mid - endif - - if a:lnum < s:tlist_{mid}_start - let right = mid - 1 - else - let left = mid + 1 - endif - endwhile - - if left >= 0 && left < s:tlist_file_count - \ && a:lnum >= s:tlist_{left}_start - \ && a:lnum <= s:tlist_{left}_end - let fidx = left - endif - endif - - let s:tlist_file_lnum_idx_cache = fidx - - return fidx -endfunction - -" Tlist_Exe_Cmd_No_Acmds -" Execute the specified Ex command after disabling autocommands -function! s:Tlist_Exe_Cmd_No_Acmds(cmd) - let old_eventignore = &eventignore - set eventignore=all - exe a:cmd - let &eventignore = old_eventignore -endfunction - -" Tlist_Skip_File() -" Check whether tag listing is supported for the specified file -function! s:Tlist_Skip_File(filename, ftype) - " Skip buffers with no names and buffers with filetype not set - if a:filename == '' || a:ftype == '' - return 1 - endif - - " Skip files which are not supported by exuberant ctags - " First check whether default settings for this filetype are available. - " If it is not available, then check whether user specified settings are - " available. If both are not available, then don't list the tags for this - " filetype - let var = 's:tlist_def_' . a:ftype . '_settings' - if !exists(var) - let var = 'g:tlist_' . a:ftype . '_settings' - if !exists(var) - return 1 - endif - endif - - " Skip files which are not readable or files which are not yet stored - " to the disk - if !filereadable(a:filename) - return 1 - endif - - return 0 -endfunction - -" Tlist_User_Removed_File -" Returns 1 if a file is removed by a user from the taglist -function! s:Tlist_User_Removed_File(filename) - return stridx(s:tlist_removed_flist, a:filename . "\n") != -1 -endfunction - -" Tlist_Update_Remove_List -" Update the list of user removed files from the taglist -" add == 1, add the file to the removed list -" add == 0, delete the file from the removed list -function! s:Tlist_Update_Remove_List(filename, add) - if a:add - let s:tlist_removed_flist = s:tlist_removed_flist . a:filename . "\n" - else - let idx = stridx(s:tlist_removed_flist, a:filename . "\n") - let text_before = strpart(s:tlist_removed_flist, 0, idx) - let rem_text = strpart(s:tlist_removed_flist, idx) - let next_idx = stridx(rem_text, "\n") - let text_after = strpart(rem_text, next_idx + 1) - - let s:tlist_removed_flist = text_before . text_after - endif -endfunction - -" Tlist_FileType_Init -" Initialize the ctags arguments and tag variable for the specified -" file type -function! s:Tlist_FileType_Init(ftype) - call s:Tlist_Log_Msg('Tlist_FileType_Init (' . a:ftype . ')') - " If the user didn't specify any settings, then use the default - " ctags args. Otherwise, use the settings specified by the user - let var = 'g:tlist_' . a:ftype . '_settings' - if exists(var) - " User specified ctags arguments - let settings = {var} . ';' - else - " Default ctags arguments - let var = 's:tlist_def_' . a:ftype . '_settings' - if !exists(var) - " No default settings for this file type. This filetype is - " not supported - return 0 - endif - let settings = s:tlist_def_{a:ftype}_settings . ';' - endif - - let msg = 'Taglist: Invalid ctags option setting - ' . settings - - " Format of the option that specifies the filetype and ctags arugments: - " - " ;flag1:name1;flag2:name2;flag3:name3 - " - - " Extract the file type to pass to ctags. This may be different from the - " file type detected by Vim - let pos = stridx(settings, ';') - if pos == -1 - call s:Tlist_Warning_Msg(msg) - return 0 - endif - let ctags_ftype = strpart(settings, 0, pos) - if ctags_ftype == '' - call s:Tlist_Warning_Msg(msg) - return 0 - endif - " Make sure a valid filetype is supplied. If the user didn't specify a - " valid filetype, then the ctags option settings may be treated as the - " filetype - if ctags_ftype =~ ':' - call s:Tlist_Warning_Msg(msg) - return 0 - endif - - " Remove the file type from settings - let settings = strpart(settings, pos + 1) - if settings == '' - call s:Tlist_Warning_Msg(msg) - return 0 - endif - - " Process all the specified ctags flags. The format is - " flag1:name1;flag2:name2;flag3:name3 - let ctags_flags = '' - let cnt = 0 - while settings != '' - " Extract the flag - let pos = stridx(settings, ':') - if pos == -1 - call s:Tlist_Warning_Msg(msg) - return 0 - endif - let flag = strpart(settings, 0, pos) - if flag == '' - call s:Tlist_Warning_Msg(msg) - return 0 - endif - " Remove the flag from settings - let settings = strpart(settings, pos + 1) - - " Extract the tag type name - let pos = stridx(settings, ';') - if pos == -1 - call s:Tlist_Warning_Msg(msg) - return 0 - endif - let name = strpart(settings, 0, pos) - if name == '' - call s:Tlist_Warning_Msg(msg) - return 0 - endif - let settings = strpart(settings, pos + 1) - - let cnt = cnt + 1 - - let s:tlist_{a:ftype}_{cnt}_name = flag - let s:tlist_{a:ftype}_{cnt}_fullname = name - let ctags_flags = ctags_flags . flag - endwhile - - let s:tlist_{a:ftype}_ctags_args = '--language-force=' . ctags_ftype . - \ ' --' . ctags_ftype . '-types=' . ctags_flags - let s:tlist_{a:ftype}_count = cnt - let s:tlist_{a:ftype}_ctags_flags = ctags_flags - - " Save the filetype name - let s:tlist_ftype_{s:tlist_ftype_count}_name = a:ftype - let s:tlist_ftype_count = s:tlist_ftype_count + 1 - - return 1 -endfunction - -" Tlist_Detect_Filetype -" Determine the filetype for the specified file using the filetypedetect -" autocmd. -function! s:Tlist_Detect_Filetype(fname) - " Ignore the filetype autocommands - let old_eventignore = &eventignore - set eventignore=FileType - - " Save the 'filetype', as this will be changed temporarily - let old_filetype = &filetype - - " Run the filetypedetect group of autocommands to determine - " the filetype - exe 'doautocmd filetypedetect BufRead ' . a:fname - - " Save the detected filetype - let ftype = &filetype - - " Restore the previous state - let &filetype = old_filetype - let &eventignore = old_eventignore - - return ftype -endfunction - -" Tlist_Get_Buffer_Filetype -" Get the filetype for the specified buffer -function! s:Tlist_Get_Buffer_Filetype(bnum) - let buf_ft = getbufvar(a:bnum, '&filetype') - - if bufloaded(a:bnum) - " For loaded buffers, the 'filetype' is already determined - return buf_ft - endif - - " For unloaded buffers, if the 'filetype' option is set, return it - if buf_ft != '' - return buf_ft - endif - - " Skip non-existent buffers - if !bufexists(a:bnum) - return '' - endif - - " For buffers whose filetype is not yet determined, try to determine - " the filetype - let bname = bufname(a:bnum) - - return s:Tlist_Detect_Filetype(bname) -endfunction - -" Tlist_Discard_TagInfo -" Discard the stored tag information for a file -function! s:Tlist_Discard_TagInfo(fidx) - call s:Tlist_Log_Msg('Tlist_Discard_TagInfo (' . - \ s:tlist_{a:fidx}_filename . ')') - let ftype = s:tlist_{a:fidx}_filetype - - " Discard information about the tags defined in the file - let i = 1 - while i <= s:tlist_{a:fidx}_tag_count - let fidx_i = 's:tlist_' . a:fidx . '_' . i - unlet! {fidx_i}_tag - unlet! {fidx_i}_tag_name - unlet! {fidx_i}_tag_type - unlet! {fidx_i}_ttype_idx - unlet! {fidx_i}_tag_proto - unlet! {fidx_i}_tag_searchpat - unlet! {fidx_i}_tag_linenum - let i = i + 1 - endwhile - - let s:tlist_{a:fidx}_tag_count = 0 - - " Discard information about tag type groups - let i = 1 - while i <= s:tlist_{ftype}_count - let ttype = s:tlist_{ftype}_{i}_name - if s:tlist_{a:fidx}_{ttype} != '' - let fidx_ttype = 's:tlist_' . a:fidx . '_' . ttype - let {fidx_ttype} = '' - let {fidx_ttype}_offset = 0 - let cnt = {fidx_ttype}_count - let {fidx_ttype}_count = 0 - let j = 1 - while j <= cnt - unlet! {fidx_ttype}_{j} - let j = j + 1 - endwhile - endif - let i = i + 1 - endwhile - - " Discard the stored menu command also - let s:tlist_{a:fidx}_menu_cmd = '' -endfunction - -" Tlist_Window_Update_Line_Offsets -" Update the line offsets for tags for files starting from start_idx -" and displayed in the taglist window by the specified offset -function! s:Tlist_Window_Update_Line_Offsets(start_idx, increment, offset) - let i = a:start_idx - - while i < s:tlist_file_count - if s:tlist_{i}_visible - " Update the start/end line number only if the file is visible - if a:increment - let s:tlist_{i}_start = s:tlist_{i}_start + a:offset - let s:tlist_{i}_end = s:tlist_{i}_end + a:offset - else - let s:tlist_{i}_start = s:tlist_{i}_start - a:offset - let s:tlist_{i}_end = s:tlist_{i}_end - a:offset - endif - endif - let i = i + 1 - endwhile -endfunction - -" Tlist_Discard_FileInfo -" Discard the stored information for a file -function! s:Tlist_Discard_FileInfo(fidx) - call s:Tlist_Log_Msg('Tlist_Discard_FileInfo (' . - \ s:tlist_{a:fidx}_filename . ')') - call s:Tlist_Discard_TagInfo(a:fidx) - - let ftype = s:tlist_{a:fidx}_filetype - - let i = 1 - while i <= s:tlist_{ftype}_count - let ttype = s:tlist_{ftype}_{i}_name - unlet! s:tlist_{a:fidx}_{ttype} - unlet! s:tlist_{a:fidx}_{ttype}_offset - unlet! s:tlist_{a:fidx}_{ttype}_count - let i = i + 1 - endwhile - - unlet! s:tlist_{a:fidx}_filename - unlet! s:tlist_{a:fidx}_sort_type - unlet! s:tlist_{a:fidx}_filetype - unlet! s:tlist_{a:fidx}_mtime - unlet! s:tlist_{a:fidx}_start - unlet! s:tlist_{a:fidx}_end - unlet! s:tlist_{a:fidx}_valid - unlet! s:tlist_{a:fidx}_visible - unlet! s:tlist_{a:fidx}_tag_count - unlet! s:tlist_{a:fidx}_menu_cmd -endfunction - -" Tlist_Window_Remove_File_From_Display -" Remove the specified file from display -function! s:Tlist_Window_Remove_File_From_Display(fidx) - call s:Tlist_Log_Msg('Tlist_Window_Remove_File_From_Display (' . - \ s:tlist_{a:fidx}_filename . ')') - " If the file is not visible then no need to remove it - if !s:tlist_{a:fidx}_visible - return - endif - - " Remove the tags displayed for the specified file from the window - let start = s:tlist_{a:fidx}_start - " Include the empty line after the last line also - if g:Tlist_Compact_Format - let end = s:tlist_{a:fidx}_end - else - let end = s:tlist_{a:fidx}_end + 1 - endif - - setlocal modifiable - exe 'silent! ' . start . ',' . end . 'delete _' - setlocal nomodifiable - - " Correct the start and end line offsets for all the files following - " this file, as the tags for this file are removed - call s:Tlist_Window_Update_Line_Offsets(a:fidx + 1, 0, end - start + 1) -endfunction - -" Tlist_Remove_File -" Remove the file under the cursor or the specified file index -" user_request - User requested to remove the file from taglist -function! s:Tlist_Remove_File(file_idx, user_request) - let fidx = a:file_idx - - if fidx == -1 - let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(line('.')) - if fidx == -1 - return - endif - endif - call s:Tlist_Log_Msg('Tlist_Remove_File (' . - \ s:tlist_{fidx}_filename . ', ' . a:user_request . ')') - - let save_winnr = winnr() - let winnum = bufwinnr(g:TagList_title) - if winnum != -1 - " Taglist window is open, remove the file from display - - if save_winnr != winnum - let old_eventignore = &eventignore - set eventignore=all - exe winnum . 'wincmd w' - endif - - call s:Tlist_Window_Remove_File_From_Display(fidx) - - if save_winnr != winnum - exe save_winnr . 'wincmd w' - let &eventignore = old_eventignore - endif - endif - - let fname = s:tlist_{fidx}_filename - - if a:user_request - " As the user requested to remove the file from taglist, - " add it to the removed list - call s:Tlist_Update_Remove_List(fname, 1) - endif - - " Remove the file name from the taglist list of filenames - let idx = stridx(s:tlist_file_names, fname . "\n") - let text_before = strpart(s:tlist_file_names, 0, idx) - let rem_text = strpart(s:tlist_file_names, idx) - let next_idx = stridx(rem_text, "\n") - let text_after = strpart(rem_text, next_idx + 1) - let s:tlist_file_names = text_before . text_after - - call s:Tlist_Discard_FileInfo(fidx) - - " Shift all the file variables by one index - let i = fidx + 1 - - while i < s:tlist_file_count - let j = i - 1 - - let s:tlist_{j}_filename = s:tlist_{i}_filename - let s:tlist_{j}_sort_type = s:tlist_{i}_sort_type - let s:tlist_{j}_filetype = s:tlist_{i}_filetype - let s:tlist_{j}_mtime = s:tlist_{i}_mtime - let s:tlist_{j}_start = s:tlist_{i}_start - let s:tlist_{j}_end = s:tlist_{i}_end - let s:tlist_{j}_valid = s:tlist_{i}_valid - let s:tlist_{j}_visible = s:tlist_{i}_visible - let s:tlist_{j}_tag_count = s:tlist_{i}_tag_count - let s:tlist_{j}_menu_cmd = s:tlist_{i}_menu_cmd - - let k = 1 - while k <= s:tlist_{j}_tag_count - let s:tlist_{j}_{k}_tag = s:tlist_{i}_{k}_tag - let s:tlist_{j}_{k}_tag_name = s:tlist_{i}_{k}_tag_name - let s:tlist_{j}_{k}_tag_type = s:Tlist_Get_Tag_Type_By_Tag(i, k) - let s:tlist_{j}_{k}_ttype_idx = s:tlist_{i}_{k}_ttype_idx - let s:tlist_{j}_{k}_tag_proto = s:Tlist_Get_Tag_Prototype(i, k) - let s:tlist_{j}_{k}_tag_searchpat = s:Tlist_Get_Tag_SearchPat(i, k) - let s:tlist_{j}_{k}_tag_linenum = s:Tlist_Get_Tag_Linenum(i, k) - let k = k + 1 - endwhile - - let ftype = s:tlist_{i}_filetype - - let k = 1 - while k <= s:tlist_{ftype}_count - let ttype = s:tlist_{ftype}_{k}_name - let s:tlist_{j}_{ttype} = s:tlist_{i}_{ttype} - let s:tlist_{j}_{ttype}_offset = s:tlist_{i}_{ttype}_offset - let s:tlist_{j}_{ttype}_count = s:tlist_{i}_{ttype}_count - if s:tlist_{j}_{ttype} != '' - let l = 1 - while l <= s:tlist_{j}_{ttype}_count - let s:tlist_{j}_{ttype}_{l} = s:tlist_{i}_{ttype}_{l} - let l = l + 1 - endwhile - endif - let k = k + 1 - endwhile - - " As the file and tag information is copied to the new index, - " discard the previous information - call s:Tlist_Discard_FileInfo(i) - - let i = i + 1 - endwhile - - " Reduce the number of files displayed - let s:tlist_file_count = s:tlist_file_count - 1 - - if g:Tlist_Show_One_File - " If the tags for only one file is displayed and if we just - " now removed that file, then invalidate the current file idx - if s:tlist_cur_file_idx == fidx - let s:tlist_cur_file_idx = -1 - endif - endif -endfunction - -" Tlist_Window_Goto_Window -" Goto the taglist window -function! s:Tlist_Window_Goto_Window() - let winnum = bufwinnr(g:TagList_title) - if winnum != -1 - if winnr() != winnum - call s:Tlist_Exe_Cmd_No_Acmds(winnum . 'wincmd w') - endif - endif -endfunction - -" Tlist_Window_Create -" Create a new taglist window. If it is already open, jump to it -function! s:Tlist_Window_Create() - call s:Tlist_Log_Msg('Tlist_Window_Create()') - " If the window is open, jump to it - let winnum = bufwinnr(g:TagList_title) - if winnum != -1 - " Jump to the existing window - if winnr() != winnum - exe winnum . 'wincmd w' - endif - return - endif - - " If used with winmanager don't open windows. Winmanager will handle - " the window/buffer management - if s:tlist_app_name == "winmanager" - return - endif - - " Create a new window. If user prefers a horizontal window, then open - " a horizontally split window. Otherwise open a vertically split - " window - if g:Tlist_Use_Horiz_Window - " Open a horizontally split window - let win_dir = 'botright' - " Horizontal window height - let win_size = g:Tlist_WinHeight - else - if s:tlist_winsize_chgd == -1 - " Open a vertically split window. Increase the window size, if - " needed, to accomodate the new window - if g:Tlist_Inc_Winwidth && - \ &columns < (80 + g:Tlist_WinWidth) - " Save the original window position - let s:tlist_pre_winx = getwinposx() - let s:tlist_pre_winy = getwinposy() - - " one extra column is needed to include the vertical split - let &columns= &columns + g:Tlist_WinWidth + 1 - - let s:tlist_winsize_chgd = 1 - else - let s:tlist_winsize_chgd = 0 - endif - endif - - if g:Tlist_Use_Right_Window - " Open the window at the rightmost place - let win_dir = 'botright vertical' - else - " Open the window at the leftmost place - let win_dir = 'topleft vertical' - endif - let win_size = g:Tlist_WinWidth - endif - - " If the tag listing temporary buffer already exists, then reuse it. - " Otherwise create a new buffer - let bufnum = bufnr(g:TagList_title) - if bufnum == -1 - " Create a new buffer - let wcmd = g:TagList_title - else - " Edit the existing buffer - let wcmd = '+buffer' . bufnum - endif - - " Create the taglist window - exe 'silent! ' . win_dir . ' ' . win_size . 'split ' . wcmd - - " Save the new window position - let s:tlist_winx = getwinposx() - let s:tlist_winy = getwinposy() - - " Initialize the taglist window - call s:Tlist_Window_Init() -endfunction - -" Tlist_Window_Zoom -" Zoom (maximize/minimize) the taglist window -function! s:Tlist_Window_Zoom() - if s:tlist_win_maximized - " Restore the window back to the previous size - if g:Tlist_Use_Horiz_Window - exe 'resize ' . g:Tlist_WinHeight - else - exe 'vert resize ' . g:Tlist_WinWidth - endif - let s:tlist_win_maximized = 0 - else - " Set the window size to the maximum possible without closing other - " windows - if g:Tlist_Use_Horiz_Window - resize - else - vert resize - endif - let s:tlist_win_maximized = 1 - endif -endfunction - -" Tlist_Ballon_Expr -" When the mouse cursor is over a tag in the taglist window, display the -" tag prototype (balloon) -function! Tlist_Ballon_Expr() - " Get the file index - let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(v:beval_lnum) - if fidx == -1 - return '' - endif - - " Get the tag output line for the current tag - let tidx = s:Tlist_Window_Get_Tag_Index(fidx, v:beval_lnum) - if tidx == 0 - return '' - endif - - " Get the tag search pattern and display it - return s:Tlist_Get_Tag_Prototype(fidx, tidx) -endfunction - -" Tlist_Window_Check_Width -" Check the width of the taglist window. For horizontally split windows, the -" 'winfixheight' option is used to fix the height of the window. For -" vertically split windows, Vim doesn't support the 'winfixwidth' option. So -" need to handle window width changes from this function. -function! s:Tlist_Window_Check_Width() - let tlist_winnr = bufwinnr(g:TagList_title) - if tlist_winnr == -1 - return - endif - - let width = winwidth(tlist_winnr) - if width != g:Tlist_WinWidth - call s:Tlist_Log_Msg("Tlist_Window_Check_Width: Changing window " . - \ "width from " . width . " to " . g:Tlist_WinWidth) - let save_winnr = winnr() - if save_winnr != tlist_winnr - call s:Tlist_Exe_Cmd_No_Acmds(tlist_winnr . 'wincmd w') - endif - exe 'vert resize ' . g:Tlist_WinWidth - if save_winnr != tlist_winnr - call s:Tlist_Exe_Cmd_No_Acmds('wincmd p') - endif - endif -endfunction - -" Tlist_Window_Exit_Only_Window -" If the 'Tlist_Exit_OnlyWindow' option is set, then exit Vim if only the -" taglist window is present. -function! s:Tlist_Window_Exit_Only_Window() - " Before quitting Vim, delete the taglist buffer so that - " the '0 mark is correctly set to the previous buffer. - if v:version < 700 - if winbufnr(2) == -1 - bdelete - quit - endif - else - if winbufnr(2) == -1 - if tabpagenr('$') == 1 - " Only one tag page is present - bdelete - quit - else - " More than one tab page is present. Close only the current - " tab page - close - endif - endif - endif -endfunction - -" Tlist_Window_Init -" Set the default options for the taglist window -function! s:Tlist_Window_Init() - call s:Tlist_Log_Msg('Tlist_Window_Init()') - - " The 'readonly' option should not be set for the taglist buffer. - " If Vim is started as "view/gview" or if the ":view" command is - " used, then the 'readonly' option is set for all the buffers. - " Unset it for the taglist buffer - setlocal noreadonly - - " Set the taglist buffer filetype to taglist - setlocal filetype=taglist - - " Define taglist window element highlighting - syntax match TagListComment '^" .*' - syntax match TagListFileName '^[^" ].*$' - syntax match TagListTitle '^ \S.*$' - syntax match TagListTagScope '\s\[.\{-\}\]$' - - " Define the highlighting only if colors are supported - if has('gui_running') || &t_Co > 2 - " Colors to highlight various taglist window elements - " If user defined highlighting group exists, then use them. - " Otherwise, use default highlight groups. - if hlexists('MyTagListTagName') - highlight link TagListTagName MyTagListTagName - else - highlight default link TagListTagName Search - endif - " Colors to highlight comments and titles - if hlexists('MyTagListComment') - highlight link TagListComment MyTagListComment - else - highlight clear TagListComment - highlight default link TagListComment Comment - endif - if hlexists('MyTagListTitle') - highlight link TagListTitle MyTagListTitle - else - highlight clear TagListTitle - highlight default link TagListTitle Title - endif - if hlexists('MyTagListFileName') - highlight link TagListFileName MyTagListFileName - else - highlight clear TagListFileName - highlight default TagListFileName guibg=Grey ctermbg=darkgray - \ guifg=white ctermfg=white - endif - if hlexists('MyTagListTagScope') - highlight link TagListTagScope MyTagListTagScope - else - highlight clear TagListTagScope - highlight default link TagListTagScope Identifier - endif - else - highlight default TagListTagName term=reverse cterm=reverse - endif - - " Folding related settings - setlocal foldenable - setlocal foldminlines=0 - setlocal foldmethod=manual - setlocal foldlevel=9999 - if g:Tlist_Enable_Fold_Column - setlocal foldcolumn=3 - else - setlocal foldcolumn=0 - endif - setlocal foldtext=v:folddashes.getline(v:foldstart) - - if s:tlist_app_name != "winmanager" - " Mark buffer as scratch - silent! setlocal buftype=nofile - if s:tlist_app_name == "none" - silent! setlocal bufhidden=delete - endif - silent! setlocal noswapfile - " Due to a bug in Vim 6.0, the winbufnr() function fails for unlisted - " buffers. So if the taglist buffer is unlisted, multiple taglist - " windows will be opened. This bug is fixed in Vim 6.1 and above - if v:version >= 601 - silent! setlocal nobuflisted - endif - endif - - silent! setlocal nowrap - - " If the 'number' option is set in the source window, it will affect the - " taglist window. So forcefully disable 'number' option for the taglist - " window - silent! setlocal nonumber - - " Use fixed height when horizontally split window is used - if g:Tlist_Use_Horiz_Window - if v:version >= 602 - set winfixheight - endif - endif - if !g:Tlist_Use_Horiz_Window && v:version >= 700 - set winfixwidth - endif - - " Setup balloon evaluation to display tag prototype - if v:version >= 700 && has('balloon_eval') - setlocal balloonexpr=Tlist_Ballon_Expr() - set ballooneval - endif - - " Setup the cpoptions properly for the maps to work - let old_cpoptions = &cpoptions - set cpoptions&vim - - " Create buffer local mappings for jumping to the tags and sorting the list - nnoremap - \ :call Tlist_Window_Jump_To_Tag('useopen') - nnoremap o - \ :call Tlist_Window_Jump_To_Tag('newwin') - nnoremap p - \ :call Tlist_Window_Jump_To_Tag('preview') - nnoremap P - \ :call Tlist_Window_Jump_To_Tag('prevwin') - if v:version >= 700 - nnoremap t - \ :call Tlist_Window_Jump_To_Tag('checktab') - nnoremap - \ :call Tlist_Window_Jump_To_Tag('newtab') - endif - nnoremap <2-LeftMouse> - \ :call Tlist_Window_Jump_To_Tag('useopen') - nnoremap s - \ :call Tlist_Change_Sort('cmd', 'toggle', '') - nnoremap + :silent! foldopen - nnoremap - :silent! foldclose - nnoremap * :silent! %foldopen! - nnoremap = :silent! %foldclose - nnoremap :silent! foldopen - nnoremap :silent! foldclose - nnoremap :silent! %foldopen! - nnoremap :call Tlist_Window_Show_Info() - nnoremap u :call Tlist_Window_Update_File() - nnoremap d :call Tlist_Remove_File(-1, 1) - nnoremap x :call Tlist_Window_Zoom() - nnoremap [[ :call Tlist_Window_Move_To_File(-1) - nnoremap :call Tlist_Window_Move_To_File(-1) - nnoremap ]] :call Tlist_Window_Move_To_File(1) - nnoremap :call Tlist_Window_Move_To_File(1) - nnoremap :call Tlist_Window_Toggle_Help_Text() - nnoremap q :close - - " Insert mode mappings - inoremap - \ :call Tlist_Window_Jump_To_Tag('useopen') - " Windows needs return - inoremap - \ :call Tlist_Window_Jump_To_Tag('useopen') - inoremap o - \ :call Tlist_Window_Jump_To_Tag('newwin') - inoremap p - \ :call Tlist_Window_Jump_To_Tag('preview') - inoremap P - \ :call Tlist_Window_Jump_To_Tag('prevwin') - if v:version >= 700 - inoremap t - \ :call Tlist_Window_Jump_To_Tag('checktab') - inoremap - \ :call Tlist_Window_Jump_To_Tag('newtab') - endif - inoremap <2-LeftMouse> - \ :call Tlist_Window_Jump_To_Tag('useopen') - inoremap s - \ :call Tlist_Change_Sort('cmd', 'toggle', '') - inoremap + :silent! foldopen - inoremap - :silent! foldclose - inoremap * :silent! %foldopen! - inoremap = :silent! %foldclose - inoremap :silent! foldopen - inoremap :silent! foldclose - inoremap :silent! %foldopen! - inoremap :call - \ Tlist_Window_Show_Info() - inoremap u - \ :call Tlist_Window_Update_File() - inoremap d :call Tlist_Remove_File(-1, 1) - inoremap x :call Tlist_Window_Zoom() - inoremap [[ :call Tlist_Window_Move_To_File(-1) - inoremap :call Tlist_Window_Move_To_File(-1) - inoremap ]] :call Tlist_Window_Move_To_File(1) - inoremap :call Tlist_Window_Move_To_File(1) - inoremap :call Tlist_Window_Toggle_Help_Text() - inoremap q :close - - " Map single left mouse click if the user wants this functionality - if g:Tlist_Use_SingleClick == 1 - " Contributed by Bindu Wavell - " attempt to perform single click mapping, it would be much - " nicer if we could nnoremap ... however vim does - " not fire the when you use the mouse - " to enter a buffer. - let clickmap = ':if bufname("%") =~ "__Tag_List__" ' . - \ 'call Tlist_Window_Jump_To_Tag("useopen") ' . - \ ' endif ' - if maparg('', 'n') == '' - " no mapping for leftmouse - exe ':nnoremap ' . clickmap - else - " we have a mapping - let mapcmd = ':nnoremap ' - let mapcmd = mapcmd . substitute(substitute( - \ maparg('', 'n'), '|', '', 'g'), - \ '\c^', '', '') - let mapcmd = mapcmd . clickmap - exe mapcmd - endif - endif - - " Define the taglist autocommands - augroup TagListAutoCmds - autocmd! - " Display the tag prototype for the tag under the cursor. - autocmd CursorHold __Tag_List__ call s:Tlist_Window_Show_Info() - " Highlight the current tag periodically - autocmd CursorHold * silent call s:Tlist_Window_Highlight_Tag( - \ fnamemodify(bufname('%'), ':p'), line('.'), 1, 0) - - " Adjust the Vim window width when taglist window is closed - autocmd BufUnload __Tag_List__ call s:Tlist_Post_Close_Cleanup() - " Close the fold for this buffer when leaving the buffer - if g:Tlist_File_Fold_Auto_Close - autocmd BufEnter * silent - \ call s:Tlist_Window_Open_File_Fold(expand('')) - endif - " Exit Vim itself if only the taglist window is present (optional) - if g:Tlist_Exit_OnlyWindow - autocmd BufEnter __Tag_List__ nested - \ call s:Tlist_Window_Exit_Only_Window() - endif - if s:tlist_app_name != "winmanager" && - \ !g:Tlist_Process_File_Always && - \ (!has('gui_running') || !g:Tlist_Show_Menu) - " Auto refresh the taglist window - autocmd BufEnter * call s:Tlist_Refresh() - endif - - if !g:Tlist_Use_Horiz_Window - if v:version < 700 - autocmd WinEnter * call s:Tlist_Window_Check_Width() - endif - endif - if v:version >= 700 - autocmd TabEnter * silent call s:Tlist_Refresh_Folds() - endif - augroup end - - " Restore the previous cpoptions settings - let &cpoptions = old_cpoptions -endfunction - -" Tlist_Window_Refresh -" Display the tags for all the files in the taglist window -function! s:Tlist_Window_Refresh() - call s:Tlist_Log_Msg('Tlist_Window_Refresh()') - " Set report option to a huge value to prevent informational messages - " while deleting the lines - let old_report = &report - set report=99999 - - " Mark the buffer as modifiable - setlocal modifiable - - " Delete the contents of the buffer to the black-hole register - silent! %delete _ - - " As we have cleared the taglist window, mark all the files - " as not visible - let i = 0 - while i < s:tlist_file_count - let s:tlist_{i}_visible = 0 - let i = i + 1 - endwhile - - if g:Tlist_Compact_Format == 0 - " Display help in non-compact mode - call s:Tlist_Window_Display_Help() - endif - - " Mark the buffer as not modifiable - setlocal nomodifiable - - " Restore the report option - let &report = old_report - - " If the tags for only one file should be displayed in the taglist - " window, then no need to add the tags here. The bufenter autocommand - " will add the tags for that file. - if g:Tlist_Show_One_File - return - endif - - " List all the tags for the previously processed files - " Do this only if taglist is configured to display tags for more than - " one file. Otherwise, when Tlist_Show_One_File is configured, - " tags for the wrong file will be displayed. - let i = 0 - while i < s:tlist_file_count - call s:Tlist_Window_Refresh_File(s:tlist_{i}_filename, - \ s:tlist_{i}_filetype) - let i = i + 1 - endwhile - - if g:Tlist_Auto_Update - " Add and list the tags for all buffers in the Vim buffer list - let i = 1 - let last_bufnum = bufnr('$') - while i <= last_bufnum - if buflisted(i) - let fname = fnamemodify(bufname(i), ':p') - let ftype = s:Tlist_Get_Buffer_Filetype(i) - " If the file doesn't support tag listing, skip it - if !s:Tlist_Skip_File(fname, ftype) - call s:Tlist_Window_Refresh_File(fname, ftype) - endif - endif - let i = i + 1 - endwhile - endif - - " If Tlist_File_Fold_Auto_Close option is set, then close all the folds - if g:Tlist_File_Fold_Auto_Close - " Close all the folds - silent! %foldclose - endif - - " Move the cursor to the top of the taglist window - normal! gg -endfunction - -" Tlist_Post_Close_Cleanup() -" Close the taglist window and adjust the Vim window width -function! s:Tlist_Post_Close_Cleanup() - call s:Tlist_Log_Msg('Tlist_Post_Close_Cleanup()') - " Mark all the files as not visible - let i = 0 - while i < s:tlist_file_count - let s:tlist_{i}_visible = 0 - let i = i + 1 - endwhile - - " Remove the taglist autocommands - silent! autocmd! TagListAutoCmds - - " Clear all the highlights - match none - - silent! syntax clear TagListTitle - silent! syntax clear TagListComment - silent! syntax clear TagListTagScope - - " Remove the left mouse click mapping if it was setup initially - if g:Tlist_Use_SingleClick - if hasmapto('') - nunmap - endif - endif - - if s:tlist_app_name != "winmanager" - if g:Tlist_Use_Horiz_Window || g:Tlist_Inc_Winwidth == 0 || - \ s:tlist_winsize_chgd != 1 || - \ &columns < (80 + g:Tlist_WinWidth) - " No need to adjust window width if using horizontally split taglist - " window or if columns is less than 101 or if the user chose not to - " adjust the window width - else - " If the user didn't manually move the window, then restore the window - " position to the pre-taglist position - if s:tlist_pre_winx != -1 && s:tlist_pre_winy != -1 && - \ getwinposx() == s:tlist_winx && - \ getwinposy() == s:tlist_winy - exe 'winpos ' . s:tlist_pre_winx . ' ' . s:tlist_pre_winy - endif - - " Adjust the Vim window width - let &columns= &columns - (g:Tlist_WinWidth + 1) - endif - endif - - let s:tlist_winsize_chgd = -1 - - " Reset taglist state variables - if s:tlist_app_name == "winmanager" - let s:tlist_app_name = "none" - endif - let s:tlist_window_initialized = 0 -endfunction - -" Tlist_Window_Refresh_File() -" List the tags defined in the specified file in a Vim window -function! s:Tlist_Window_Refresh_File(filename, ftype) - call s:Tlist_Log_Msg('Tlist_Window_Refresh_File (' . a:filename . ')') - " First check whether the file already exists - let fidx = s:Tlist_Get_File_Index(a:filename) - if fidx != -1 - let file_listed = 1 - else - let file_listed = 0 - endif - - if !file_listed - " Check whether this file is removed based on user request - " If it is, then don't display the tags for this file - if s:Tlist_User_Removed_File(a:filename) - return - endif - endif - - if file_listed && s:tlist_{fidx}_visible - " Check whether the file tags are currently valid - if s:tlist_{fidx}_valid - " Goto the first line in the file - exe s:tlist_{fidx}_start - - " If the line is inside a fold, open the fold - if foldclosed('.') != -1 - exe "silent! " . s:tlist_{fidx}_start . "," . - \ s:tlist_{fidx}_end . "foldopen!" - endif - return - endif - - " Discard and remove the tags for this file from display - call s:Tlist_Discard_TagInfo(fidx) - call s:Tlist_Window_Remove_File_From_Display(fidx) - endif - - " Process and generate a list of tags defined in the file - if !file_listed || !s:tlist_{fidx}_valid - let ret_fidx = s:Tlist_Process_File(a:filename, a:ftype) - if ret_fidx == -1 - return - endif - let fidx = ret_fidx - endif - - " Set report option to a huge value to prevent informational messages - " while adding lines to the taglist window - let old_report = &report - set report=99999 - - if g:Tlist_Show_One_File - " Remove the previous file - if s:tlist_cur_file_idx != -1 - call s:Tlist_Window_Remove_File_From_Display(s:tlist_cur_file_idx) - let s:tlist_{s:tlist_cur_file_idx}_visible = 0 - let s:tlist_{s:tlist_cur_file_idx}_start = 0 - let s:tlist_{s:tlist_cur_file_idx}_end = 0 - endif - let s:tlist_cur_file_idx = fidx - endif - - " Mark the buffer as modifiable - setlocal modifiable - - " Add new files to the end of the window. For existing files, add them at - " the same line where they were previously present. If the file is not - " visible, then add it at the end - if s:tlist_{fidx}_start == 0 || !s:tlist_{fidx}_visible - if g:Tlist_Compact_Format - let s:tlist_{fidx}_start = line('$') - else - let s:tlist_{fidx}_start = line('$') + 1 - endif - endif - - let s:tlist_{fidx}_visible = 1 - - " Goto the line where this file should be placed - if g:Tlist_Compact_Format - exe s:tlist_{fidx}_start - else - exe s:tlist_{fidx}_start - 1 - endif - - let txt = fnamemodify(s:tlist_{fidx}_filename, ':t') . ' (' . - \ fnamemodify(s:tlist_{fidx}_filename, ':p:h') . ')' - if g:Tlist_Compact_Format == 0 - silent! put =txt - else - silent! put! =txt - " Move to the next line - exe line('.') + 1 - endif - let file_start = s:tlist_{fidx}_start - - " Add the tag names grouped by tag type to the buffer with a title - let i = 1 - let ttype_cnt = s:tlist_{a:ftype}_count - while i <= ttype_cnt - let ttype = s:tlist_{a:ftype}_{i}_name - " Add the tag type only if there are tags for that type - let fidx_ttype = 's:tlist_' . fidx . '_' . ttype - let ttype_txt = {fidx_ttype} - if ttype_txt != '' - let txt = ' ' . s:tlist_{a:ftype}_{i}_fullname - if g:Tlist_Compact_Format == 0 - let ttype_start_lnum = line('.') + 1 - silent! put =txt - else - let ttype_start_lnum = line('.') - silent! put! =txt - endif - silent! put =ttype_txt - - let {fidx_ttype}_offset = ttype_start_lnum - file_start - - " create a fold for this tag type - let fold_start = ttype_start_lnum - let fold_end = fold_start + {fidx_ttype}_count - exe fold_start . ',' . fold_end . 'fold' - - " Adjust the cursor position - if g:Tlist_Compact_Format == 0 - exe ttype_start_lnum + {fidx_ttype}_count - else - exe ttype_start_lnum + {fidx_ttype}_count + 1 - endif - - if g:Tlist_Compact_Format == 0 - " Separate the tag types by a empty line - silent! put ='' - endif - endif - let i = i + 1 - endwhile - - if s:tlist_{fidx}_tag_count == 0 - if g:Tlist_Compact_Format == 0 - silent! put ='' - endif - endif - - let s:tlist_{fidx}_end = line('.') - 1 - - " Create a fold for the entire file - exe s:tlist_{fidx}_start . ',' . s:tlist_{fidx}_end . 'fold' - exe 'silent! ' . s:tlist_{fidx}_start . ',' . - \ s:tlist_{fidx}_end . 'foldopen!' - - " Goto the starting line for this file, - exe s:tlist_{fidx}_start - - if s:tlist_app_name == "winmanager" - " To handle a bug in the winmanager plugin, add a space at the - " last line - call setline('$', ' ') - endif - - " Mark the buffer as not modifiable - setlocal nomodifiable - - " Restore the report option - let &report = old_report - - " Update the start and end line numbers for all the files following this - " file - let start = s:tlist_{fidx}_start - " include the empty line after the last line - if g:Tlist_Compact_Format - let end = s:tlist_{fidx}_end - else - let end = s:tlist_{fidx}_end + 1 - endif - call s:Tlist_Window_Update_Line_Offsets(fidx + 1, 1, end - start + 1) - - " Now that we have updated the taglist window, update the tags - " menu (if present) - if g:Tlist_Show_Menu - call s:Tlist_Menu_Update_File(1) - endif -endfunction - -" Tlist_Init_File -" Initialize the variables for a new file -function! s:Tlist_Init_File(filename, ftype) - call s:Tlist_Log_Msg('Tlist_Init_File (' . a:filename . ')') - " Add new files at the end of the list - let fidx = s:tlist_file_count - let s:tlist_file_count = s:tlist_file_count + 1 - " Add the new file name to the taglist list of file names - let s:tlist_file_names = s:tlist_file_names . a:filename . "\n" - - " Initialize the file variables - let s:tlist_{fidx}_filename = a:filename - let s:tlist_{fidx}_sort_type = g:Tlist_Sort_Type - let s:tlist_{fidx}_filetype = a:ftype - let s:tlist_{fidx}_mtime = -1 - let s:tlist_{fidx}_start = 0 - let s:tlist_{fidx}_end = 0 - let s:tlist_{fidx}_valid = 0 - let s:tlist_{fidx}_visible = 0 - let s:tlist_{fidx}_tag_count = 0 - let s:tlist_{fidx}_menu_cmd = '' - - " Initialize the tag type variables - let i = 1 - while i <= s:tlist_{a:ftype}_count - let ttype = s:tlist_{a:ftype}_{i}_name - let s:tlist_{fidx}_{ttype} = '' - let s:tlist_{fidx}_{ttype}_offset = 0 - let s:tlist_{fidx}_{ttype}_count = 0 - let i = i + 1 - endwhile - - return fidx -endfunction - -" Tlist_Get_Tag_Type_By_Tag -" Return the tag type for the specified tag index -function! s:Tlist_Get_Tag_Type_By_Tag(fidx, tidx) - let ttype_var = 's:tlist_' . a:fidx . '_' . a:tidx . '_tag_type' - - " Already parsed and have the tag name - if exists(ttype_var) - return {ttype_var} - endif - - let tag_line = s:tlist_{a:fidx}_{a:tidx}_tag - let {ttype_var} = s:Tlist_Extract_Tagtype(tag_line) - - return {ttype_var} -endfunction - -" Tlist_Get_Tag_Prototype -function! s:Tlist_Get_Tag_Prototype(fidx, tidx) - let tproto_var = 's:tlist_' . a:fidx . '_' . a:tidx . '_tag_proto' - - " Already parsed and have the tag prototype - if exists(tproto_var) - return {tproto_var} - endif - - " Parse and extract the tag prototype - let tag_line = s:tlist_{a:fidx}_{a:tidx}_tag - let start = stridx(tag_line, '/^') + 2 - let end = stridx(tag_line, '/;"' . "\t") - if tag_line[end - 1] == '$' - let end = end -1 - endif - let tag_proto = strpart(tag_line, start, end - start) - let {tproto_var} = substitute(tag_proto, '\s*', '', '') - - return {tproto_var} -endfunction - -" Tlist_Get_Tag_SearchPat -function! s:Tlist_Get_Tag_SearchPat(fidx, tidx) - let tpat_var = 's:tlist_' . a:fidx . '_' . a:tidx . '_tag_searchpat' - - " Already parsed and have the tag search pattern - if exists(tpat_var) - return {tpat_var} - endif - - " Parse and extract the tag search pattern - let tag_line = s:tlist_{a:fidx}_{a:tidx}_tag - let start = stridx(tag_line, '/^') + 2 - let end = stridx(tag_line, '/;"' . "\t") - if tag_line[end - 1] == '$' - let end = end -1 - endif - let {tpat_var} = '\V\^' . strpart(tag_line, start, end - start) . - \ (tag_line[end] == '$' ? '\$' : '') - - return {tpat_var} -endfunction - -" Tlist_Get_Tag_Linenum -" Return the tag line number, given the tag index -function! s:Tlist_Get_Tag_Linenum(fidx, tidx) - let tline_var = 's:tlist_' . a:fidx . '_' . a:tidx . '_tag_linenum' - - " Already parsed and have the tag line number - if exists(tline_var) - return {tline_var} - endif - - " Parse and extract the tag line number - let tag_line = s:tlist_{a:fidx}_{a:tidx}_tag - let start = strridx(tag_line, 'line:') + 5 - let end = strridx(tag_line, "\t") - if end < start - let {tline_var} = strpart(tag_line, start) + 0 - else - let {tline_var} = strpart(tag_line, start, end - start) + 0 - endif - - return {tline_var} -endfunction - -" Tlist_Parse_Tagline -" Parse a tag line from the ctags output. Separate the tag output based on the -" tag type and store it in the tag type variable. -" The format of each line in the ctags output is: -" -" tag_namefile_nameex_cmd;"extension_fields -" -function! s:Tlist_Parse_Tagline(tag_line) - if a:tag_line == '' - " Skip empty lines - return - endif - - " Extract the tag type - let ttype = s:Tlist_Extract_Tagtype(a:tag_line) - - " Make sure the tag type is a valid and supported one - if ttype == '' || stridx(s:ctags_flags, ttype) == -1 - " Line is not in proper tags format or Tag type is not supported - return - endif - - " Update the total tag count - let s:tidx = s:tidx + 1 - - " The following variables are used to optimize this code. Vim is slow in - " using curly brace names. To reduce the amount of processing needed, the - " curly brace variables are pre-processed here - let fidx_tidx = 's:tlist_' . s:fidx . '_' . s:tidx - let fidx_ttype = 's:tlist_' . s:fidx . '_' . ttype - - " Update the count of this tag type - let ttype_idx = {fidx_ttype}_count + 1 - let {fidx_ttype}_count = ttype_idx - - " Store the ctags output for this tag - let {fidx_tidx}_tag = a:tag_line - - " Store the tag index and the tag type index (back pointers) - let {fidx_ttype}_{ttype_idx} = s:tidx - let {fidx_tidx}_ttype_idx = ttype_idx - - " Extract the tag name - let tag_name = strpart(a:tag_line, 0, stridx(a:tag_line, "\t")) - - " Extract the tag scope/prototype - if g:Tlist_Display_Prototype - let ttxt = ' ' . s:Tlist_Get_Tag_Prototype(s:fidx, s:tidx) - else - let ttxt = ' ' . tag_name - - " Add the tag scope, if it is available and is configured. Tag - " scope is the last field after the 'line:\t' field - if g:Tlist_Display_Tag_Scope - let tag_scope = s:Tlist_Extract_Tag_Scope(a:tag_line) - if tag_scope != '' - let ttxt = ttxt . ' [' . tag_scope . ']' - endif - endif - endif - - " Add this tag to the tag type variable - let {fidx_ttype} = {fidx_ttype} . ttxt . "\n" - - " Save the tag name - let {fidx_tidx}_tag_name = tag_name -endfunction - -" Tlist_Process_File -" Get the list of tags defined in the specified file and store them -" in Vim variables. Returns the file index where the tags are stored. -function! s:Tlist_Process_File(filename, ftype) - call s:Tlist_Log_Msg('Tlist_Process_File (' . a:filename . ', ' . - \ a:ftype . ')') - " Check whether this file is supported - if s:Tlist_Skip_File(a:filename, a:ftype) - return -1 - endif - - " If the tag types for this filetype are not yet created, then create - " them now - let var = 's:tlist_' . a:ftype . '_count' - if !exists(var) - if s:Tlist_FileType_Init(a:ftype) == 0 - return -1 - endif - endif - - " If this file is already processed, then use the cached values - let fidx = s:Tlist_Get_File_Index(a:filename) - if fidx == -1 - " First time, this file is loaded - let fidx = s:Tlist_Init_File(a:filename, a:ftype) - else - " File was previously processed. Discard the tag information - call s:Tlist_Discard_TagInfo(fidx) - endif - - let s:tlist_{fidx}_valid = 1 - - " Exuberant ctags arguments to generate a tag list - let ctags_args = ' -f - --format=2 --excmd=pattern --fields=nks ' - - " Form the ctags argument depending on the sort type - if s:tlist_{fidx}_sort_type == 'name' - let ctags_args = ctags_args . '--sort=yes' - else - let ctags_args = ctags_args . '--sort=no' - endif - - " Add the filetype specific arguments - let ctags_args = ctags_args . ' ' . s:tlist_{a:ftype}_ctags_args - - " Ctags command to produce output with regexp for locating the tags - let ctags_cmd = g:Tlist_Ctags_Cmd . ctags_args - let ctags_cmd = ctags_cmd . ' "' . a:filename . '"' - - if &shellxquote == '"' - " Double-quotes within double-quotes will not work in the - " command-line.If the 'shellxquote' option is set to double-quotes, - " then escape the double-quotes in the ctags command-line. - let ctags_cmd = escape(ctags_cmd, '"') - endif - - " In Windows 95, if not using cygwin, disable the 'shellslash' - " option. Otherwise, this will cause problems when running the - " ctags command. - if has('win95') && !has('win32unix') - let old_shellslash = &shellslash - set noshellslash - endif - - if has('win32') && !has('win32unix') && !has('win95') - \ && (&shell =~ 'cmd.exe') - " Windows does not correctly deal with commands that have more than 1 - " set of double quotes. It will strip them all resulting in: - " 'C:\Program' is not recognized as an internal or external command - " operable program or batch file. To work around this, place the - " command inside a batch file and call the batch file. - " Do this only on Win2K, WinXP and above. - " Contributed by: David Fishburn. - let s:taglist_tempfile = fnamemodify(tempname(), ':h') . - \ '\taglist.cmd' - exe 'redir! > ' . s:taglist_tempfile - silent echo ctags_cmd - redir END - - call s:Tlist_Log_Msg('Cmd inside batch file: ' . ctags_cmd) - let ctags_cmd = '"' . s:taglist_tempfile . '"' - endif - - call s:Tlist_Log_Msg('Cmd: ' . ctags_cmd) - - " Run ctags and get the tag list - let cmd_output = system(ctags_cmd) - - " Restore the value of the 'shellslash' option. - if has('win95') && !has('win32unix') - let &shellslash = old_shellslash - endif - - if exists('s:taglist_tempfile') - " Delete the temporary cmd file created on MS-Windows - call delete(s:taglist_tempfile) - endif - - " Handle errors - if v:shell_error - let msg = "Taglist: Failed to generate tags for " . a:filename - call s:Tlist_Warning_Msg(msg) - if cmd_output != '' - call s:Tlist_Warning_Msg(cmd_output) - endif - return fidx - endif - - " Store the modification time for the file - let s:tlist_{fidx}_mtime = getftime(a:filename) - - " No tags for current file - if cmd_output == '' - call s:Tlist_Log_Msg('No tags defined in ' . a:filename) - return fidx - endif - - call s:Tlist_Log_Msg('Generated tags information for ' . a:filename) - - if v:version > 601 - " The following script local variables are used by the - " Tlist_Parse_Tagline() function. - let s:ctags_flags = s:tlist_{a:ftype}_ctags_flags - let s:fidx = fidx - let s:tidx = 0 - - " Process the ctags output one line at a time. The substitute() - " command is used to parse the tag lines instead of using the - " matchstr()/stridx()/strpart() functions for performance reason - call substitute(cmd_output, "\\([^\n]\\+\\)\n", - \ '\=s:Tlist_Parse_Tagline(submatch(1))', 'g') - - " Save the number of tags for this file - let s:tlist_{fidx}_tag_count = s:tidx - - " The following script local variables are no longer needed - unlet! s:ctags_flags - unlet! s:tidx - unlet! s:fidx - else - " Due to a bug in Vim earlier than version 6.1, - " we cannot use substitute() to parse the ctags output. - " Instead the slow str*() functions are used - let ctags_flags = s:tlist_{a:ftype}_ctags_flags - let tidx = 0 - - while cmd_output != '' - " Extract one line at a time - let idx = stridx(cmd_output, "\n") - let one_line = strpart(cmd_output, 0, idx) - " Remove the line from the tags output - let cmd_output = strpart(cmd_output, idx + 1) - - if one_line == '' - " Line is not in proper tags format - continue - endif - - " Extract the tag type - let ttype = s:Tlist_Extract_Tagtype(one_line) - - " Make sure the tag type is a valid and supported one - if ttype == '' || stridx(ctags_flags, ttype) == -1 - " Line is not in proper tags format or Tag type is not - " supported - continue - endif - - " Update the total tag count - let tidx = tidx + 1 - - " The following variables are used to optimize this code. Vim is - " slow in using curly brace names. To reduce the amount of - " processing needed, the curly brace variables are pre-processed - " here - let fidx_tidx = 's:tlist_' . fidx . '_' . tidx - let fidx_ttype = 's:tlist_' . fidx . '_' . ttype - - " Update the count of this tag type - let ttype_idx = {fidx_ttype}_count + 1 - let {fidx_ttype}_count = ttype_idx - - " Store the ctags output for this tag - let {fidx_tidx}_tag = one_line - - " Store the tag index and the tag type index (back pointers) - let {fidx_ttype}_{ttype_idx} = tidx - let {fidx_tidx}_ttype_idx = ttype_idx - - " Extract the tag name - let tag_name = strpart(one_line, 0, stridx(one_line, "\t")) - - " Extract the tag scope/prototype - if g:Tlist_Display_Prototype - let ttxt = ' ' . s:Tlist_Get_Tag_Prototype(fidx, tidx) - else - let ttxt = ' ' . tag_name - - " Add the tag scope, if it is available and is configured. Tag - " scope is the last field after the 'line:\t' field - if g:Tlist_Display_Tag_Scope - let tag_scope = s:Tlist_Extract_Tag_Scope(one_line) - if tag_scope != '' - let ttxt = ttxt . ' [' . tag_scope . ']' - endif - endif - endif - - " Add this tag to the tag type variable - let {fidx_ttype} = {fidx_ttype} . ttxt . "\n" - - " Save the tag name - let {fidx_tidx}_tag_name = tag_name - endwhile - - " Save the number of tags for this file - let s:tlist_{fidx}_tag_count = tidx - endif - - call s:Tlist_Log_Msg('Processed ' . s:tlist_{fidx}_tag_count . - \ ' tags in ' . a:filename) - - return fidx -endfunction - -" Tlist_Update_File -" Update the tags for a file (if needed) -function! Tlist_Update_File(filename, ftype) - call s:Tlist_Log_Msg('Tlist_Update_File (' . a:filename . ')') - " If the file doesn't support tag listing, skip it - if s:Tlist_Skip_File(a:filename, a:ftype) - return - endif - - " Convert the file name to a full path - let fname = fnamemodify(a:filename, ':p') - - " First check whether the file already exists - let fidx = s:Tlist_Get_File_Index(fname) - - if fidx != -1 && s:tlist_{fidx}_valid - " File exists and the tags are valid - " Check whether the file was modified after the last tags update - " If it is modified, then update the tags - if s:tlist_{fidx}_mtime == getftime(fname) - return - endif - else - " If the tags were removed previously based on a user request, - " as we are going to update the tags (based on the user request), - " remove the filename from the deleted list - call s:Tlist_Update_Remove_List(fname, 0) - endif - - " If the taglist window is opened, update it - let winnum = bufwinnr(g:TagList_title) - if winnum == -1 - " Taglist window is not present. Just update the taglist - " and return - call s:Tlist_Process_File(fname, a:ftype) - else - if g:Tlist_Show_One_File && s:tlist_cur_file_idx != -1 - " If tags for only one file are displayed and we are not - " updating the tags for that file, then no need to - " refresh the taglist window. Otherwise, the taglist - " window should be updated. - if s:tlist_{s:tlist_cur_file_idx}_filename != fname - call s:Tlist_Process_File(fname, a:ftype) - return - endif - endif - - " Save the current window number - let save_winnr = winnr() - - " Goto the taglist window - call s:Tlist_Window_Goto_Window() - - " Save the cursor position - let save_line = line('.') - let save_col = col('.') - - " Update the taglist window - call s:Tlist_Window_Refresh_File(fname, a:ftype) - - " Restore the cursor position - if v:version >= 601 - call cursor(save_line, save_col) - else - exe save_line - exe 'normal! ' . save_col . '|' - endif - - if winnr() != save_winnr - " Go back to the original window - call s:Tlist_Exe_Cmd_No_Acmds(save_winnr . 'wincmd w') - endif - endif - - " Update the taglist menu - if g:Tlist_Show_Menu - call s:Tlist_Menu_Update_File(1) - endif -endfunction - -" Tlist_Window_Close -" Close the taglist window -function! s:Tlist_Window_Close() - call s:Tlist_Log_Msg('Tlist_Window_Close()') - " Make sure the taglist window exists - let winnum = bufwinnr(g:TagList_title) - if winnum == -1 - call s:Tlist_Warning_Msg('Error: Taglist window is not open') - return - endif - - if winnr() == winnum - " Already in the taglist window. Close it and return - if winbufnr(2) != -1 - " If a window other than the taglist window is open, - " then only close the taglist window. - close - endif - else - " Goto the taglist window, close it and then come back to the - " original window - let curbufnr = bufnr('%') - exe winnum . 'wincmd w' - close - " Need to jump back to the original window only if we are not - " already in that window - let winnum = bufwinnr(curbufnr) - if winnr() != winnum - exe winnum . 'wincmd w' - endif - endif -endfunction - -" Tlist_Window_Mark_File_Window -" Mark the current window as the file window to use when jumping to a tag. -" Only if the current window is a non-plugin, non-preview and non-taglist -" window -function! s:Tlist_Window_Mark_File_Window() - if getbufvar('%', '&buftype') == '' && !&previewwindow - let w:tlist_file_window = "yes" - endif -endfunction - -" Tlist_Window_Open -" Open and refresh the taglist window -function! s:Tlist_Window_Open() - call s:Tlist_Log_Msg('Tlist_Window_Open()') - " If the window is open, jump to it - let winnum = bufwinnr(g:TagList_title) - if winnum != -1 - " Jump to the existing window - if winnr() != winnum - exe winnum . 'wincmd w' - endif - return - endif - - if s:tlist_app_name == "winmanager" - " Taglist plugin is no longer part of the winmanager app - let s:tlist_app_name = "none" - endif - - " Get the filename and filetype for the specified buffer - let curbuf_name = fnamemodify(bufname('%'), ':p') - let curbuf_ftype = s:Tlist_Get_Buffer_Filetype('%') - let cur_lnum = line('.') - - " Mark the current window as the desired window to open a file when a tag - " is selected. - call s:Tlist_Window_Mark_File_Window() - - " Open the taglist window - call s:Tlist_Window_Create() - - call s:Tlist_Window_Refresh() - - if g:Tlist_Show_One_File - " Add only the current buffer and file - " - " If the file doesn't support tag listing, skip it - if !s:Tlist_Skip_File(curbuf_name, curbuf_ftype) - call s:Tlist_Window_Refresh_File(curbuf_name, curbuf_ftype) - endif - endif - - if g:Tlist_File_Fold_Auto_Close - " Open the fold for the current file, as all the folds in - " the taglist window are closed - let fidx = s:Tlist_Get_File_Index(curbuf_name) - if fidx != -1 - exe "silent! " . s:tlist_{fidx}_start . "," . - \ s:tlist_{fidx}_end . "foldopen!" - endif - endif - - " Highlight the current tag - call s:Tlist_Window_Highlight_Tag(curbuf_name, cur_lnum, 1, 1) -endfunction - -" Tlist_Window_Toggle() -" Open or close a taglist window -function! s:Tlist_Window_Toggle() - call s:Tlist_Log_Msg('Tlist_Window_Toggle()') - " If taglist window is open then close it. - let winnum = bufwinnr(g:TagList_title) - if winnum != -1 - call s:Tlist_Window_Close() - return - endif - - call s:Tlist_Window_Open() - - " Go back to the original window, if Tlist_GainFocus_On_ToggleOpen is not - " set - if !g:Tlist_GainFocus_On_ToggleOpen - call s:Tlist_Exe_Cmd_No_Acmds('wincmd p') - endif - - " Update the taglist menu - if g:Tlist_Show_Menu - call s:Tlist_Menu_Update_File(0) - endif -endfunction - -" Tlist_Process_Filelist -" Process multiple files. Each filename is separated by "\n" -" Returns the number of processed files -function! s:Tlist_Process_Filelist(file_names) - let flist = a:file_names - - " Enable lazy screen updates - let old_lazyredraw = &lazyredraw - set lazyredraw - - " Keep track of the number of processed files - let fcnt = 0 - - " Process one file at a time - while flist != '' - let nl_idx = stridx(flist, "\n") - let one_file = strpart(flist, 0, nl_idx) - - " Remove the filename from the list - let flist = strpart(flist, nl_idx + 1) - - if one_file == '' - continue - endif - - " Skip directories - if isdirectory(one_file) - continue - endif - - let ftype = s:Tlist_Detect_Filetype(one_file) - - echon "\r " - echon "\rProcessing tags for " . fnamemodify(one_file, ':p:t') - - let fcnt = fcnt + 1 - - call Tlist_Update_File(one_file, ftype) - endwhile - - " Clear the displayed informational messages - echon "\r " - - " Restore the previous state - let &lazyredraw = old_lazyredraw - - return fcnt -endfunction - -" Tlist_Process_Dir -" Process the files in a directory matching the specified pattern -function! s:Tlist_Process_Dir(dir_name, pat) - let flist = glob(a:dir_name . '/' . a:pat) . "\n" - - let fcnt = s:Tlist_Process_Filelist(flist) - - let len = strlen(a:dir_name) - if a:dir_name[len - 1] == '\' || a:dir_name[len - 1] == '/' - let glob_expr = a:dir_name . '*' - else - let glob_expr = a:dir_name . '/*' - endif - let all_files = glob(glob_expr) . "\n" - - while all_files != '' - let nl_idx = stridx(all_files, "\n") - let one_file = strpart(all_files, 0, nl_idx) - - let all_files = strpart(all_files, nl_idx + 1) - if one_file == '' - continue - endif - - " Skip non-directory names - if !isdirectory(one_file) - continue - endif - - echon "\r " - echon "\rProcessing files in directory " . fnamemodify(one_file, ':t') - let fcnt = fcnt + s:Tlist_Process_Dir(one_file, a:pat) - endwhile - - return fcnt -endfunction - -" Tlist_Add_Files_Recursive -" Add files recursively from a directory -function! s:Tlist_Add_Files_Recursive(dir, ...) - let dir_name = fnamemodify(a:dir, ':p') - if !isdirectory(dir_name) - call s:Tlist_Warning_Msg('Error: ' . dir_name . ' is not a directory') - return - endif - - if a:0 == 1 - " User specified file pattern - let pat = a:1 - else - " Default file pattern - let pat = '*' - endif - - echon "\r " - echon "\rProcessing files in directory " . fnamemodify(dir_name, ':t') - let fcnt = s:Tlist_Process_Dir(dir_name, pat) - - echon "\rAdded " . fcnt . " files to the taglist" -endfunction - -" Tlist_Add_Files -" Add the specified list of files to the taglist -function! s:Tlist_Add_Files(...) - let flist = '' - let i = 1 - - " Get all the files matching the file patterns supplied as argument - while i <= a:0 - let flist = flist . glob(a:{i}) . "\n" - let i = i + 1 - endwhile - - if flist == '' - call s:Tlist_Warning_Msg('Error: No matching files are found') - return - endif - - let fcnt = s:Tlist_Process_Filelist(flist) - echon "\rAdded " . fcnt . " files to the taglist" -endfunction - -" Tlist_Extract_Tagtype -" Extract the tag type from the tag text -function! s:Tlist_Extract_Tagtype(tag_line) - " The tag type is after the tag prototype field. The prototype field - " ends with the /;"\t string. We add 4 at the end to skip the characters - " in this special string.. - let start = strridx(a:tag_line, '/;"' . "\t") + 4 - let end = strridx(a:tag_line, 'line:') - 1 - let ttype = strpart(a:tag_line, start, end - start) - - return ttype -endfunction - -" Tlist_Extract_Tag_Scope -" Extract the tag scope from the tag text -function! s:Tlist_Extract_Tag_Scope(tag_line) - let start = strridx(a:tag_line, 'line:') - let end = strridx(a:tag_line, "\t") - if end <= start - return '' - endif - - let tag_scope = strpart(a:tag_line, end + 1) - let tag_scope = strpart(tag_scope, stridx(tag_scope, ':') + 1) - - return tag_scope -endfunction - -" Tlist_Refresh() -" Refresh the taglist -function! s:Tlist_Refresh() - call s:Tlist_Log_Msg('Tlist_Refresh (Skip_Refresh = ' . - \ s:Tlist_Skip_Refresh . ', ' . bufname('%') . ')') - " If we are entering the buffer from one of the taglist functions, then - " no need to refresh the taglist window again. - if s:Tlist_Skip_Refresh - " We still need to update the taglist menu - if g:Tlist_Show_Menu - call s:Tlist_Menu_Update_File(0) - endif - return - endif - - " If part of the winmanager plugin and not configured to process - " tags always and not configured to display the tags menu, then return - if (s:tlist_app_name == 'winmanager') && !g:Tlist_Process_File_Always - \ && !g:Tlist_Show_Menu - return - endif - - " Skip buffers with 'buftype' set to nofile, nowrite, quickfix or help - if &buftype != '' - return - endif - - let filename = fnamemodify(bufname('%'), ':p') - let ftype = s:Tlist_Get_Buffer_Filetype('%') - - " If the file doesn't support tag listing, skip it - if s:Tlist_Skip_File(filename, ftype) - return - endif - - let tlist_win = bufwinnr(g:TagList_title) - - " If the taglist window is not opened and not configured to process - " tags always and not displaying the tags menu, then return - if tlist_win == -1 && !g:Tlist_Process_File_Always && !g:Tlist_Show_Menu - return - endif - - let fidx = s:Tlist_Get_File_Index(filename) - if fidx == -1 - " Check whether this file is removed based on user request - " If it is, then don't display the tags for this file - if s:Tlist_User_Removed_File(filename) - return - endif - - " If the taglist should not be auto updated, then return - if !g:Tlist_Auto_Update - return - endif - endif - - let cur_lnum = line('.') - - if fidx == -1 - " Update the tags for the file - let fidx = s:Tlist_Process_File(filename, ftype) - else - let mtime = getftime(filename) - if s:tlist_{fidx}_mtime != mtime - " Invalidate the tags listed for this file - let s:tlist_{fidx}_valid = 0 - - " Update the taglist and the window - call Tlist_Update_File(filename, ftype) - - " Store the new file modification time - let s:tlist_{fidx}_mtime = mtime - endif - endif - - " Update the taglist window - if tlist_win != -1 - " Disable screen updates - let old_lazyredraw = &lazyredraw - set nolazyredraw - - " Save the current window number - let save_winnr = winnr() - - " Goto the taglist window - call s:Tlist_Window_Goto_Window() - - if !g:Tlist_Auto_Highlight_Tag || !g:Tlist_Highlight_Tag_On_BufEnter - " Save the cursor position - let save_line = line('.') - let save_col = col('.') - endif - - " Update the taglist window - call s:Tlist_Window_Refresh_File(filename, ftype) - - " Open the fold for the file - exe "silent! " . s:tlist_{fidx}_start . "," . - \ s:tlist_{fidx}_end . "foldopen!" - - if g:Tlist_Highlight_Tag_On_BufEnter && g:Tlist_Auto_Highlight_Tag - if g:Tlist_Show_One_File && s:tlist_cur_file_idx != fidx - " If displaying tags for only one file in the taglist - " window and about to display the tags for a new file, - " then center the current tag line for the new file - let center_tag_line = 1 - else - let center_tag_line = 0 - endif - - " Highlight the current tag - call s:Tlist_Window_Highlight_Tag(filename, cur_lnum, 1, center_tag_line) - else - " Restore the cursor position - if v:version >= 601 - call cursor(save_line, save_col) - else - exe save_line - exe 'normal! ' . save_col . '|' - endif - endif - - " Jump back to the original window - if save_winnr != winnr() - call s:Tlist_Exe_Cmd_No_Acmds(save_winnr . 'wincmd w') - endif - - " Restore screen updates - let &lazyredraw = old_lazyredraw - endif - - " Update the taglist menu - if g:Tlist_Show_Menu - call s:Tlist_Menu_Update_File(0) - endif -endfunction - -" Tlist_Change_Sort() -" Change the sort order of the tag listing -" caller == 'cmd', command used in the taglist window -" caller == 'menu', taglist menu -" action == 'toggle', toggle sort from name to order and vice versa -" action == 'set', set the sort order to sort_type -function! s:Tlist_Change_Sort(caller, action, sort_type) - call s:Tlist_Log_Msg('Tlist_Change_Sort (caller = ' . a:caller . - \ ', action = ' . a:action . ', sort_type = ' . a:sort_type . ')') - if a:caller == 'cmd' - let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(line('.')) - if fidx == -1 - return - endif - - " Remove the previous highlighting - match none - elseif a:caller == 'menu' - let fidx = s:Tlist_Get_File_Index(fnamemodify(bufname('%'), ':p')) - if fidx == -1 - return - endif - endif - - if a:action == 'toggle' - let sort_type = s:tlist_{fidx}_sort_type - - " Toggle the sort order from 'name' to 'order' and vice versa - if sort_type == 'name' - let s:tlist_{fidx}_sort_type = 'order' - else - let s:tlist_{fidx}_sort_type = 'name' - endif - else - let s:tlist_{fidx}_sort_type = a:sort_type - endif - - " Invalidate the tags listed for this file - let s:tlist_{fidx}_valid = 0 - - if a:caller == 'cmd' - " Save the current line for later restoration - let curline = '\V\^' . getline('.') . '\$' - - call s:Tlist_Window_Refresh_File(s:tlist_{fidx}_filename, - \ s:tlist_{fidx}_filetype) - - exe s:tlist_{fidx}_start . ',' . s:tlist_{fidx}_end . 'foldopen!' - - " Go back to the cursor line before the tag list is sorted - call search(curline, 'w') - - call s:Tlist_Menu_Update_File(1) - else - call s:Tlist_Menu_Remove_File() - - call s:Tlist_Refresh() - endif -endfunction - -" Tlist_Update_Current_File() -" Update taglist for the current buffer by regenerating the tag list -" Contributed by WEN Guopeng. -function! s:Tlist_Update_Current_File() - call s:Tlist_Log_Msg('Tlist_Update_Current_File()') - if winnr() == bufwinnr(g:TagList_title) - " In the taglist window. Update the current file - call s:Tlist_Window_Update_File() - else - " Not in the taglist window. Update the current buffer - let filename = fnamemodify(bufname('%'), ':p') - let fidx = s:Tlist_Get_File_Index(filename) - if fidx != -1 - let s:tlist_{fidx}_valid = 0 - endif - let ft = s:Tlist_Get_Buffer_Filetype('%') - call Tlist_Update_File(filename, ft) - endif -endfunction - -" Tlist_Window_Update_File() -" Update the tags displayed in the taglist window -function! s:Tlist_Window_Update_File() - call s:Tlist_Log_Msg('Tlist_Window_Update_File()') - let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(line('.')) - if fidx == -1 - return - endif - - " Remove the previous highlighting - match none - - " Save the current line for later restoration - let curline = '\V\^' . getline('.') . '\$' - - let s:tlist_{fidx}_valid = 0 - - " Update the taglist window - call s:Tlist_Window_Refresh_File(s:tlist_{fidx}_filename, - \ s:tlist_{fidx}_filetype) - - exe s:tlist_{fidx}_start . ',' . s:tlist_{fidx}_end . 'foldopen!' - - " Go back to the tag line before the list is updated - call search(curline, 'w') -endfunction - -" Tlist_Window_Get_Tag_Type_By_Linenum() -" Return the tag type index for the specified line in the taglist window -function! s:Tlist_Window_Get_Tag_Type_By_Linenum(fidx, lnum) - let ftype = s:tlist_{a:fidx}_filetype - - " Determine to which tag type the current line number belongs to using the - " tag type start line number and the number of tags in a tag type - let i = 1 - while i <= s:tlist_{ftype}_count - let ttype = s:tlist_{ftype}_{i}_name - let start_lnum = - \ s:tlist_{a:fidx}_start + s:tlist_{a:fidx}_{ttype}_offset - let end = start_lnum + s:tlist_{a:fidx}_{ttype}_count - if a:lnum >= start_lnum && a:lnum <= end - break - endif - let i = i + 1 - endwhile - - " Current line doesn't belong to any of the displayed tag types - if i > s:tlist_{ftype}_count - return '' - endif - - return ttype -endfunction - -" Tlist_Window_Get_Tag_Index() -" Return the tag index for the specified line in the taglist window -function! s:Tlist_Window_Get_Tag_Index(fidx, lnum) - let ttype = s:Tlist_Window_Get_Tag_Type_By_Linenum(a:fidx, a:lnum) - - " Current line doesn't belong to any of the displayed tag types - if ttype == '' - return 0 - endif - - " Compute the index into the displayed tags for the tag type - let ttype_lnum = s:tlist_{a:fidx}_start + s:tlist_{a:fidx}_{ttype}_offset - let tidx = a:lnum - ttype_lnum - if tidx == 0 - return 0 - endif - - " Get the corresponding tag line and return it - return s:tlist_{a:fidx}_{ttype}_{tidx} -endfunction - -" Tlist_Window_Highlight_Line -" Highlight the current line -function! s:Tlist_Window_Highlight_Line() - " Clear previously selected name - match none - - " Highlight the current line - if g:Tlist_Display_Prototype == 0 - let pat = '/\%' . line('.') . 'l\s\+\zs.*/' - else - let pat = '/\%' . line('.') . 'l.*/' - endif - - exe 'match TagListTagName ' . pat -endfunction - -" Tlist_Window_Open_File -" Open the specified file in either a new window or an existing window -" and place the cursor at the specified tag pattern -function! s:Tlist_Window_Open_File(win_ctrl, filename, tagpat) - call s:Tlist_Log_Msg('Tlist_Window_Open_File (' . a:filename . ',' . - \ a:win_ctrl . ')') - let prev_Tlist_Skip_Refresh = s:Tlist_Skip_Refresh - let s:Tlist_Skip_Refresh = 1 - - if s:tlist_app_name == "winmanager" - " Let the winmanager edit the file - call WinManagerFileEdit(a:filename, a:win_ctrl == 'newwin') - else - - if a:win_ctrl == 'newtab' - " Create a new tab - exe 'tabnew ' . escape(a:filename, ' ') - " Open the taglist window in the new tab - call s:Tlist_Window_Open() - endif - - if a:win_ctrl == 'checktab' - " Check whether the file is present in any of the tabs. - " If the file is present in the current tab, then use the - " current tab. - if bufwinnr(a:filename) != -1 - let file_present_in_tab = 1 - let i = tabpagenr() - else - let i = 1 - let bnum = bufnr(a:filename) - let file_present_in_tab = 0 - while i <= tabpagenr('$') - if index(tabpagebuflist(i), bnum) != -1 - let file_present_in_tab = 1 - break - endif - let i += 1 - endwhile - endif - - if file_present_in_tab - " Goto the tab containing the file - exe 'tabnext ' . i - else - " Open a new tab - exe 'tabnew ' . escape(a:filename, ' ') - - " Open the taglist window - call s:Tlist_Window_Open() - endif - endif - - let winnum = -1 - if a:win_ctrl == 'prevwin' - " Open the file in the previous window, if it is usable - let cur_win = winnr() - wincmd p - if &buftype == '' && !&previewwindow - exe "edit " . escape(a:filename, ' ') - let winnum = winnr() - else - " Previous window is not usable - exe cur_win . 'wincmd w' - endif - endif - - " Goto the window containing the file. If the window is not there, open a - " new window - if winnum == -1 - let winnum = bufwinnr(a:filename) - endif - - if winnum == -1 - " Locate the previously used window for opening a file - let fwin_num = 0 - let first_usable_win = 0 - - let i = 1 - let bnum = winbufnr(i) - while bnum != -1 - if getwinvar(i, 'tlist_file_window') == 'yes' - let fwin_num = i - break - endif - if first_usable_win == 0 && - \ getbufvar(bnum, '&buftype') == '' && - \ !getwinvar(i, '&previewwindow') - " First non-taglist, non-plugin and non-preview window - let first_usable_win = i - endif - let i = i + 1 - let bnum = winbufnr(i) - endwhile - - " If a previously used window is not found, then use the first - " non-taglist window - if fwin_num == 0 - let fwin_num = first_usable_win - endif - - if fwin_num != 0 - " Jump to the file window - exe fwin_num . "wincmd w" - - " If the user asked to jump to the tag in a new window, then split - " the existing window into two. - if a:win_ctrl == 'newwin' - split - endif - exe "edit " . escape(a:filename, ' ') - else - " Open a new window - if g:Tlist_Use_Horiz_Window - exe 'leftabove split ' . escape(a:filename, ' ') - else - if winbufnr(2) == -1 - " Only the taglist window is present - if g:Tlist_Use_Right_Window - exe 'leftabove vertical split ' . - \ escape(a:filename, ' ') - else - exe 'rightbelow vertical split ' . - \ escape(a:filename, ' ') - endif - - " Go to the taglist window to change the window size to - " the user configured value - call s:Tlist_Exe_Cmd_No_Acmds('wincmd p') - if g:Tlist_Use_Horiz_Window - exe 'resize ' . g:Tlist_WinHeight - else - exe 'vertical resize ' . g:Tlist_WinWidth - endif - " Go back to the file window - call s:Tlist_Exe_Cmd_No_Acmds('wincmd p') - else - " A plugin or help window is also present - wincmd w - exe 'leftabove split ' . escape(a:filename, ' ') - endif - endif - endif - " Mark the window, so that it can be reused. - call s:Tlist_Window_Mark_File_Window() - else - if v:version >= 700 - " If the file is opened in more than one window, then check - " whether the last accessed window has the selected file. - " If it does, then use that window. - let lastwin_bufnum = winbufnr(winnr('#')) - if bufnr(a:filename) == lastwin_bufnum - let winnum = winnr('#') - endif - endif - exe winnum . 'wincmd w' - - " If the user asked to jump to the tag in a new window, then split the - " existing window into two. - if a:win_ctrl == 'newwin' - split - endif - endif - endif - - " Jump to the tag - if a:tagpat != '' - " Add the current cursor position to the jump list, so that user can - " jump back using the ' and ` marks. - mark ' - silent call search(a:tagpat, 'w') - - " Bring the line to the middle of the window - normal! z. - - " If the line is inside a fold, open the fold - if foldclosed('.') != -1 - .foldopen - endif - endif - - " If the user selects to preview the tag then jump back to the - " taglist window - if a:win_ctrl == 'preview' - " Go back to the taglist window - let winnum = bufwinnr(g:TagList_title) - exe winnum . 'wincmd w' - else - " If the user has selected to close the taglist window, when a - " tag is selected, close the taglist window - if g:Tlist_Close_On_Select - call s:Tlist_Window_Goto_Window() - close - - " Go back to the window displaying the selected file - let wnum = bufwinnr(a:filename) - if wnum != -1 && wnum != winnr() - call s:Tlist_Exe_Cmd_No_Acmds(wnum . 'wincmd w') - endif - endif - endif - - let s:Tlist_Skip_Refresh = prev_Tlist_Skip_Refresh -endfunction - -" Tlist_Window_Jump_To_Tag() -" Jump to the location of the current tag -" win_ctrl == useopen - Reuse the existing file window -" win_ctrl == newwin - Open a new window -" win_ctrl == preview - Preview the tag -" win_ctrl == prevwin - Open in previous window -" win_ctrl == newtab - Open in new tab -function! s:Tlist_Window_Jump_To_Tag(win_ctrl) - call s:Tlist_Log_Msg('Tlist_Window_Jump_To_Tag(' . a:win_ctrl . ')') - " Do not process comment lines and empty lines - let curline = getline('.') - if curline =~ '^\s*$' || curline[0] == '"' - return - endif - - " If inside a closed fold, then use the first line of the fold - " and jump to the file. - let lnum = foldclosed('.') - if lnum == -1 - " Jump to the selected tag or file - let lnum = line('.') - else - " Open the closed fold - .foldopen! - endif - - let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(lnum) - if fidx == -1 - return - endif - - " Get the tag output for the current tag - let tidx = s:Tlist_Window_Get_Tag_Index(fidx, lnum) - if tidx != 0 - let tagpat = s:Tlist_Get_Tag_SearchPat(fidx, tidx) - - " Highlight the tagline - call s:Tlist_Window_Highlight_Line() - else - " Selected a line which is not a tag name. Just edit the file - let tagpat = '' - endif - - call s:Tlist_Window_Open_File(a:win_ctrl, s:tlist_{fidx}_filename, tagpat) -endfunction - -" Tlist_Window_Show_Info() -" Display information about the entry under the cursor -function! s:Tlist_Window_Show_Info() - call s:Tlist_Log_Msg('Tlist_Window_Show_Info()') - - " Clear the previously displayed line - echo - - " Do not process comment lines and empty lines - let curline = getline('.') - if curline =~ '^\s*$' || curline[0] == '"' - return - endif - - " If inside a fold, then don't display the prototype - if foldclosed('.') != -1 - return - endif - - let lnum = line('.') - - " Get the file index - let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(lnum) - if fidx == -1 - return - endif - - if lnum == s:tlist_{fidx}_start - " Cursor is on a file name - let fname = s:tlist_{fidx}_filename - if strlen(fname) > 50 - let fname = fnamemodify(fname, ':t') - endif - echo fname . ', Filetype=' . s:tlist_{fidx}_filetype . - \ ', Tag count=' . s:tlist_{fidx}_tag_count - return - endif - - " Get the tag output line for the current tag - let tidx = s:Tlist_Window_Get_Tag_Index(fidx, lnum) - if tidx == 0 - " Cursor is on a tag type - let ttype = s:Tlist_Window_Get_Tag_Type_By_Linenum(fidx, lnum) - if ttype == '' - return - endif - - let ttype_name = '' - - let ftype = s:tlist_{fidx}_filetype - let i = 1 - while i <= s:tlist_{ftype}_count - if ttype == s:tlist_{ftype}_{i}_name - let ttype_name = s:tlist_{ftype}_{i}_fullname - break - endif - let i = i + 1 - endwhile - - echo 'Tag type=' . ttype_name . - \ ', Tag count=' . s:tlist_{fidx}_{ttype}_count - return - endif - - " Get the tag search pattern and display it - echo s:Tlist_Get_Tag_Prototype(fidx, tidx) -endfunction - -" Tlist_Find_Nearest_Tag_Idx -" Find the tag idx nearest to the supplied line number -" Returns -1, if a tag couldn't be found for the specified line number -function! s:Tlist_Find_Nearest_Tag_Idx(fidx, linenum) - let sort_type = s:tlist_{a:fidx}_sort_type - - let left = 1 - let right = s:tlist_{a:fidx}_tag_count - - if sort_type == 'order' - " Tags sorted by order, use a binary search. - " The idea behind this function is taken from the ctags.vim script (by - " Alexey Marinichev) available at the Vim online website. - - " If the current line is the less than the first tag, then no need to - " search - let first_lnum = s:Tlist_Get_Tag_Linenum(a:fidx, 1) - - if a:linenum < first_lnum - return -1 - endif - - while left < right - let middle = (right + left + 1) / 2 - let middle_lnum = s:Tlist_Get_Tag_Linenum(a:fidx, middle) - - if middle_lnum == a:linenum - let left = middle - break - endif - - if middle_lnum > a:linenum - let right = middle - 1 - else - let left = middle - endif - endwhile - else - " Tags sorted by name, use a linear search. (contributed by Dave - " Eggum). - " Look for a tag with a line number less than or equal to the supplied - " line number. If multiple tags are found, then use the tag with the - " line number closest to the supplied line number. IOW, use the tag - " with the highest line number. - let closest_lnum = 0 - let final_left = 0 - while left <= right - let lnum = s:Tlist_Get_Tag_Linenum(a:fidx, left) - - if lnum < a:linenum && lnum > closest_lnum - let closest_lnum = lnum - let final_left = left - elseif lnum == a:linenum - let closest_lnum = lnum - let final_left = left - break - else - let left = left + 1 - endif - endwhile - if closest_lnum == 0 - return -1 - endif - if left >= right - let left = final_left - endif - endif - - return left -endfunction - -" Tlist_Window_Highlight_Tag() -" Highlight the current tag -" cntx == 1, Called by the taglist plugin itself -" cntx == 2, Forced by the user through the TlistHighlightTag command -" center = 1, move the tag line to the center of the taglist window -function! s:Tlist_Window_Highlight_Tag(filename, cur_lnum, cntx, center) - " Highlight the current tag only if the user configured the - " taglist plugin to do so or if the user explictly invoked the - " command to highlight the current tag. - if !g:Tlist_Auto_Highlight_Tag && a:cntx == 1 - return - endif - - if a:filename == '' - return - endif - - " Make sure the taglist window is present - let winnum = bufwinnr(g:TagList_title) - if winnum == -1 - call s:Tlist_Warning_Msg('Error: Taglist window is not open') - return - endif - - let fidx = s:Tlist_Get_File_Index(a:filename) - if fidx == -1 - return - endif - - " If the file is currently not displayed in the taglist window, then retrn - if !s:tlist_{fidx}_visible - return - endif - - " If there are no tags for this file, then no need to proceed further - if s:tlist_{fidx}_tag_count == 0 - return - endif - - " Ignore all autocommands - let old_ei = &eventignore - set eventignore=all - - " Save the original window number - let org_winnr = winnr() - - if org_winnr == winnum - let in_taglist_window = 1 - else - let in_taglist_window = 0 - endif - - " Go to the taglist window - if !in_taglist_window - exe winnum . 'wincmd w' - endif - - " Clear previously selected name - match none - - let tidx = s:Tlist_Find_Nearest_Tag_Idx(fidx, a:cur_lnum) - if tidx == -1 - " Make sure the current tag line is visible in the taglist window. - " Calling the winline() function makes the line visible. Don't know - " of a better way to achieve this. - let lnum = line('.') - - if lnum < s:tlist_{fidx}_start || lnum > s:tlist_{fidx}_end - " Move the cursor to the beginning of the file - exe s:tlist_{fidx}_start - endif - - if foldclosed('.') != -1 - .foldopen - endif - - call winline() - - if !in_taglist_window - exe org_winnr . 'wincmd w' - endif - - " Restore the autocommands - let &eventignore = old_ei - return - endif - - " Extract the tag type - let ttype = s:Tlist_Get_Tag_Type_By_Tag(fidx, tidx) - - " Compute the line number - " Start of file + Start of tag type + offset - let lnum = s:tlist_{fidx}_start + s:tlist_{fidx}_{ttype}_offset + - \ s:tlist_{fidx}_{tidx}_ttype_idx - - " Goto the line containing the tag - exe lnum - - " Open the fold - if foldclosed('.') != -1 - .foldopen - endif - - if a:center - " Move the tag line to the center of the taglist window - normal! z. - else - " Make sure the current tag line is visible in the taglist window. - " Calling the winline() function makes the line visible. Don't know - " of a better way to achieve this. - call winline() - endif - - " Highlight the tag name - call s:Tlist_Window_Highlight_Line() - - " Go back to the original window - if !in_taglist_window - exe org_winnr . 'wincmd w' - endif - - " Restore the autocommands - let &eventignore = old_ei - return -endfunction - -" Tlist_Get_Tag_Prototype_By_Line -" Get the prototype for the tag on or before the specified line number in the -" current buffer -function! Tlist_Get_Tag_Prototype_By_Line(...) - if a:0 == 0 - " Arguments are not supplied. Use the current buffer name - " and line number - let filename = bufname('%') - let linenr = line('.') - elseif a:0 == 2 - " Filename and line number are specified - let filename = a:1 - let linenr = a:2 - if linenr !~ '\d\+' - " Invalid line number - return "" - endif - else - " Sufficient arguments are not supplied - let msg = 'Usage: Tlist_Get_Tag_Prototype_By_Line ' . - \ '' - call s:Tlist_Warning_Msg(msg) - return "" - endif - - " Expand the file to a fully qualified name - let filename = fnamemodify(filename, ':p') - if filename == '' - return "" - endif - - let fidx = s:Tlist_Get_File_Index(filename) - if fidx == -1 - return "" - endif - - " If there are no tags for this file, then no need to proceed further - if s:tlist_{fidx}_tag_count == 0 - return "" - endif - - " Get the tag text using the line number - let tidx = s:Tlist_Find_Nearest_Tag_Idx(fidx, linenr) - if tidx == -1 - return "" - endif - - return s:Tlist_Get_Tag_Prototype(fidx, tidx) -endfunction - -" Tlist_Get_Tagname_By_Line -" Get the tag name on or before the specified line number in the -" current buffer -function! Tlist_Get_Tagname_By_Line(...) - if a:0 == 0 - " Arguments are not supplied. Use the current buffer name - " and line number - let filename = bufname('%') - let linenr = line('.') - elseif a:0 == 2 - " Filename and line number are specified - let filename = a:1 - let linenr = a:2 - if linenr !~ '\d\+' - " Invalid line number - return "" - endif - else - " Sufficient arguments are not supplied - let msg = 'Usage: Tlist_Get_Tagname_By_Line ' - call s:Tlist_Warning_Msg(msg) - return "" - endif - - " Make sure the current file has a name - let filename = fnamemodify(filename, ':p') - if filename == '' - return "" - endif - - let fidx = s:Tlist_Get_File_Index(filename) - if fidx == -1 - return "" - endif - - " If there are no tags for this file, then no need to proceed further - if s:tlist_{fidx}_tag_count == 0 - return "" - endif - - " Get the tag name using the line number - let tidx = s:Tlist_Find_Nearest_Tag_Idx(fidx, linenr) - if tidx == -1 - return "" - endif - - return s:tlist_{fidx}_{tidx}_tag_name -endfunction - -" Tlist_Window_Move_To_File -" Move the cursor to the beginning of the current file or the next file -" or the previous file in the taglist window -" dir == -1, move to start of current or previous function -" dir == 1, move to start of next function -function! s:Tlist_Window_Move_To_File(dir) - if foldlevel('.') == 0 - " Cursor is on a non-folded line (it is not in any of the files) - " Move it to a folded line - if a:dir == -1 - normal! zk - else - " While moving down to the start of the next fold, - " no need to do go to the start of the next file. - normal! zj - return - endif - endif - - let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(line('.')) - if fidx == -1 - return - endif - - let cur_lnum = line('.') - - if a:dir == -1 - if cur_lnum > s:tlist_{fidx}_start - " Move to the beginning of the current file - exe s:tlist_{fidx}_start - return - endif - - if fidx != 0 - " Move to the beginning of the previous file - let fidx = fidx - 1 - else - " Cursor is at the first file, wrap around to the last file - let fidx = s:tlist_file_count - 1 - endif - - exe s:tlist_{fidx}_start - return - else - " Move to the beginning of the next file - let fidx = fidx + 1 - - if fidx >= s:tlist_file_count - " Cursor is at the last file, wrap around to the first file - let fidx = 0 - endif - - if s:tlist_{fidx}_start != 0 - exe s:tlist_{fidx}_start - endif - return - endif -endfunction - -" Tlist_Session_Load -" Load a taglist session (information about all the displayed files -" and the tags) from the specified file -function! s:Tlist_Session_Load(...) - if a:0 == 0 || a:1 == '' - call s:Tlist_Warning_Msg('Usage: TlistSessionLoad ') - return - endif - - let sessionfile = a:1 - - if !filereadable(sessionfile) - let msg = 'Taglist: Error - Unable to open file ' . sessionfile - call s:Tlist_Warning_Msg(msg) - return - endif - - " Mark the current window as the file window - call s:Tlist_Window_Mark_File_Window() - - " Source the session file - exe 'source ' . sessionfile - - let new_file_count = g:tlist_file_count - unlet! g:tlist_file_count - - let i = 0 - while i < new_file_count - let ftype = g:tlist_{i}_filetype - unlet! g:tlist_{i}_filetype - - if !exists('s:tlist_' . ftype . '_count') - if s:Tlist_FileType_Init(ftype) == 0 - let i = i + 1 - continue - endif - endif - - let fname = g:tlist_{i}_filename - unlet! g:tlist_{i}_filename - - let fidx = s:Tlist_Get_File_Index(fname) - if fidx != -1 - let s:tlist_{fidx}_visible = 0 - let i = i + 1 - continue - else - " As we are loading the tags from the session file, if this - " file was previously deleted by the user, now we need to - " add it back. So remove the file from the deleted list. - call s:Tlist_Update_Remove_List(fname, 0) - endif - - let fidx = s:Tlist_Init_File(fname, ftype) - - let s:tlist_{fidx}_filename = fname - - let s:tlist_{fidx}_sort_type = g:tlist_{i}_sort_type - unlet! g:tlist_{i}_sort_type - - let s:tlist_{fidx}_filetype = ftype - let s:tlist_{fidx}_mtime = getftime(fname) - - let s:tlist_{fidx}_start = 0 - let s:tlist_{fidx}_end = 0 - - let s:tlist_{fidx}_valid = 1 - - let s:tlist_{fidx}_tag_count = g:tlist_{i}_tag_count - unlet! g:tlist_{i}_tag_count - - let j = 1 - while j <= s:tlist_{fidx}_tag_count - let s:tlist_{fidx}_{j}_tag = g:tlist_{i}_{j}_tag - let s:tlist_{fidx}_{j}_tag_name = g:tlist_{i}_{j}_tag_name - let s:tlist_{fidx}_{j}_ttype_idx = g:tlist_{i}_{j}_ttype_idx - unlet! g:tlist_{i}_{j}_tag - unlet! g:tlist_{i}_{j}_tag_name - unlet! g:tlist_{i}_{j}_ttype_idx - let j = j + 1 - endwhile - - let j = 1 - while j <= s:tlist_{ftype}_count - let ttype = s:tlist_{ftype}_{j}_name - - if exists('g:tlist_' . i . '_' . ttype) - let s:tlist_{fidx}_{ttype} = g:tlist_{i}_{ttype} - unlet! g:tlist_{i}_{ttype} - let s:tlist_{fidx}_{ttype}_offset = 0 - let s:tlist_{fidx}_{ttype}_count = g:tlist_{i}_{ttype}_count - unlet! g:tlist_{i}_{ttype}_count - - let k = 1 - while k <= s:tlist_{fidx}_{ttype}_count - let s:tlist_{fidx}_{ttype}_{k} = g:tlist_{i}_{ttype}_{k} - unlet! g:tlist_{i}_{ttype}_{k} - let k = k + 1 - endwhile - else - let s:tlist_{fidx}_{ttype} = '' - let s:tlist_{fidx}_{ttype}_offset = 0 - let s:tlist_{fidx}_{ttype}_count = 0 - endif - - let j = j + 1 - endwhile - - let i = i + 1 - endwhile - - " If the taglist window is open, then update it - let winnum = bufwinnr(g:TagList_title) - if winnum != -1 - let save_winnr = winnr() - - " Goto the taglist window - call s:Tlist_Window_Goto_Window() - - " Refresh the taglist window - call s:Tlist_Window_Refresh() - - " Go back to the original window - if save_winnr != winnr() - call s:Tlist_Exe_Cmd_No_Acmds('wincmd p') - endif - endif -endfunction - -" Tlist_Session_Save -" Save a taglist session (information about all the displayed files -" and the tags) into the specified file -function! s:Tlist_Session_Save(...) - if a:0 == 0 || a:1 == '' - call s:Tlist_Warning_Msg('Usage: TlistSessionSave ') - return - endif - - let sessionfile = a:1 - - if s:tlist_file_count == 0 - " There is nothing to save - call s:Tlist_Warning_Msg('Warning: Taglist is empty. Nothing to save.') - return - endif - - if filereadable(sessionfile) - let ans = input('Do you want to overwrite ' . sessionfile . ' (Y/N)?') - if ans !=? 'y' - return - endif - - echo "\n" - endif - - let old_verbose = &verbose - set verbose&vim - - exe 'redir! > ' . sessionfile - - silent! echo '" Taglist session file. This file is auto-generated.' - silent! echo '" File information' - silent! echo 'let tlist_file_count = ' . s:tlist_file_count - - let i = 0 - - while i < s:tlist_file_count - " Store information about the file - silent! echo 'let tlist_' . i . "_filename = '" . - \ s:tlist_{i}_filename . "'" - silent! echo 'let tlist_' . i . '_sort_type = "' . - \ s:tlist_{i}_sort_type . '"' - silent! echo 'let tlist_' . i . '_filetype = "' . - \ s:tlist_{i}_filetype . '"' - silent! echo 'let tlist_' . i . '_tag_count = ' . - \ s:tlist_{i}_tag_count - " Store information about all the tags - let j = 1 - while j <= s:tlist_{i}_tag_count - let txt = escape(s:tlist_{i}_{j}_tag, '"\\') - silent! echo 'let tlist_' . i . '_' . j . '_tag = "' . txt . '"' - silent! echo 'let tlist_' . i . '_' . j . '_tag_name = "' . - \ s:tlist_{i}_{j}_tag_name . '"' - silent! echo 'let tlist_' . i . '_' . j . '_ttype_idx' . ' = ' . - \ s:tlist_{i}_{j}_ttype_idx - let j = j + 1 - endwhile - - " Store information about all the tags grouped by their type - let ftype = s:tlist_{i}_filetype - let j = 1 - while j <= s:tlist_{ftype}_count - let ttype = s:tlist_{ftype}_{j}_name - if s:tlist_{i}_{ttype}_count != 0 - let txt = escape(s:tlist_{i}_{ttype}, '"\') - let txt = substitute(txt, "\n", "\\\\n", 'g') - silent! echo 'let tlist_' . i . '_' . ttype . ' = "' . - \ txt . '"' - silent! echo 'let tlist_' . i . '_' . ttype . '_count = ' . - \ s:tlist_{i}_{ttype}_count - let k = 1 - while k <= s:tlist_{i}_{ttype}_count - silent! echo 'let tlist_' . i . '_' . ttype . '_' . k . - \ ' = ' . s:tlist_{i}_{ttype}_{k} - let k = k + 1 - endwhile - endif - let j = j + 1 - endwhile - - silent! echo - - let i = i + 1 - endwhile - - redir END - - let &verbose = old_verbose -endfunction - -" Tlist_Buffer_Removed -" A buffer is removed from the Vim buffer list. Remove the tags defined -" for that file -function! s:Tlist_Buffer_Removed(filename) - call s:Tlist_Log_Msg('Tlist_Buffer_Removed (' . a:filename . ')') - - " Make sure a valid filename is supplied - if a:filename == '' - return - endif - - " Get tag list index of the specified file - let fidx = s:Tlist_Get_File_Index(a:filename) - if fidx == -1 - " File not present in the taglist - return - endif - - " Remove the file from the list - call s:Tlist_Remove_File(fidx, 0) -endfunction - -" When a buffer is deleted, remove the file from the taglist -autocmd BufDelete * silent call s:Tlist_Buffer_Removed(expand(':p')) - -" Tlist_Window_Open_File_Fold -" Open the fold for the specified file and close the fold for all the -" other files -function! s:Tlist_Window_Open_File_Fold(acmd_bufnr) - call s:Tlist_Log_Msg('Tlist_Window_Open_File_Fold (' . a:acmd_bufnr . ')') - - " Make sure the taglist window is present - let winnum = bufwinnr(g:TagList_title) - if winnum == -1 - call s:Tlist_Warning_Msg('Taglist: Error - Taglist window is not open') - return - endif - - " Save the original window number - let org_winnr = winnr() - if org_winnr == winnum - let in_taglist_window = 1 - else - let in_taglist_window = 0 - endif - - if in_taglist_window - " When entering the taglist window, no need to update the folds - return - endif - - " Go to the taglist window - if !in_taglist_window - call s:Tlist_Exe_Cmd_No_Acmds(winnum . 'wincmd w') - endif - - " Close all the folds - silent! %foldclose - - " Get tag list index of the specified file - let fname = fnamemodify(bufname(a:acmd_bufnr + 0), ':p') - if filereadable(fname) - let fidx = s:Tlist_Get_File_Index(fname) - if fidx != -1 - " Open the fold for the file - exe "silent! " . s:tlist_{fidx}_start . "," . - \ s:tlist_{fidx}_end . "foldopen" - endif - endif - - " Go back to the original window - if !in_taglist_window - call s:Tlist_Exe_Cmd_No_Acmds(org_winnr . 'wincmd w') - endif -endfunction - -" Tlist_Window_Check_Auto_Open -" Open the taglist window automatically on Vim startup. -" Open the window only when files present in any of the Vim windows support -" tags. -function! s:Tlist_Window_Check_Auto_Open() - let open_window = 0 - - let i = 1 - let buf_num = winbufnr(i) - while buf_num != -1 - let filename = fnamemodify(bufname(buf_num), ':p') - let ft = s:Tlist_Get_Buffer_Filetype(buf_num) - if !s:Tlist_Skip_File(filename, ft) - let open_window = 1 - break - endif - let i = i + 1 - let buf_num = winbufnr(i) - endwhile - - if open_window - call s:Tlist_Window_Toggle() - endif -endfunction - -" Tlist_Refresh_Folds -" Remove and create the folds for all the files displayed in the taglist -" window. Used after entering a tab. If this is not done, then the folds -" are not properly created for taglist windows displayed in multiple tabs. -function! s:Tlist_Refresh_Folds() - let winnum = bufwinnr(g:TagList_title) - if winnum == -1 - return - endif - - let save_wnum = winnr() - exe winnum . 'wincmd w' - - " First remove all the existing folds - normal! zE - - " Create the folds for each in the tag list - let fidx = 0 - while fidx < s:tlist_file_count - let ftype = s:tlist_{fidx}_filetype - - " Create the folds for each tag type in a file - let j = 1 - while j <= s:tlist_{ftype}_count - let ttype = s:tlist_{ftype}_{j}_name - if s:tlist_{fidx}_{ttype}_count - let s = s:tlist_{fidx}_start + s:tlist_{fidx}_{ttype}_offset - let e = s + s:tlist_{fidx}_{ttype}_count - exe s . ',' . e . 'fold' - endif - let j = j + 1 - endwhile - - exe s:tlist_{fidx}_start . ',' . s:tlist_{fidx}_end . 'fold' - exe 'silent! ' . s:tlist_{fidx}_start . ',' . - \ s:tlist_{fidx}_end . 'foldopen!' - let fidx = fidx + 1 - endwhile - - exe save_wnum . 'wincmd w' -endfunction - -function! s:Tlist_Menu_Add_Base_Menu() - call s:Tlist_Log_Msg('Adding the base menu') - - " Add the menu - anoremenu T&ags.Refresh\ menu :call Tlist_Menu_Refresh() - anoremenu T&ags.Sort\ menu\ by.Name - \ :call Tlist_Change_Sort('menu', 'set', 'name') - anoremenu T&ags.Sort\ menu\ by.Order - \ :call Tlist_Change_Sort('menu', 'set', 'order') - anoremenu T&ags.-SEP1- : - - if &mousemodel =~ 'popup' - anoremenu PopUp.T&ags.Refresh\ menu - \ :call Tlist_Menu_Refresh() - anoremenu PopUp.T&ags.Sort\ menu\ by.Name - \ :call Tlist_Change_Sort('menu', 'set', 'name') - anoremenu PopUp.T&ags.Sort\ menu\ by.Order - \ :call Tlist_Change_Sort('menu', 'set', 'order') - anoremenu PopUp.T&ags.-SEP1- : - endif -endfunction - -let s:menu_char_prefix = - \ '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' - -" Tlist_Menu_Get_Tag_Type_Cmd -" Get the menu command for the specified tag type -" fidx - File type index -" ftype - File Type -" add_ttype_name - To add or not to add the tag type name to the menu entries -" ttype_idx - Tag type index -function! s:Tlist_Menu_Get_Tag_Type_Cmd(fidx, ftype, add_ttype_name, ttype_idx) - " Curly brace variable name optimization - let ftype_ttype_idx = a:ftype . '_' . a:ttype_idx - - let ttype = s:tlist_{ftype_ttype_idx}_name - if a:add_ttype_name - " If the tag type name contains space characters, escape it. This - " will be used to create the menu entries. - let ttype_fullname = escape(s:tlist_{ftype_ttype_idx}_fullname, ' ') - endif - - " Curly brace variable name optimization - let fidx_ttype = a:fidx . '_' . ttype - - " Number of tag entries for this tag type - let tcnt = s:tlist_{fidx_ttype}_count - if tcnt == 0 " No entries for this tag type - return '' - endif - - let mcmd = '' - - " Create the menu items for the tags. - " Depending on the number of tags of this type, split the menu into - " multiple sub-menus, if needed. - if tcnt > g:Tlist_Max_Submenu_Items - let j = 1 - while j <= tcnt - let final_index = j + g:Tlist_Max_Submenu_Items - 1 - if final_index > tcnt - let final_index = tcnt - endif - - " Extract the first and last tag name and form the - " sub-menu name - let tidx = s:tlist_{fidx_ttype}_{j} - let first_tag = s:tlist_{a:fidx}_{tidx}_tag_name - - let tidx = s:tlist_{fidx_ttype}_{final_index} - let last_tag = s:tlist_{a:fidx}_{tidx}_tag_name - - " Truncate the names, if they are greater than the - " max length - let first_tag = strpart(first_tag, 0, g:Tlist_Max_Tag_Length) - let last_tag = strpart(last_tag, 0, g:Tlist_Max_Tag_Length) - - " Form the menu command prefix - let m_prefix = 'anoremenu T\&ags.' - if a:add_ttype_name - let m_prefix = m_prefix . ttype_fullname . '.' - endif - let m_prefix = m_prefix . first_tag . '\.\.\.' . last_tag . '.' - - " Character prefix used to number the menu items (hotkey) - let m_prefix_idx = 0 - - while j <= final_index - let tidx = s:tlist_{fidx_ttype}_{j} - - let tname = s:tlist_{a:fidx}_{tidx}_tag_name - - let mcmd = mcmd . m_prefix . '\&' . - \ s:menu_char_prefix[m_prefix_idx] . '\.' . - \ tname . ' :call Tlist_Menu_Jump_To_Tag(' . - \ tidx . ')|' - - let m_prefix_idx = m_prefix_idx + 1 - let j = j + 1 - endwhile - endwhile - else - " Character prefix used to number the menu items (hotkey) - let m_prefix_idx = 0 - - let m_prefix = 'anoremenu T\&ags.' - if a:add_ttype_name - let m_prefix = m_prefix . ttype_fullname . '.' - endif - let j = 1 - while j <= tcnt - let tidx = s:tlist_{fidx_ttype}_{j} - - let tname = s:tlist_{a:fidx}_{tidx}_tag_name - - let mcmd = mcmd . m_prefix . '\&' . - \ s:menu_char_prefix[m_prefix_idx] . '\.' . - \ tname . ' :call Tlist_Menu_Jump_To_Tag(' . tidx - \ . ')|' - - let m_prefix_idx = m_prefix_idx + 1 - let j = j + 1 - endwhile - endif - - return mcmd -endfunction - -" Update the taglist menu with the tags for the specified file -function! s:Tlist_Menu_File_Refresh(fidx) - call s:Tlist_Log_Msg('Refreshing the tag menu for ' . s:tlist_{a:fidx}_filename) - " The 'B' flag is needed in the 'cpoptions' option - let old_cpoptions = &cpoptions - set cpoptions&vim - - exe s:tlist_{a:fidx}_menu_cmd - - " Update the popup menu (if enabled) - if &mousemodel =~ 'popup' - let cmd = substitute(s:tlist_{a:fidx}_menu_cmd, ' T\\&ags\.', - \ ' PopUp.T\\\&ags.', "g") - exe cmd - endif - - " The taglist menu is not empty now - let s:tlist_menu_empty = 0 - - " Restore the 'cpoptions' settings - let &cpoptions = old_cpoptions -endfunction - -" Tlist_Menu_Update_File -" Add the taglist menu -function! s:Tlist_Menu_Update_File(clear_menu) - if !has('gui_running') - " Not running in GUI mode - return - endif - - call s:Tlist_Log_Msg('Updating the tag menu, clear_menu = ' . a:clear_menu) - - " Remove the tags menu - if a:clear_menu - call s:Tlist_Menu_Remove_File() - - endif - - " Skip buffers with 'buftype' set to nofile, nowrite, quickfix or help - if &buftype != '' - return - endif - - let filename = fnamemodify(bufname('%'), ':p') - let ftype = s:Tlist_Get_Buffer_Filetype('%') - - " If the file doesn't support tag listing, skip it - if s:Tlist_Skip_File(filename, ftype) - return - endif - - let fidx = s:Tlist_Get_File_Index(filename) - if fidx == -1 || !s:tlist_{fidx}_valid - " Check whether this file is removed based on user request - " If it is, then don't display the tags for this file - if s:Tlist_User_Removed_File(filename) - return - endif - - " Process the tags for the file - let fidx = s:Tlist_Process_File(filename, ftype) - if fidx == -1 - return - endif - endif - - let fname = escape(fnamemodify(bufname('%'), ':t'), '.') - if fname != '' - exe 'anoremenu T&ags.' . fname . ' ' - anoremenu T&ags.-SEP2- : - endif - - if !s:tlist_{fidx}_tag_count - return - endif - - if s:tlist_{fidx}_menu_cmd != '' - " Update the menu with the cached command - call s:Tlist_Menu_File_Refresh(fidx) - - return - endif - - " We are going to add entries to the tags menu, so the menu won't be - " empty - let s:tlist_menu_empty = 0 - - let cmd = '' - - " Determine whether the tag type name needs to be added to the menu - " If more than one tag type is present in the taglisting for a file, - " then the tag type name needs to be present - let add_ttype_name = -1 - let i = 1 - while i <= s:tlist_{ftype}_count && add_ttype_name < 1 - let ttype = s:tlist_{ftype}_{i}_name - if s:tlist_{fidx}_{ttype}_count - let add_ttype_name = add_ttype_name + 1 - endif - let i = i + 1 - endwhile - - " Process the tags by the tag type and get the menu command - let i = 1 - while i <= s:tlist_{ftype}_count - let mcmd = s:Tlist_Menu_Get_Tag_Type_Cmd(fidx, ftype, add_ttype_name, i) - if mcmd != '' - let cmd = cmd . mcmd - endif - - let i = i + 1 - endwhile - - " Cache the menu command for reuse - let s:tlist_{fidx}_menu_cmd = cmd - - " Update the menu - call s:Tlist_Menu_File_Refresh(fidx) -endfunction - -" Tlist_Menu_Remove_File -" Remove the tags displayed in the tags menu -function! s:Tlist_Menu_Remove_File() - if !has('gui_running') || s:tlist_menu_empty - return - endif - - call s:Tlist_Log_Msg('Removing the tags menu for a file') - - " Cleanup the Tags menu - silent! unmenu T&ags - if &mousemodel =~ 'popup' - silent! unmenu PopUp.T&ags - endif - - " Add a dummy menu item to retain teared off menu - noremenu T&ags.Dummy l - - silent! unmenu! T&ags - if &mousemodel =~ 'popup' - silent! unmenu! PopUp.T&ags - endif - - call s:Tlist_Menu_Add_Base_Menu() - - " Remove the dummy menu item - unmenu T&ags.Dummy - - let s:tlist_menu_empty = 1 -endfunction - -" Tlist_Menu_Refresh -" Refresh the taglist menu -function! s:Tlist_Menu_Refresh() - call s:Tlist_Log_Msg('Refreshing the tags menu') - let fidx = s:Tlist_Get_File_Index(fnamemodify(bufname('%'), ':p')) - if fidx != -1 - " Invalidate the cached menu command - let s:tlist_{fidx}_menu_cmd = '' - endif - - " Update the taglist, menu and window - call s:Tlist_Update_Current_File() -endfunction - -" Tlist_Menu_Jump_To_Tag -" Jump to the selected tag -function! s:Tlist_Menu_Jump_To_Tag(tidx) - let fidx = s:Tlist_Get_File_Index(fnamemodify(bufname('%'), ':p')) - if fidx == -1 - return - endif - - let tagpat = s:Tlist_Get_Tag_SearchPat(fidx, a:tidx) - if tagpat == '' - return - endif - - " Add the current cursor position to the jump list, so that user can - " jump back using the ' and ` marks. - mark ' - - silent call search(tagpat, 'w') - - " Bring the line to the middle of the window - normal! z. - - " If the line is inside a fold, open the fold - if foldclosed('.') != -1 - .foldopen - endif -endfunction - -" Tlist_Menu_Init -" Initialize the taglist menu -function! s:Tlist_Menu_Init() - call s:Tlist_Menu_Add_Base_Menu() - - " Automatically add the tags defined in the current file to the menu - augroup TagListMenuCmds - autocmd! - - if !g:Tlist_Process_File_Always - autocmd BufEnter * call s:Tlist_Refresh() - endif - autocmd BufLeave * call s:Tlist_Menu_Remove_File() - augroup end - - call s:Tlist_Menu_Update_File(0) -endfunction - -" Tlist_Vim_Session_Load -" Initialize the taglist window/buffer, which is created when loading -" a Vim session file. -function! s:Tlist_Vim_Session_Load() - call s:Tlist_Log_Msg('Tlist_Vim_Session_Load') - - " Initialize the taglist window - call s:Tlist_Window_Init() - - " Refresh the taglist window - call s:Tlist_Window_Refresh() -endfunction - -" Tlist_Set_App -" Set the name of the external plugin/application to which taglist -" belongs. -" Taglist plugin is part of another plugin like cream or winmanager. -function! Tlist_Set_App(name) - if a:name == "" - return - endif - - let s:tlist_app_name = a:name -endfunction - -" Winmanager integration - -" Initialization required for integration with winmanager -function! TagList_Start() - " If current buffer is not taglist buffer, then don't proceed - if bufname('%') != '__Tag_List__' - return - endif - - call Tlist_Set_App('winmanager') - - " Get the current filename from the winmanager plugin - let bufnum = WinManagerGetLastEditedFile() - if bufnum != -1 - let filename = fnamemodify(bufname(bufnum), ':p') - let ftype = s:Tlist_Get_Buffer_Filetype(bufnum) - endif - - " Initialize the taglist window, if it is not already initialized - if !exists('s:tlist_window_initialized') || !s:tlist_window_initialized - call s:Tlist_Window_Init() - call s:Tlist_Window_Refresh() - let s:tlist_window_initialized = 1 - endif - - " Update the taglist window - if bufnum != -1 - if !s:Tlist_Skip_File(filename, ftype) && g:Tlist_Auto_Update - call s:Tlist_Window_Refresh_File(filename, ftype) - endif - endif -endfunction - -function! TagList_IsValid() - return 0 -endfunction - -function! TagList_WrapUp() - return 0 -endfunction - -" restore 'cpo' -let &cpo = s:cpo_save -unlet s:cpo_save - diff --git a/bundle/vim-coffee-script/.gitignore b/bundle/vim-coffee-script/.gitignore deleted file mode 100644 index 1ff7b050..00000000 --- a/bundle/vim-coffee-script/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.*.sw[a-z] -.*.un~ -doc/tags - diff --git a/bundle/vim-coffee-script/Copying.md b/bundle/vim-coffee-script/Copying.md deleted file mode 100644 index 51cf8d14..00000000 --- a/bundle/vim-coffee-script/Copying.md +++ /dev/null @@ -1,15 +0,0 @@ - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - Version 2, December 2004 - - Copyright (C) 2010 to 2012 Mick Koch - - 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. - - diff --git a/bundle/vim-coffee-script/Makefile b/bundle/vim-coffee-script/Makefile deleted file mode 100644 index e6ef4092..00000000 --- a/bundle/vim-coffee-script/Makefile +++ /dev/null @@ -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 diff --git a/bundle/vim-coffee-script/News.md b/bundle/vim-coffee-script/News.md deleted file mode 100644 index 97067963..00000000 --- a/bundle/vim-coffee-script/News.md +++ /dev/null @@ -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. diff --git a/bundle/vim-coffee-script/Readme.md b/bundle/vim-coffee-script/Readme.md deleted file mode 100644 index d557848a..00000000 --- a/bundle/vim-coffee-script/Readme.md +++ /dev/null @@ -1,599 +0,0 @@ -This project adds [CoffeeScript] support to vim. It covers syntax, indenting, -compiling, and more. - -![Screenshot](http://i.imgur.com/j1BhpZQ.png) - -[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://i.imgur.com/scUXmxR.png) - - ![make Result](http://i.imgur.com/eGIjEdn.png) - -[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: - - ![CoffeeCompile](http://i.imgur.com/0zFG0l0.png) - - ![CoffeeCompile Result](http://i.imgur.com/bpiAxaa.png) - -Calling it with a range, like in visual mode, compiles only the selected snippet -of CoffeeScript: - - ![CoffeeCompile Snippet](http://i.imgur.com/x3OT3Ay.png) - - ![Compiled Snippet](http://i.imgur.com/J02j4T8.png) - -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 - - ![Syntax Checking](http://i.imgur.com/RC8accF.png) - - ![Syntax Checking Result](http://i.imgur.com/gi1ON75.png) - -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](http://i.imgur.com/TRHdIMG.png) - - ![CoffeeWatch Result](http://i.imgur.com/rJbOeeS.png) - -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: - - ![Insert Mode](http://i.imgur.com/SBVcf4k.png) - - ![Recompile](http://i.imgur.com/pbPMog7.png) - -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. - - ![CoffeeRun](http://i.imgur.com/YSkHUuQ.png) - - ![CoffeeRun Output](http://i.imgur.com/wZQbggN.png) - -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. - - ![CoffeeLint](http://i.imgur.com/UN8Nr5N.png) - - ![CoffeeLint Result](http://i.imgur.com/9hSIj3W.png) - - :[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 - -``` - -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: - - ![Folding](http://i.imgur.com/gDgUBdO.png) - -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 diff --git a/bundle/vim-coffee-script/Thanks.md b/bundle/vim-coffee-script/Thanks.md deleted file mode 100644 index 8ddcf23f..00000000 --- a/bundle/vim-coffee-script/Thanks.md +++ /dev/null @@ -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. diff --git a/bundle/vim-coffee-script/Todo.md b/bundle/vim-coffee-script/Todo.md deleted file mode 100644 index 3d4ffaa8..00000000 --- a/bundle/vim-coffee-script/Todo.md +++ /dev/null @@ -1 +0,0 @@ -- Don't highlight bad operator combinations diff --git a/bundle/vim-coffee-script/after/indent/html.vim b/bundle/vim-coffee-script/after/indent/html.vim deleted file mode 100644 index e6377087..00000000 --- a/bundle/vim-coffee-script/after/indent/html.vim +++ /dev/null @@ -1,33 +0,0 @@ -" Language: CoffeeScript -" Maintainer: Mick Koch -" 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('', '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 diff --git a/bundle/vim-coffee-script/after/syntax/haml.vim b/bundle/vim-coffee-script/after/syntax/haml.vim deleted file mode 100644 index 4c517ebb..00000000 --- a/bundle/vim-coffee-script/after/syntax/haml.vim +++ /dev/null @@ -1,13 +0,0 @@ -" Language: CoffeeScript -" Maintainer: Sven Felix Oberquelle -" 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 diff --git a/bundle/vim-coffee-script/after/syntax/html.vim b/bundle/vim-coffee-script/after/syntax/html.vim deleted file mode 100644 index 9e2eb3a1..00000000 --- a/bundle/vim-coffee-script/after/syntax/html.vim +++ /dev/null @@ -1,11 +0,0 @@ -" Language: CoffeeScript -" Maintainer: Mick Koch -" 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=##me=s-1 keepend -\ contains=@htmlCoffeeScript,htmlScriptTag,@htmlPreproc -\ containedin=htmlHead diff --git a/bundle/vim-coffee-script/autoload/coffee.vim b/bundle/vim-coffee-script/autoload/coffee.vim deleted file mode 100644 index 04d5efba..00000000 --- a/bundle/vim-coffee-script/autoload/coffee.vim +++ /dev/null @@ -1,54 +0,0 @@ -" Language: CoffeeScript -" Maintainer: Mick Koch -" 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 diff --git a/bundle/vim-coffee-script/compiler/cake.vim b/bundle/vim-coffee-script/compiler/cake.vim deleted file mode 100644 index 0a3c7037..00000000 --- a/bundle/vim-coffee-script/compiler/cake.vim +++ /dev/null @@ -1,15 +0,0 @@ -" Language: CoffeeScript -" Maintainer: Mick Koch -" 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() diff --git a/bundle/vim-coffee-script/compiler/coffee.vim b/bundle/vim-coffee-script/compiler/coffee.vim deleted file mode 100644 index 9a91d354..00000000 --- a/bundle/vim-coffee-script/compiler/coffee.vim +++ /dev/null @@ -1,82 +0,0 @@ -" Language: CoffeeScript -" Maintainer: Mick Koch -" 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(, ) - -" 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 call s:UpdateMakePrg() - else - autocmd BufWritePre,BufFilePost call s:UpdateMakePrg() - endif -augroup END diff --git a/bundle/vim-coffee-script/doc/coffee-script.txt b/bundle/vim-coffee-script/doc/coffee-script.txt deleted file mode 100644 index 1b43cf3a..00000000 --- a/bundle/vim-coffee-script/doc/coffee-script.txt +++ /dev/null @@ -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: diff --git a/bundle/vim-coffee-script/ftdetect/coffee.vim b/bundle/vim-coffee-script/ftdetect/coffee.vim deleted file mode 100644 index 50569298..00000000 --- a/bundle/vim-coffee-script/ftdetect/coffee.vim +++ /dev/null @@ -1,17 +0,0 @@ -" Language: CoffeeScript -" Maintainer: Mick Koch -" 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) =~ '^#!.*\' - set filetype=coffee - endif -endfunction - -autocmd BufNewFile,BufRead * call s:DetectCoffee() diff --git a/bundle/vim-coffee-script/ftplugin/coffee.vim b/bundle/vim-coffee-script/ftplugin/coffee.vim deleted file mode 100644 index c44fe979..00000000 --- a/bundle/vim-coffee-script/ftplugin/coffee.vim +++ /dev/null @@ -1,404 +0,0 @@ -" Language: CoffeeScript -" Maintainer: Mick Koch -" 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 q :hide - - 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 * - 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 =~ '\' - 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 =~ '\' - 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 call s:CoffeeCompileClose() - " Save the cursor when leaving the output buffer. - autocmd BufLeave 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 =~ '\' - 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 call s:CoffeeWatchClose() - autocmd BufLeave 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 * - - augroup CoffeeAuWatch - autocmd InsertLeave call s:CoffeeWatchUpdate() - autocmd BufWritePost 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 call s:CoffeeRunClose() - autocmd BufLeave 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(, , ) -command! -bar -nargs=* -complete=customlist,s:CoffeeComplete -\ CoffeeWatch call s:CoffeeWatch() -command! -range=% -bar -nargs=* CoffeeRun -\ call s:CoffeeRun(, , ) -command! -range=% -bang -bar -nargs=* CoffeeLint -\ call s:CoffeeLint(, , , ) diff --git a/bundle/vim-coffee-script/indent/coffee.vim b/bundle/vim-coffee-script/indent/coffee.vim deleted file mode 100644 index e83fa5a4..00000000 --- a/bundle/vim-coffee-script/indent/coffee.vim +++ /dev/null @@ -1,433 +0,0 @@ -" Language: CoffeeScript -" Maintainer: Mick Koch -" 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[(\[].\{-}\.\{-\}[)\]]' - -" 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\'], -\ ['\C^catch\>', '\C\', '\C\'], -\ ['\C^finally\>', '\C\', '\C\'] -\] - -" 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\') && 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\') - " 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^\' && !s:SearchCode(prevnlnum, '\C\') && - \ 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\') && - \ !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 diff --git a/bundle/vim-coffee-script/syntax/coffee.vim b/bundle/vim-coffee-script/syntax/coffee.vim deleted file mode 100644 index 7f8df73c..00000000 --- a/bundle/vim-coffee-script/syntax/coffee.vim +++ /dev/null @@ -1,221 +0,0 @@ -" Language: CoffeeScript -" Maintainer: Mick Koch -" 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 /\/ 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\|\$\)\@/ 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\|\$\)\@/ -\ 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\|\$\)\@> #{ == { { { } } } == } << " -" >> #{ == { abc: { def: 42 } } == } << " diff --git a/bundle/vim-coffee-script/test/test-ops.coffee b/bundle/vim-coffee-script/test/test-ops.coffee deleted file mode 100644 index 54be8dba..00000000 --- a/bundle/vim-coffee-script/test/test-ops.coffee +++ /dev/null @@ -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 diff --git a/bundle/vim-coffee-script/test/test-reserved.coffee b/bundle/vim-coffee-script/test/test-reserved.coffee deleted file mode 100644 index b841760c..00000000 --- a/bundle/vim-coffee-script/test/test-reserved.coffee +++ /dev/null @@ -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 diff --git a/bundle/vim-coffee-script/test/test.haml b/bundle/vim-coffee-script/test/test.haml deleted file mode 100644 index ae19fba5..00000000 --- a/bundle/vim-coffee-script/test/test.haml +++ /dev/null @@ -1,3 +0,0 @@ -:coffeescript - class Hello - # test diff --git a/bundle/vim-coffee-script/test/test.html b/bundle/vim-coffee-script/test/test.html deleted file mode 100644 index 34791453..00000000 --- a/bundle/vim-coffee-script/test/test.html +++ /dev/null @@ -1,7 +0,0 @@ - - - diff --git a/bundle/vim-expand-region/MIT-LICENSE.txt b/bundle/vim-expand-region/MIT-LICENSE.txt deleted file mode 100644 index dade7aa4..00000000 --- a/bundle/vim-expand-region/MIT-LICENSE.txt +++ /dev/null @@ -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. diff --git a/bundle/vim-expand-region/README.md b/bundle/vim-expand-region/README.md deleted file mode 100644 index eb8fcd31..00000000 --- a/bundle/vim-expand-region/README.md +++ /dev/null @@ -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) - -

- vim-expand-region -

- -## 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 (expand_region_expand) -map J (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\": 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 - - -[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/terryma/vim-expand-region/trend.png)](https://bitdeli.com/free "Bitdeli Badge") - diff --git a/bundle/vim-expand-region/autoload/expand_region.vim b/bundle/vim-expand-region/autoload/expand_region.vim deleted file mode 100644 index 3bf2f70a..00000000 --- a/bundle/vim-expand-region/autoload/expand_region.vim +++ /dev/null @@ -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! \" - - 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! \" - 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 diff --git a/bundle/vim-expand-region/doc/expand_region.txt b/bundle/vim-expand-region/doc/expand_region.txt deleted file mode 100644 index 109dd721..00000000 --- a/bundle/vim-expand-region/doc/expand_region.txt +++ /dev/null @@ -1,126 +0,0 @@ -*vim-expand-region.txt* Incremental visual selection - - __ _ - ___ _ ______ ____ _____ ____/ / ________ ____ _(_)___ ____ - / _ \| |/_/ __ \/ __ `/ __ \/ __ / / ___/ _ \/ __ `/ / __ \/ __ \ - / __/> - - map K (expand_region_expand) - map J (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\": 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: diff --git a/bundle/vim-expand-region/expand-region.gif b/bundle/vim-expand-region/expand-region.gif deleted file mode 100644 index 00aa5b33..00000000 Binary files a/bundle/vim-expand-region/expand-region.gif and /dev/null differ diff --git a/bundle/vim-expand-region/plugin/expand_region.vim b/bundle/vim-expand-region/plugin/expand_region.vim deleted file mode 100644 index 18db51ae..00000000 --- a/bundle/vim-expand-region/plugin/expand_region.vim +++ /dev/null @@ -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('(expand_region_expand)') - nmap + (expand_region_expand) - vmap + (expand_region_expand) -endif -if !hasmapto('(expand_region_shrink)') - vmap _ (expand_region_shrink) - nmap _ (expand_region_shrink) -endif - -nnoremap (expand_region_expand) - \ :call expand_region#next('n', '+') -" Map keys differently depending on which mode is desired -if expand_region#use_select_mode() - snoremap (expand_region_expand) - \ :call expand_region#next('v', '+') - snoremap (expand_region_shrink) - \ :call expand_region#next('v', '-') -else - xnoremap (expand_region_expand) - \ :call expand_region#next('v', '+') - xnoremap (expand_region_shrink) - \ :call expand_region#next('v', '-') -endif - -let &cpo = s:save_cpo -unlet s:save_cpo diff --git a/bundle/vim-golang/autoload/go/complete.vim b/bundle/vim-golang/autoload/go/complete.vim deleted file mode 100644 index 8dd43de4..00000000 --- a/bundle/vim-golang/autoload/go/complete.vim +++ /dev/null @@ -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 diff --git a/bundle/vim-golang/compiler/go.vim b/bundle/vim-golang/compiler/go.vim deleted file mode 100644 index 2c8cce49..00000000 --- a/bundle/vim-golang/compiler/go.vim +++ /dev/null @@ -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 -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 diff --git a/bundle/vim-golang/ftdetect/gofiletype.vim b/bundle/vim-golang/ftdetect/gofiletype.vim deleted file mode 100644 index b658f6b0..00000000 --- a/bundle/vim-golang/ftdetect/gofiletype.vim +++ /dev/null @@ -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() diff --git a/bundle/vim-golang/ftplugin/go.vim b/bundle/vim-golang/ftplugin/go.vim deleted file mode 100644 index 8066733c..00000000 --- a/bundle/vim-golang/ftplugin/go.vim +++ /dev/null @@ -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 diff --git a/bundle/vim-golang/ftplugin/go/fmt.vim b/bundle/vim-golang/ftplugin/go/fmt.vim deleted file mode 100644 index 359545bd..00000000 --- a/bundle/vim-golang/ftplugin/go/fmt.vim +++ /dev/null @@ -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 diff --git a/bundle/vim-golang/ftplugin/go/import.vim b/bundle/vim-golang/ftplugin/go/import.vim deleted file mode 100644 index 91c8697a..00000000 --- a/bundle/vim-golang/ftplugin/go/import.vim +++ /dev/null @@ -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 f :Import fmt -" -" Drop fmt -" au Filetype go nnoremap F :Drop fmt -" -" Import the word under your cursor -" au Filetype go nnoremap k -" \ :exe 'Import ' . expand('') -" -" 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, '', ) - command! -buffer -nargs=1 -complete=customlist,go#complete#Package Import call s:SwitchImport(1, '', ) - command! -buffer -nargs=* -complete=customlist,go#complete#Package ImportAs call s:SwitchImport(1, ) -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 diff --git a/bundle/vim-golang/ftplugin/go/test.sh b/bundle/vim-golang/ftplugin/go/test.sh deleted file mode 100644 index d8a5b895..00000000 --- a/bundle/vim-golang/ftplugin/go/test.sh +++ /dev/null @@ -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 <&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 <&1 "FAIL" - exit 1 -fi -echo 2>&1 "PASS" diff --git a/bundle/vim-golang/indent/go.vim b/bundle/vim-golang/indent/go.vim deleted file mode 100644 index faf4d79e..00000000 --- a/bundle/vim-golang/indent/go.vim +++ /dev/null @@ -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 diff --git a/bundle/vim-golang/mirror.txt b/bundle/vim-golang/mirror.txt deleted file mode 100644 index 7fc4f60f..00000000 --- a/bundle/vim-golang/mirror.txt +++ /dev/null @@ -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 diff --git a/bundle/vim-golang/plugin/godoc.vim b/bundle/vim-golang/plugin/godoc.vim deleted file mode 100644 index a145d313..00000000 --- a/bundle/vim-golang/plugin/godoc.vim +++ /dev/null @@ -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() -endif - -nnoremap (godoc-keyword) :call Godoc('') - -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 K :Godoc - - au BufHidden call let 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('') - 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 diff --git a/bundle/vim-golang/readme.txt b/bundle/vim-golang/readme.txt deleted file mode 100644 index b8469f92..00000000 --- a/bundle/vim-golang/readme.txt +++ /dev/null @@ -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 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. diff --git a/bundle/vim-golang/syntax/go.vim b/bundle/vim-golang/syntax/go.vim deleted file mode 100644 index 1ce6cb27..00000000 --- a/bundle/vim-golang/syntax/go.vim +++ /dev/null @@ -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 /\/ -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 "\(\/ - syn match goExtraType /\/ - syn match goExtraType /\/ - syn match goExtraType /\/ -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" diff --git a/bundle/vim-golang/syntax/godoc.vim b/bundle/vim-golang/syntax/godoc.vim deleted file mode 100644 index bd4443f7..00000000 --- a/bundle/vim-golang/syntax/godoc.vim +++ /dev/null @@ -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 - -HiLink godocTitle Title - -delcommand HiLink - -let b:current_syntax = "godoc" - -" vim:ts=4 sts=2 sw=2: diff --git a/bundle/vim-indent-object/.gitignore b/bundle/vim-indent-object/.gitignore deleted file mode 100644 index 1b19a79f..00000000 --- a/bundle/vim-indent-object/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -tags - diff --git a/bundle/vim-indent-object/doc/indent-object.txt b/bundle/vim-indent-object/doc/indent-object.txt deleted file mode 100644 index 5b581020..00000000 --- a/bundle/vim-indent-object/doc/indent-object.txt +++ /dev/null @@ -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 ~ -> - ai (A)n (I)ndentation level and line above. - ii (I)nner (I)ndentation level (no line above). - aI (A)n (I)ndentation level and lines above/below. - 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 . 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. diff --git a/bundle/vim-indent-object/plugin/indent-object.vim b/bundle/vim-indent-object/plugin/indent-object.vim deleted file mode 100644 index afb8edd2..00000000 --- a/bundle/vim-indent-object/plugin/indent-object.vim +++ /dev/null @@ -1,224 +0,0 @@ -"-------------------------------------------------------------------------------- -" -" Copyright (c) 2010 Michael Smith -" -" 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 ai :cal HandleTextObjectMapping(0, 0, 0, [line("."), line("."), col("."), col(".")]) -onoremap ii :cal HandleTextObjectMapping(1, 0, 0, [line("."), line("."), col("."), col(".")]) -vnoremap ai :cal HandleTextObjectMapping(0, 0, 1, [line("'<"), line("'>"), col("'<"), col("'>")])gv -vnoremap ii :cal HandleTextObjectMapping(1, 0, 1, [line("'<"), line("'>"), col("'<"), col("'>")])gv - -" Mappings including line below. -onoremap aI :cal HandleTextObjectMapping(0, 1, 0, [line("."), line("."), col("."), col(".")]) -onoremap iI :cal HandleTextObjectMapping(1, 1, 0, [line("."), line("."), col("."), col(".")]) -vnoremap aI :cal HandleTextObjectMapping(0, 1, 1, [line("'<"), line("'>"), col("'<"), col("'>")])gv -vnoremap iI :cal HandleTextObjectMapping(1, 1, 1, [line("'<"), line("'>"), col("'<"), col("'>")])gv - -let s:l0 = -1 -let s:l1 = -1 -let s:c0 = -1 -let s:c1 = -1 - -function! 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! \" - let s:l0 = line("'<") - let s:l1 = line("'>") - let s:c0 = col("'<") - let s:c1 = col("'>") - normal gv - -endfunction - -function! HandleTextObjectMapping(inner, incbelow, vis, range) - call TextObject(a:inner, a:incbelow, a:vis, a:range, v:count1) -endfunction diff --git a/bundle/vim-puppet b/bundle/vim-puppet deleted file mode 160000 index d881b93d..00000000 --- a/bundle/vim-puppet +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d881b93dc4a8ed1374ad44439aeeb47808a6b91a