diff --git a/.Xdefaults b/.Xdefaults new file mode 100644 index 0000000..e7c7b3a --- /dev/null +++ b/.Xdefaults @@ -0,0 +1,2 @@ +#include ".fonts/Xdefaults" +#include ".urxvt/Xdefaults" \ No newline at end of file diff --git a/.config/LyX/lyx.conf b/.config/LyX/lyx.conf new file mode 100644 index 0000000..d5c7fd4 --- /dev/null +++ b/.config/LyX/lyx.conf @@ -0,0 +1,44 @@ +[ui_files] +0=/usr/share/lyx/ui/default.ui +0\date=@Variant(\0\0\0\x10\0%x\xcd\x3j_\xd8\x1) + +[views] +0\pos=@Point(3 30) +0\size=@Size(1672 998) +0\layout=@ByteArray(\0\0\0\xff\0\0\0\0\xfd\0\0\0\x2\0\0\0\0\0\0\0\0\0\0\0\0\xfc\x2\0\0\0\x1\xfb\0\0\0\x6\0t\0o\0\x63\0\0\0\0\0\xff\xff\xff\xff\0\0\x1[\0\xff\xff\xff\0\0\0\x3\0\0\0\0\0\0\0\0\xfc\x1\0\0\0\x1\xfb\0\0\0\x16\0v\0i\0\x65\0w\0-\0s\0o\0u\0r\0\x63\0\x65\0\0\0\0\0\xff\xff\xff\xff\0\0\x1\xb6\0\xff\xff\xff\0\0\x6\x88\0\0\x3\xa0\0\0\0\x4\0\0\0\x4\0\0\0\b\0\0\0\b\xfc\0\0\0\x1d\0\0\0\x2\0\0\0\x3\0\0\0\x10\0s\0t\0\x61\0n\0\x64\0\x61\0r\0\x64\x1\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\n\0\x65\0x\0t\0r\0\x61\x1\0\0\x2s\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x16\0v\0i\0\x65\0w\0/\0u\0p\0\x64\0\x61\0t\0\x65\x1\0\0\x4\xfb\0\0\0P\0\0\0\0\0\0\0\0\0\0\0\x2\0\0\0\0\0\0\0\x2\0\0\0\x1\0\0\0\f\0r\0\x65\0v\0i\0\x65\0w\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x2\0\0\0\0\0\0\0\x2\0\0\0\x1\0\0\0\x6\0v\0\x63\0s\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x3\0\0\0\x1\0\0\0\n\0t\0\x61\0\x62\0l\0\x65\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x3\0\0\0\x1\0\0\0\b\0m\0\x61\0t\0h\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x3\0\0\0\x1\0\0\0\"\0m\0\x61\0t\0h\0m\0\x61\0\x63\0r\0o\0t\0\x65\0m\0p\0l\0\x61\0t\0\x65\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x3\0\0\0\x1\0\0\0\x14\0m\0i\0n\0i\0\x62\0u\0\x66\0\x66\0\x65\0r\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x3\0\0\0\x1\0\0\0\x16\0m\0\x61\0t\0h\0_\0p\0\x61\0n\0\x65\0l\0s\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x3\0\0\0\x1\0\0\0\x12\0\x66\0u\0n\0\x63\0t\0i\0o\0n\0s\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x3\0\0\0\x1\0\0\0\n\0s\0p\0\x61\0\x63\0\x65\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x3\0\0\0\x1\0\0\0\x16\0s\0q\0r\0t\0-\0s\0q\0u\0\x61\0r\0\x65\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x3\0\0\0\x1\0\0\0\n\0s\0t\0y\0l\0\x65\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x3\0\0\0\x1\0\0\0\x16\0\x66\0r\0\x61\0\x63\0-\0s\0q\0u\0\x61\0r\0\x65\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x3\0\0\0\x1\0\0\0\b\0\x66\0o\0n\0t\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x3\0\0\0\x1\0\0\0\x14\0l\0\x61\0t\0\x65\0x\0_\0\x64\0o\0t\0s\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x3\0\0\0\x1\0\0\0\x14\0l\0\x61\0t\0\x65\0x\0_\0\x64\0\x65\0\x63\0o\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x3\0\0\0\x1\0\0\0\x16\0l\0\x61\0t\0\x65\0x\0_\0\x61\0r\0r\0o\0w\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x3\0\0\0\x1\0\0\0\x12\0l\0\x61\0t\0\x65\0x\0_\0\x62\0o\0p\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x3\0\0\0\x1\0\0\0\x14\0l\0\x61\0t\0\x65\0x\0_\0\x62\0r\0\x65\0l\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x3\0\0\0\x1\0\0\0\x16\0l\0\x61\0t\0\x65\0x\0_\0g\0r\0\x65\0\x65\0k\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x3\0\0\0\x1\0\0\0\x14\0l\0\x61\0t\0\x65\0x\0_\0m\0i\0s\0\x63\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x3\0\0\0\x1\0\0\0\x16\0l\0\x61\0t\0\x65\0x\0_\0v\0\x61\0r\0s\0z\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x3\0\0\0\x1\0\0\0\x1c\0l\0\x61\0t\0\x65\0x\0_\0\x61\0m\0s\0_\0m\0i\0s\0\x63\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x3\0\0\0\x1\0\0\0 \0l\0\x61\0t\0\x65\0x\0_\0\x61\0m\0s\0_\0\x61\0r\0r\0o\0w\0s\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x3\0\0\0\x1\0\0\0\x1a\0l\0\x61\0t\0\x65\0x\0_\0\x61\0m\0s\0_\0r\0\x65\0l\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x3\0\0\0\x1\0\0\0\x1c\0l\0\x61\0t\0\x65\0x\0_\0\x61\0m\0s\0_\0n\0r\0\x65\0l\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x3\0\0\0\x1\0\0\0\x1a\0l\0\x61\0t\0\x65\0x\0_\0\x61\0m\0s\0_\0o\0p\0s\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0) +0\icon_size=@Size(14 14) +0\extra\visibility=5 +0\font\visibility=10 +0\frac-square\visibility=10 +0\functions\visibility=10 +0\latex_ams_arrows\visibility=10 +0\latex_ams_misc\visibility=10 +0\latex_ams_nrel\visibility=10 +0\latex_ams_ops\visibility=10 +0\latex_ams_rel\visibility=10 +0\latex_arrow\visibility=10 +0\latex_bop\visibility=10 +0\latex_brel\visibility=10 +0\latex_deco\visibility=10 +0\latex_dots\visibility=10 +0\latex_greek\visibility=10 +0\latex_misc\visibility=10 +0\latex_varsz\visibility=10 +0\math\visibility=200 +0\math_panels\visibility=200 +0\mathmacrotemplate\visibility=1096 +0\minibuffer\visibility=10 +0\review\visibility=580 +0\space\visibility=10 +0\sqrt-square\visibility=10 +0\standard\visibility=5 +0\style\visibility=10 +0\table\visibility=328 +0\vcs\visibility=6 +0\view\update\visibility=5 +0\aboutlyx\geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x1\0\0\0\0\x1\x2\0\0\0\xaa\0\0\x2J\0\0\x1\xd6\0\0\x1\x3\0\0\0\xbc\0\0\x2I\0\0\x1\xd5\0\0\0\0\0\0) +0\prefs\geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x1\0\0\0\0\0\xdd\0\0\0\x17\0\0\x3\xc7\0\0\x1\xf8\0\0\0\xde\0\0\0)\0\0\x3\xc6\0\0\x1\xf7\0\0\0\0\0\0) +0\toc\geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x1\0\0\0\0\0\0\0\0\0\0\0\0\0\xcf\0\0\x1Z\0\0\0\0\0\0\0\0\0\0\0\xcf\0\0\x1Z\0\0\0\0\0\0) +0\view-source\geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x1\0\0\0\0\0\0\0\0\0\0\0\0\x1\xb5\0\0\0[\0\0\0\0\0\0\0\0\0\0\x1\xb5\0\0\0[\0\0\0\0\0\0) +0\view-source\fullsource=false +0\view-source\autoupdate=true diff --git a/.config/geany/geany.conf b/.config/geany/geany.conf new file mode 100644 index 0000000..29341a2 --- /dev/null +++ b/.config/geany/geany.conf @@ -0,0 +1,192 @@ + +[geany] +default_open_path=/home/kolan +cmdline_new_files=true +notebook_double_click_hides_widgets=false +tab_pos_sidebar=2 +highlighting_invert_all=false +pref_main_suppress_search_dialogs=false +pref_main_search_use_current_word=true +check_detect_indent=false +use_tab_to_indent=true +pref_editor_tab_width=8 +indent_hard_tab_width=8 +indent_mode=2 +indent_type=1 +autocomplete_doc_words=false +completion_drops_rest_of_word=false +autocompletion_max_entries=30 +mru_length=10 +disk_check_timeout=30 +show_editor_scrollbars=true +brace_match_ltgt=false +use_gtk_word_boundaries=true +complete_snippets_whilst_editing=false +show_symbol_list_expanders=true +allow_always_save=false +use_safe_file_saving=false +documents_show_paths=true +sidebar_page=2 +pref_main_load_session=true +pref_main_project_session=true +pref_main_project_file_in_basedir=true +pref_main_save_winpos=true +pref_main_confirm_exit=false +pref_main_suppress_status_messages=false +switch_msgwin_pages=false +beep_on_errors=true +auto_focus=false +sidebar_symbol_visible=true +sidebar_openfiles_visible=true +editor_font=Liberation Mono 8 +tagbar_font=Sans 8 +msgwin_font=Sans 8 +show_notebook_tabs=true +show_tab_cross=true +tab_order_ltr=true +tab_pos_editor=2 +tab_pos_msgwin=0 +show_indent_guide=false +show_white_space=false +show_line_endings=false +show_markers_margin=true +show_linenumber_margin=true +long_line_type=0 +long_line_column=72 +long_line_color=#C2EBC2 +symbolcompletion_max_height=10 +symbolcompletion_min_chars=4 +use_folding=true +unfold_all_children=true +use_indicators=true +line_wrapping=true +auto_close_xml_tags=true +complete_snippets=true +auto_complete_symbols=true +pref_editor_disable_dnd=false +pref_editor_smart_home_key=true +pref_editor_newline_strip=true +line_break_column=72 +auto_continue_multiline=true +comment_toggle_mark=~ +scroll_stop_at_last_line=true +autoclose_chars=31 +pref_editor_default_new_encoding=UTF-8 +pref_editor_default_open_encoding=WINDOWS-1251 +default_eol_character=2 +pref_editor_new_line=true +pref_editor_replace_tabs=false +pref_editor_trail_space=true +pref_toolbar_show=true +pref_toolbar_append_to_menu=false +pref_toolbar_icon_style=0 +pref_toolbar_icon_size=0 +pref_template_developer=Kolan Sh. +pref_template_company=InSys Ltd +pref_template_mail=mecareful@gmail.com +pref_template_initial=SNS +pref_template_version=1.0 +pref_template_year=%Y +pref_template_date=%Y-%m-%d +pref_template_datetime=%d.%m.%Y %H:%M:%S %Z +context_action_cmd= +sidebar_visible=true +statusbar_visible=true +msgwindow_visible=true +fullscreen=false +scribble_text= +scribble_pos=0 +treeview_position=0 +msgwindow_position=687 +geometry=3;30;1672;968;0; +custom_date_format= +sidebar_pos=0 +virtualspace=1 +color_scheme= +compiler_tab_autoscroll=true +tab_order_beside=false +msgwin_status_visible=true +msgwin_compiler_visible=true +msgwin_messages_visible=true +msgwin_scribble_visible=true +use_native_windows_dialogs=false +long_line_enabled=true +pref_toolbar_use_gtk_default_style=false +pref_toolbar_use_gtk_default_icon=true +gio_unsafe_save_backup=false +find_selection_type=0 +statusbar_template= +new_document_after_close=false +pref_editor_ensure_convert_line_endings=false + +[search] +pref_search_current_file_dir=true +find_all_expanded=false +replace_all_expanded=true +fif_mode=0 +fif_extra_options= +fif_case_sensitive=true +fif_match_whole_word=false +fif_invert_results=false +fif_recursive=false +fif_use_extra_options=false +position_find_x=90 +position_find_y=386 +position_replace_x=800 +position_replace_y=464 +position_fif_x=1154 +position_fif_y=409 +fif_regexp=false +fif_files= +fif_use_files=false + +[plugins] +load_plugins=true +custom_plugin_path=/home/kolan/.geany/plugins +active_plugins=/usr/lib64/geany/codenav.so;/usr/lib64/geany/geanyextrasel.so;/usr/lib64/geany/geanylatex.so;/usr/lib64/geany/spellcheck.so;/usr/lib64/geany/treebrowser.so;/usr/lib64/geany/classbuilder.so;/usr/lib64/geany/saveactions.so;/usr/lib64/geany/addons.so;/usr/lib64/geany/splitwindow.so;/usr/lib64/geany/shiftcolumn.so;/usr/lib64/geany/htmlchars.so;/usr/lib64/geany/export.so; + +[tools] +make_cmd=make +term_cmd=urxvt +browser_cmd=firefox +grep_cmd=grep + +[printing] +print_cmd= +use_gtk_printing=true +print_line_numbers=true +print_page_numbers=true +print_page_header=true +page_header_basename=false +page_header_datefmt=%c + +[VTE] +load_vte=true +emulation=xterm +font=Terminus 10 +scroll_on_key=true +scroll_on_out=true +enable_bash_keys=false +ignore_menu_bar_accel=false +follow_path=true +run_in_vte=true +skip_run_script=false +cursor_blinks=true +scrollback_lines=500 +shell=/bin/bash +colour_fore=#FFFFFF +colour_back=#000000 +last_dir=/home/kolan/projects/dataserver +send_selection_unsafe=false + +[project] +session_file=/home/kolan/projects/dataserver/dataserver.geany +project_file_path=/home/kolan/projects + +[files] +recent_files=/home/kolan/projects/dataserver/netfuncs.h;/home/kolan/projects/dataserver/netfuncs.c;/home/kolan/projects/dataserver/mpool.h;/home/kolan/projects/dataserver/mpool.c;/home/kolan/projects/dataserver/xerror.c;/home/kolan/projects/dataserver/xerror.h;/home/kolan/projects/dataserver/xmalloc.h;/home/kolan/projects/dataserver/xmalloc.c;/home/kolan/dev/c/malloc_speed_test/pool_list.c;/home/kolan/projects/dataserver/dataserver.c; +recent_projects=/home/kolan/projects/dataserver/dataserver.geany;dataserver.geany;/home/kolan/Projects/cpp/sockets/sockets.geany;/home/kolan/Projects/cpp/multithreading/pthread_ex.geany;/home/kolan/Projects/c/tmp2/tmp2.geany;/home/kolan/Projects/c/tmp1/tmp1.geany;/home/kolan/Projects/CPP/hello/hello.geany;/home/kolan/Projects/CPP/multithreading/pthread_ex.geany;/home/kolan/Projects/C/hello/hello.geany; +current_page=0 +FILE_NAME_0=6788;C;0;16;1;1;1;/home/kolan/projects/dataserver/dataserver.c;0 +FILE_NAME_1=0;C;0;16;1;1;1;/home/kolan/projects/dataserver/dataserver.h;0 +FILE_NAME_2=0;C;0;16;1;1;1;/home/kolan/projects/dataserver/echo-client.c;0 diff --git a/.config/geany/keybindings.conf b/.config/geany/keybindings.conf new file mode 100644 index 0000000..3cc9eaa --- /dev/null +++ b/.config/geany/keybindings.conf @@ -0,0 +1,245 @@ +#Keybindings for Geany +#The format looks like "a" or "F1". +#But you can also change the keys in Geany's preferences dialog. + +[Bindings] +menu_new=n +menu_open=o +menu_open_selected=o +menu_save=s +menu_saveas= +menu_saveall=s +menu_print=p +menu_close=w +menu_closeall=w +menu_reloadfile=r +project_properties= +menu_undo=z +menu_redo=y +edit_deleteline=k +edit_duplicateline=d +edit_transposeline=t +edit_scrolltoline=l +edit_scrolllineup=Up +edit_scrolllinedown=Down +edit_completesnippet=Tab +edit_suppresssnippetcompletion= +move_snippetnextcursor= +popup_contextaction= +edit_autocomplete=space +edit_calltip=space +edit_macrolist=Return +edit_deletelinetoend=Delete +menu_cut=x +menu_copy=c +menu_paste=v +edit_cutline=x +edit_copyline=c +menu_selectall=a +edit_selectword=w +edit_selectline=l +edit_selectparagraph=p +edit_togglecase=u +edit_commentlinetoggle=e +edit_commentline= +edit_uncommentline= +edit_increaseindent=i +edit_decreaseindent=u +edit_increaseindentbyspace= +edit_decreaseindentbyspace= +edit_autoindent= +edit_sendtocmd1=1 +edit_sendtocmd2=2 +edit_sendtocmd3=3 +edit_sendtovte= +format_reflowparagraph=j +menu_insert_date=d +edit_insertwhitespace= +menu_preferences=p +menu_find=f +menu_findnext=g +menu_findprevious=g +menu_findinfiles=f +menu_replace=h +menu_findnextsel= +menu_findprevsel= +menu_nextmessage= +menu_previousmessage= +popup_findusage= +popup_finddocumentusage= +find_markall=m +nav_forward= +nav_back= +menu_gotoline=l +edit_gotolinestart=Home +edit_gotolineend=End +edit_gotomatchingbrace=b +edit_togglemarker=m +edit_gotonextmarker=period +edit_gotopreviousmarker=comma +edit_prevwordstart=slash +edit_nextwordstart=backslash +popup_gototagdefinition= +popup_gototagdeclaration= +edit_gotolineendvisual=End +menu_toggleall= +menu_fullscreen=F11 +menu_messagewindow= +toggle_sidebar= +menu_zoomin=plus +menu_zoomout=minus +switch_editor=F2 +switch_scribble=F6 +switch_vte=F4 +switch_search_bar=F7 +switch_sidebar= +switch_compiler= +switch_tableft=Page_Up +switch_tabright=Page_Down +switch_tablastused=Tab +move_tableft=Page_Up +move_tabright=Page_Down +move_tabfirst= +move_tablast= +menu_replacetabs= +menu_replacespaces= +menu_togglefold= +menu_foldall= +menu_unfoldall= +reloadtaglist=r +menu_linewrap= +menu_linebreak= +build_compile=F8 +build_link=F9 +build_make=F9 +build_makeowntarget=F9 +build_makeobject= +build_nexterror= +build_previouserror= +build_run=F5 +build_run2= +build_options= +menu_opencolorchooser= +menu_help=F1 + +file_openlasttab= +edit_wordpartcompletion=Tab +edit_movelineup= +edit_movelinedown= +edit_selectwordpartleft= +edit_selectwordpartright= +menu_pluginpreferences= +normal_size=0 +switch_messages= +switch_message_window= +switch_sidebar_doc_list= +switch_sidebar_symbol_list= +remove_markers= +remove_error_indicators= + +[file_browser] +focus_file_list= +focus_path_entry= + +[split_window] +split_horizontal= +split_vertical= +split_unsplit= + +[html_chars] +insert_html_chars= +replace_special_characters= +htmltoogle_toggle_plugin_status= + +[code_navigation] +switch_head_impl=s +goto_file=g + +[extra_select] +column_mode= +goto_line_extend= +brace_match_extend= + +[debug] +"_Load"= +"_Unload"= +"_Run"= +"_Kill"= +"_Pause"= +"_Continue"= +"_Step"= +"Step _Into"= +"_Next"= +"Ne_xt in"= +"Run _To"= +"Sta_ck"= +"_Break"= +"_Watches"= +"_Finish"= +"_Return"= +"En_vironment"= +"_Options"= + +[geanylatex] +run_latex_wizard= +insert_latex_label= +insert_latex_ref= +insert_new_line= +latex_toggle_status= +latex_insert_environment= +latex_insert_item= +latex_replace_chars= +format_bold= +format_italic= +format_typewriter= +format_center= +format_left= +format_right= +insert_description_list= +insert_itemize_list= +insert_enumerate_list= +structure_lvl_up= +structure_lvl_down= +usepackage_dialog= +latex_insert_command= + +[geanylipsum] +insert_lipsum= + +[sendmail] +send_file_as_attachment= + +[geanyvc] +vc_show_diff_of_file= +vc_show_diff_of_dir= +vc_show_diff_of_basedir= +vc_commit= +vc_status= +vc_update= +vc_revert_file= +vc_revert_dir= +vc_revert_basedir= + +[insert_numbers] +insert_numbers= + +[spellcheck] +spell_check= +spell_toggle_typing= + +[prettyprinter] +run_pretty_printer_xml= + +[doc_chars] +Документация на слово под курсором= +Document interactive= + +[addons] +focus_bookmark_list= +focus_tasks= +update_tasks= +xml_tagging= + +[shiftcolumn] +shift_left=9 +shift_right=0 diff --git a/.fonts/lucon.ttf b/.fonts/lucon.ttf new file mode 100644 index 0000000..2885d7e Binary files /dev/null and b/.fonts/lucon.ttf differ diff --git a/.gqview/gqviewrc b/.gqview/gqviewrc new file mode 100644 index 0000000..96f13f0 --- /dev/null +++ b/.gqview/gqviewrc @@ -0,0 +1,243 @@ +###################################################################### +# GQview config file version 2.1.5 # +###################################################################### + +# Note: This file is autogenerated. Options can be changed here, +# but user comments and formatting will be lost. + +##### General Options ##### + +layout_style: 0 + +layout_order: "123" + +layout_view_as_icons: true + +layout_view_as_tree: true + +show_icon_names: true + + +tree_descend_folders: false + +lazy_image_sync: false + +update_on_time_change: true + +exif_auto_rotate: true + + +enable_startup_path: false + +startup_path: + +zoom_mode: fit +two_pass_scaling: true + +zoom_to_fit_allow_expand: true + + +fit_window_to_image: true + +limit_window_size: false + +max_window_size: 100 + + +progressive_keyboard_scrolling: false + +scroll_reset_method: 0 + + +enable_thumbnails: false + +thumbnail_width: 96 + +thumbnail_height: 72 + +cache_thumbnails: true + +cache_thumbnails_into_dirs: false + +thumbnail_fast: true + +use_xvpics_thumbnails: true + +thumbnail_spec_standard: true + + +local_metadata: false + + +sort_method: 1 + +sort_ascending: true + +sort_case_sensitive: false + + +confirm_delete: true + +enable_delete_key: true + +safe_delete: false + +safe_delete_path: "/home/kolan/.gqview/trash" +safe_delete_size: 20 + + +tools_float: false + +tools_hidden: false + +restore_tool_state: false + +toolbar_hidden: false + +mouse_wheel_scrolls: false + +in_place_rename: true + +open_recent_max: 10 + +image_cache_size_max: 10 + +thumbnail_quality: 1 + +zoom_quality: 2 + +dither_quality: 1 + +zoom_increment: 5 + +enable_read_ahead: true + +display_dialogs_under_mouse: false + +black_window_background: false + +fullscreen_screen: -1 + +fullscreen_clean_flip: false + +fullscreen_disable_saver: true + +fullscreen_above: false + +custom_similarity_threshold: 99 + + +##### Slideshow Options ##### + +slideshow_delay: 15.0 + +slideshow_random: false + +slideshow_repeat: false + + +##### Filtering Options ##### + +show_dotfiles: false + +disable_filtering: false + +filter_ext: "icns" ".icns" "Формат изображений ICNS" +filter_ext: "gif" ".gif" "Формат изображений GIF" +filter_ext: "bmp" ".bmp" "Формат изображений BMP" +filter_ext: "pnm" ".pnm;.pbm;.pgm;.ppm" "Семейство форматов изображений PNM/PBM/PGM/PPM" +filter_ext: "ico" ".ico;.cur" "Формат изображений ICO" +filter_ext: "ani" ".ani" "Формат изображений ANI" +filter_ext: "tga" ".tga;.targa" "Формат изображений Targa" +filter_ext: "ras" ".ras" "Формат растровых изображений компании Sun" +filter_ext: "jpeg" ".jpeg;.jpe;.jpg" "Формат изображений JPEG" +filter_ext: "qtif" ".qtif;.qif" "Формат изображений QTIF" +filter_ext: "xbm" ".xbm" "Формат изображений XBM" +filter_ext: "pcx" ".pcx" "Формат изображений PCX" +filter_ext: "xpm" ".xpm" "Формат изображения XPM" +filter_ext: "wbmp" ".wbmp" "Формат изображений WBMP" +filter_ext: "png" ".png" "Формат изображений PNG" +filter_ext: "#tiff" ".tif;.tiff" "Tiff" +filter_ext: "#svg" ".svg" "Scalable Vector Graphics" +filter_ext: "crw" ".crw;.cr2" "Canon raw format" +filter_ext: "raf" ".raf" "Fujifilm raw format" +filter_ext: "nef" ".nef" "Nikon raw format" +filter_ext: "orf" ".orf" "Olympus raw format" +filter_ext: "pef" ".pef" "Pentax raw format" + +##### Color Profiles ##### + +# NOTICE: GQview was not built with support for color profiles, +# color profile options will have no effect. + +color_profile_enabled: false + +color_profile_use_image: true + +color_profile_input_type: 0 + +color_profile_input_file_1: +color_profile_input_name_1: +color_profile_input_file_2: +color_profile_input_name_2: +color_profile_input_file_3: +color_profile_input_name_3: +color_profile_input_file_4: +color_profile_input_name_4: + +color_profile_screen_type: 0 + +color_profile_screen_file_1: + +##### External Programs ##### +# Maximum of 10 programs (external_1 through external_10) +# format: external_n: "menu name" "command line" + +external_1: "The Gimp" "gimp -n %f" +external_2: "XV" "xv %f" +external_3: "Xpaint" "xpaint %f" +external_4: "" "" +external_5: "" "" +external_6: "" "" +external_7: "" "" +external_8: "" "" +external_9: "Повернуть jpeg по часовой стрелк" "%vif jpegtran -rotate 90 -copy all -outfile %p_tmp %p; then mv %p_tmp %p;else rm %p_tmp;fi" +external_10: "Повернуть jpeg против часовой ст" "%vif jpegtran -rotate 270 -copy all -outfile %p_tmp %p; then mv %p_tmp %p;else rm %p_tmp;fi" + +##### Collection Options ##### + +rectangular_selections: false + + +##### Window Positions ##### + +restore_window_positions: false + + +main_window_x: 219 + +main_window_y: 43 + +main_window_width: 700 + +main_window_height: 500 + +main_window_maximized: false + +float_window_x: 0 + +float_window_y: 0 + +float_window_width: 260 + +float_window_height: 450 + +float_window_divider: 200 + +divider_position_h: 270 + +divider_position_v: 200 + +###################################################################### +# end of GQview config file # +###################################################################### diff --git a/.urxvt/Xdefaults b/.urxvt/Xdefaults new file mode 100644 index 0000000..253cf50 --- /dev/null +++ b/.urxvt/Xdefaults @@ -0,0 +1,109 @@ +URxvt*background: #000000 +URxvt*foreground: #C0C0C0 +URxvt.color0: rgb:46/70/73 +URxvt.color1: rgb:aa/00/00 +URxvt.color2: rgb:aa/aa/00 +URxvt.color3: rgb:77/77/00 +URxvt.color4: rgb:00/00/aa +URxvt.color5: rgb:aa/00/aa +URxvt.color6: rgb:00/aa/aa +URxvt.color7: rgb:aa/aa/aa +URxvt.color8: rgb:55/55/55 +URxvt.color9: rgb:ff/55/55 +URxvt.color10: rgb:33/bb/33 +URxvt.color11: rgb:ff/ff/55 +URxvt.color12: rgb:77/77/ff +URxvt.color13: rgb:ff/55/ff +URxvt.color14: rgb:55/ff/ff +URxvt.color15: rgb:ff/ff/ff + +! Имя терминала +URxvt*termName: rxvt + +! Будет ли курсор мигать +URxvt.cursorBlink: false +! Цвет курсора +!URxvt.cursorColor: yellow +! Цвет текста, находящегося под курсором +!URxvt.cursorColor2: red + +! Псевдопрозрачность - в кач-ве фона +! поставить обои рабочего стола +!URxvt*transparent: true +! Яркость прозрачного фона (-100 .. 100) +!URxvt*shading: 20 +! Та же псевдопрозрачность, без настройки яркости +!URxvt.inheritPixmap: true +! Цвет окрашивания прозрачного фона +!URxvt*tintColor: #558888 + +! Иконка окна терминала +!URxvt*iconFile: /usr/share/pixmaps/gnome-terminal.xpm + +! Настройки шрифтов +URxvt*font:-xos4-terminus-medium-r-normal--12-*-*-*-*-*-u +! Горячие клавиши для изменения размера шрифта "на лету" +! (Ctrl-1 - норма, Ctrl-2 - увеличить до 24) +URxvt.keysym.C-1: command:\033]710;-xos4-terminus-medium-r-normal--12-*-*-*-*-*-u\007\033]711;-xos4-terminus-bold-r-normal--12-*-*-*-*-*-u\007 +URxvt.keysym.C-2: command:\033]710;-xos4-terminus-medium-r-normal--14-*-*-*-*-*-u\007\033]711;-xos4-terminus-bold-r-normal--14-*-*-*-*-*-u\007 +URxvt.keysym.C-3: command:\033]710;-xos4-terminus-medium-r-normal--16-*-*-*-*-*-u\007\033]711;-xos4-terminus-bold-r-normal--16-*-*-*-*-*-u\007 + +! Цвета в man-страницах +URxvt.colorMode: on +URxvt.boldColors: on +URxvt.dynamicColors: on +URxvt.colorULMode: on +URxvt.underLine: off +URxvt.colorBDMode: on +!URxvt.colorBD: cyan + +! Скроллинг + скроллбар +URxvt*scrollBar: true +URxvt*scrollBar_right: true +URxvt*scrollstyle: plain + +! Отображать символ табуляции как один широкий символ +! (иначе - как перемещения курсора) +URxvt.pastableTabs: true + +!=== НАСТРОЙКИ ОБРАБОТКИ ССЫЛОК === +! Внешняя программа для открытия ссылок +URxvt.urlLauncher: firefox +! Кнопка мыши, которая открывает ссылку +URxvt.matcher.button: 1 +! Горячие клавиши для выделения ссылок (Alt+U), +! после выделения ссылка открывается по Enter +!URxvt.keysym.M-u: perl:url-select:select_next +! Выделять ссылки голубым цветом +URxvt.colorUL: #86a2be +! Подчеркивать ссылки +URxvt.underlineURLs: true +!URxvt.underlineColor: yellow + +!=== НАСТРОЙКИ ФУНКЦИОНАЛА === +! Сколько строк хранить в памяти +URxvt*saveLines: 5000 +! Настройки табов +URxvt.tabbed.new-button: no +URxvt.tabbed.tabbar-fg: 7 +URxvt.tabbed.tabbar-bg: 0 +URxvt.tabbed.tab-fg: 0 +URxvt.tabbed.tab-bg: 7 +! Оболочка +URxvt.geometry: 128x64 +URxvt.loginShell: false +URxvt.meta: ignore +URxvt.utmpInhibit: true + +!=== НАСТРОЙКИ РАСШИРЕНИЙ === +! Путь для поиска пользовательских расширений +URxvt.perl-lib: .urxvt/perl/ +! Загружаемые по умолчанию расширения +! Основные; расширенные табы (без кнопки NEW, можно устанавливать +! заголовок окна: https://github.com/stepb/urxvt-tabbedex); +! регэкспы для выделения ссылок в тексте; выбор ссылок горячими +! клавишами); копирование в буфер обмена +! URxvt*perl-ext: tabbed,clipboard-osc,confirm-paste,matcher,option-popup,overlay-osc,readline,remote-clipboard,searchable-scrollback,selection,selection- autotransform,selection-pastbin,selection-popup,xim-onthespot +!URxvt.perl-ext-common: default,tabbedex,matcher,url-select,clipboard-osc +URxvt*perl-ext: default,tabbedex,matcher,url-select,clipboard-osc,searchable-scrollback + diff --git a/.urxvt/perl/tabbedex b/.urxvt/perl/tabbedex new file mode 100644 index 0000000..e377a9a --- /dev/null +++ b/.urxvt/perl/tabbedex @@ -0,0 +1,635 @@ +#! perl +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +## +## Tabbed plugin for rxvt-unicode +## Modified by Michal Nazarewicz (mina86/AT/mina86.com), StephenB +## (mail4stb/AT/gmail.com) and Steven Merrill +## +## +## The following has been added: +## +## 1. Depending on time of last activity, activity character differs. +## By default, after 4 seconds an asterisk becomes a plus sing, +## after next 4 it becomes a colon, and finally, after another 8 +## seconds it becomes a dot. This can be configured via +## tabbar-timeouts resource. It's format is: +## +## ( ":" ":" )* ":" ":" +## +## where is timeout in seconds and is +## a single activity character. +## +## 2. The "[NEW]" button can be disabled (who on Earth uses mouse to +## create new tab anyways?) by setting new-button resource to yes. +## +## 3. If title resource is true, tab's title is displayed after last +## button. This is handy if you have terminal with no window +## decorations. Colours can be configured via title-fg and +## title-bg. +## +## 4. Incorporated Alexey Semenko patch adding +## autohide resource. If it's true tab bar is hidden if there is +## no more then one tab opened. +## +## 5. Tabs are indexed in starting with zero hex. :] If you're such +## a geek to use urxvt it shouldn't be a problem for you and it +## saves few character when many tabs are opened. +## +## 6. As a minor modification: Final pipe character is removed (unless +## title is displayed). This make tab bar look nicer. +## +## Added by StephenB: +## +## 7. Tabs can be named with Shift+Up (Enter to confirm, Escape to +## cancel). +## +## 8. "[NEW]" button disabled by default. +## +## Added by Steven Merrill +## +## 9. Ability to start a new tab or cycle through tabs via user +## commands: tabbedex:(new|next|prev)_tab . +## e.g. (in .Xdefaults) URxvt.keysym.M-t: perl:tabbedex:new_tab +## (see the urxvt man file for more info about keysym) +## +## 10. Fix an issue whereby on_user_command would not properly get sent +## to other extension packages if the mouse was not over the urxvt +## window. +## + + +sub update_autohide { + my ($self, $reconfigure) = @_; + my $oldh = $self->{tabheight}; + if ($self->{autohide} && @{ $self->{tabs} } <= 1 && + ! (@{ $self->{tabs} } == 1 && $self->{tabs}[-1]->{name})) { + $self->{tabheight} = 0; + } else { + $self->{tabheight} = $self->{maxtabheight}; + } + if ($reconfigure && $self->{tabheight} != $oldh) { + $self->configure; + $self->copy_properties; + } +} + + +sub tab_activity_mark ($$) { + my ($self, $tab) = @_; + return ' ' unless defined $tab->{lastActivity}; + return ' ' if $tab == $self->{cur}; + if (defined $self->{timeouts}) { + my $diff = int urxvt::NOW - $tab->{lastActivity}; + for my $spec (@{ $self->{timeouts} }) { + return $spec->[1] if $diff > $spec->[0]; + } + } + '*'; +} + + +sub refresh { + my ($self) = @_; + + # autohide makes it zero + return unless $self->{tabheight}; + + my $ncol = $self->ncol; + + my $text = " " x $ncol; + my $rend = [($self->{rs_tabbar}) x $ncol]; + + my ($ofs, $idx, @ofs) = (0, 0); + + if ($self->{new_button}) { + substr $text, 0, 7, "[NEW] |"; + @$rend[0 .. 5] = ($self->{rs_tab}) x 6; + push @ofs, [0, 6, -1 ]; + $ofs = 7; + } + + for my $tab (@{ $self->{tabs} }) { + my $name = $tab->{name} ? $tab->{name} : $idx; + my $act = $self->tab_activity_mark($tab); + my $txt = sprintf "%s%s%s", $act, $name, $act; + my $len = length $txt; + + substr $text, $ofs, $len + 1, "$txt|"; + @$rend[$ofs .. $ofs + $len - 1] = ($self->{rs_tab}) x $len + if $tab == $self->{cur}; + + push @ofs, [ $ofs, $ofs + $len, $idx ]; + ++$idx; + $ofs += $len + 1; + } + + substr $text, --$ofs, 1, ' '; # remove last '|' + + if ($self->{tab_title} && $ofs + 3 < $ncol) { + my $term = $self->{term}; + my @str = $term->XGetWindowProperty($term->parent, $self->{tab_title}); + if (@str && $str[2]) { + my $str = '| ' . $str[2]; + my $len = length $str; + $len = $ncol - $ofs if $ofs + $len > $ncol; + substr $text, $ofs, $len, substr $str, 0, $len; + @$rend[$ofs + 2 .. $ofs + $len - 1] = ($self->{rs_title}) x ($len - 2); + } + } + + $self->{tabofs} = \@ofs; + + $self->ROW_t (0, $text, 0, 0, $ncol); + $self->ROW_r (0, $rend, 0, 0, $ncol); + + $self->want_refresh; +} + + +sub new_tab { + my ($self, @argv) = @_; + + my $offset = $self->fheight; + + $self->{tabheight} = $self->{maxtabheight} + unless $self->{autohide} && !(defined $self->{tabs} && @{ $self->{tabs} }); + + # save a backlink to us, make sure tabbedex is inactive + push @urxvt::TERM_INIT, sub { + my ($term) = @_; + $term->{parent} = $self; + + for (0 .. urxvt::NUM_RESOURCES - 1) { + my $value = $self->{resource}[$_]; + + $term->resource ("+$_" => $value) + if defined $value; + } + + $term->resource (perl_ext_2 => $term->resource ("perl_ext_2") . ",-tabbedex"); + }; + + push @urxvt::TERM_EXT, urxvt::ext::tabbedex::tab::; + + my $term = new urxvt::term + $self->env, $urxvt::RXVTNAME, + -embed => $self->parent, + @argv; +} + + +sub configure { + my ($self) = @_; + + my $tab = $self->{cur}; + + # this is an extremely dirty way to force a configurenotify, but who cares + $tab->XMoveResizeWindow ( + $tab->parent, + 0, $self->{tabheight} + 1, + $self->width, $self->height - $self->{tabheight} + ); + $tab->XMoveResizeWindow ( + $tab->parent, + 0, $self->{tabheight}, + $self->width, $self->height - $self->{tabheight} + ); +} + + +sub copy_properties { + my ($self) = @_; + my $tab = $self->{cur}; + + my $wm_normal_hints = $self->XInternAtom ("WM_NORMAL_HINTS"); + + my $current = delete $self->{current_properties}; + + # pass 1: copy over properties different or nonexisting + for my $atom ($tab->XListProperties ($tab->parent)) { + my ($type, $format, $items) = $self->XGetWindowProperty ($tab->parent, $atom); + + # fix up size hints + if ($atom == $wm_normal_hints) { + my (@hints) = unpack "l!*", $items; + + $hints[$_] += $self->{tabheight} for (4, 6, 16); + + $items = pack "l!*", @hints; + } + + my $cur = delete $current->{$atom}; + + # update if changed, we assume empty items and zero type and format will not happen + $self->XChangeProperty ($self->parent, $atom, $type, $format, $items) + if $cur->[0] != $type or $cur->[1] != $format or $cur->[2] ne $items; + + $self->{current_properties}{$atom} = [$type, $format, $items]; + } + + # pass 2, delete all extraneous properties + $self->XDeleteProperty ($self->parent, $_) for keys %$current; +} + + +sub make_current { + my ($self, $tab) = @_; + + if (my $cur = $self->{cur}) { + delete $cur->{lastActivity}; + $cur->XUnmapWindow ($cur->parent) if $cur->mapped; + $cur->focus_out; + } + + $self->{cur} = $tab; + + $self->configure; + $self->copy_properties; + + $tab->focus_out; # just in case, should be a nop + $tab->focus_in if $self->focus; + + $tab->XMapWindow ($tab->parent); + delete $tab->{lastActivity}; + $self->refresh; + + (); +} + + +sub on_focus_in { + my ($self, $event) = @_; + $self->{cur}->focus_in; + (); +} + +sub on_focus_out { + my ($self, $event) = @_; + $self->{cur}->focus_out; + (); +} + +sub on_key_press { + my ($self, $event) = @_; + $self->{cur}->key_press ($event->{state}, $event->{keycode}, $event->{time}); + 1; +} + +sub on_key_release { + my ($self, $event) = @_; + $self->{cur}->key_release ($event->{state}, $event->{keycode}, $event->{time}); + 1; +} + +sub on_button_release { + my ($self, $event) = @_; + + if ($event->{row} == 0) { + my $col = $event->{col}; + for my $button (@{ $self->{tabofs} }) { + last if $col < $button->[0]; + next unless $col <= $button->[1]; + if ($button->[2] == -1) { + $self->new_tab; + } else { + $self->make_current($self->{tabs}[$button->[2]]); + } + } + return 1; + } + + (); +} + +sub on_init { + my ($self) = @_; + + $self->{resource} = [map $self->resource ("+$_"), 0 .. urxvt::NUM_RESOURCES - 1]; + + $self->resource (int_bwidth => 0); + $self->resource (name => "URxvt.tabbed"); + $self->resource (pty_fd => -1); + + $self->option ($urxvt::OPTION{scrollBar}, 0); + + my $fg = $self->x_resource ("tabbar-fg"); + my $bg = $self->x_resource ("tabbar-bg"); + my $tabfg = $self->x_resource ("tab-fg"); + my $tabbg = $self->x_resource ("tab-bg"); + my $titfg = $self->x_resource ("title-fg"); + my $titbg = $self->x_resource ("title-bg"); + + defined $fg or $fg = 3; + defined $bg or $bg = 0; + defined $tabfg or $tabfg = 0; + defined $tabbg or $tabbg = 1; + defined $titfg or $titfg = 2; + defined $titbg or $titbg = 0; + + $self->{rs_tabbar} = urxvt::SET_COLOR (urxvt::DEFAULT_RSTYLE, $fg + 2, $bg + 2); + $self->{rs_tab} = urxvt::SET_COLOR (urxvt::DEFAULT_RSTYLE, $tabfg + 2, $tabbg + 2); + $self->{rs_title} = urxvt::SET_COLOR (urxvt::DEFAULT_RSTYLE, $titfg + 2, $titbg + 2); + + + my $timeouts = $self->x_resource ("tabbar-timeouts"); + $timeouts = '16:.:8:::4:+' unless defined $timeouts; + if ($timeouts ne '') { + my @timeouts; + while ($timeouts =~ /^(\d+):(.)(?::(.*))?$/) { + push @timeouts, [ int $1, $2 ]; + $timeouts = defined $3 ? $3 : ''; + } + if (@timeouts) { + $self->{timeouts} = [ sort { $b->[0] <=> $a-> [0] } @timeouts ]; + } + } + + $self->{new_button} = + ($self->x_resource ('new-button') or 'false') !~ /^(?:false|0|no)/i; + $self->{tab_title} = + ($self->x_resource ('title') or 'true') !~ /^(?:false|0|no)/i; + $self->{autohide} = + ($self->x_resource ('autohide') or 'false') !~ /^(?:false|0|no)/i; + + (); +} + + +sub on_start { + my ($self) = @_; + + $self->{maxtabheight} = $self->int_bwidth + $self->fheight + $self->lineSpace; + $self->{tabheight} = $self->{autohide} ? 0 : $self->{maxtabheight}; + + $self->{running_user_command} = 0; + + $self->cmd_parse ("\033[?25l"); + + my @argv = $self->argv; + + do { + shift @argv; + } while @argv && $argv[0] ne "-e"; + + if ($self->{tab_title}) { + $self->{tab_title} = $self->{term}->XInternAtom("WM_NAME", 1); + } + + $self->new_tab (@argv); + + if (defined $self->{timeouts}) { + my $interval = ($self->{timeouts}[@{ $self->{timeouts} } - 1]->[0]); + $interval = int($interval / 4); + $self->{timer} = urxvt::timer->new + ->interval($interval < 1 ? 1 : $interval) + ->cb ( sub { $self->refresh; } ); + } + + (); +} + + +sub on_configure_notify { + my ($self, $event) = @_; + + $self->configure; + $self->refresh; + + (); +} + + +sub on_user_command { + my ($self, $event) = @_; + + $self->{cur}->{term}->{parent}->tab_user_command($self->{cur}, $event, 1); + + (); +} + + +sub on_wm_delete_window { + my ($self) = @_; + $_->destroy for @{ $self->{tabs} }; + 1; +} + + +sub tab_start { + my ($self, $tab) = @_; + + $tab->XChangeInput ($tab->parent, urxvt::PropertyChangeMask); + + push @{ $self->{tabs} }, $tab; + +# $tab->{name} ||= scalar @{ $self->{tabs} }; + $self->make_current ($tab); + + (); +} + + +sub tab_destroy { + my ($self, $tab) = @_; + + $self->{tabs} = [ grep $_ != $tab, @{ $self->{tabs} } ]; + $self->update_autohide (); + + if (@{ $self->{tabs} }) { + if ($self->{cur} == $tab) { + delete $self->{cur}; + $self->make_current ($self->{tabs}[-1]); + } else { + $self->refresh; + } + } else { + # delay destruction a tiny bit + $self->{destroy} = urxvt::iw->new->start->cb (sub { $self->destroy }); + } + + (); +} + + +sub tab_key_press { + my ($self, $tab, $event, $keysym, $str) = @_; + + # setting binding keys + #open FILE, ">/tmp/key.txt" or die $!; + #printf FILE $keysym; + #close FILE; + + if ($tab->{is_inputting_name}) { + if ($keysym == 0xff0d || $keysym == 0xff8d) { # enter + $tab->{name} = $tab->{new_name}; + $tab->{is_inputting_name} = 0; + $self->update_autohide (1); + } elsif ($keysym == 0xff1b) { # escape + $tab->{name} = $tab->{old_name}; + $tab->{is_inputting_name} = 0; + $self->update_autohide (1); + } elsif ($keysym == 0xff08) { # backspace + substr $tab->{new_name}, -1, 1, ""; + $tab->{name} = "$tab->{new_name}█"; + } elsif ($str !~ /[\x00-\x1f\x80-\xaf]/) { + $tab->{new_name} .= $str; + $tab->{name} = "$tab->{new_name}█"; + } + $self->refresh; + return 1; + } + + if ($event->{state} & urxvt::ControlMask) { + + # previous tab + if ($keysym == 0x004a || $keysym == 0x006a) { + if (@{ $self->{tabs} } > 1) { + $self->change_tab($tab, -1); + } + return 1; + } + + # next tab + if ($keysym == 0x004b || $keysym == 0x006b) { + if (@{ $self->{tabs} } > 1) { + $self->change_tab($tab, 1); + } + return 1; + } + + + # new tab + if ($keysym == 0x003b) { + $self->new_tab; + return 1; + + # tab title + } elsif ($keysym == 0x0054 || $keysym == 0x0074) { + $tab->{is_inputting_name} = 1; + $tab->{old_name} = $tab->{name} ? $tab->{name} : ""; + $tab->{new_name} = ""; + $tab->{name} = "█"; + $self->update_autohide (1); + $self->refresh; + return 1; + } + + # move tab left + if ($keysym == 0x0048 || $keysym == 0x0068) { + if (@{ $self->{tabs} } > 1) { + my $idx1 = 0; + ++$idx1 while $self->{tabs}[$idx1] != $tab; + my $idx2 = ($idx1 - 1) % @{ $self->{tabs} }; + + ($self->{tabs}[$idx1], $self->{tabs}[$idx2]) = + ($self->{tabs}[$idx2], $self->{tabs}[$idx1]); + $self->make_current ($self->{tabs}[$idx2]); + } + return 1; + } + + # move tab right + if ($keysym == 0x0047 || $keysym == 0x0067) { + if (@{ $self->{tabs} } > 1) { + my $idx1 = 0; + ++$idx1 while $self->{tabs}[$idx1] != $tab; + my $idx2 = ($idx1 + 1) % @{ $self->{tabs} }; + + ($self->{tabs}[$idx1], $self->{tabs}[$idx2]) = + ($self->{tabs}[$idx2], $self->{tabs}[$idx1]); + $self->make_current ($self->{tabs}[$idx2]); + } + return 1; + } + } + + (); +} + + +sub tab_property_notify { + my ($self, $tab, $event) = @_; + + $self->copy_properties + if $event->{window} == $tab->parent; + + (); +} + + +sub tab_add_lines { + my ($self, $tab) = @_; + my $mark = $self->tab_activity_mark($tab); + $tab->{lastActivity} = int urxvt::NOW; + $self->refresh if $mark ne $self->tab_activity_mark($tab); + (); +} + + +sub tab_user_command { + my ($self, $tab, $cmd, $proxy_events) = @_; + + if ($cmd eq 'tabbedex:new_tab') { + $self->new_tab; + } + elsif ($cmd eq 'tabbedex:next_tab') { + $self->change_tab($tab, 1); + } + elsif ($cmd eq 'tabbedex:prev_tab') { + $self->change_tab($tab, -1); + } + else { + # Proxy the user command through to the tab's term, while taking care not + # to get caught in an infinite loop. + if ($proxy_events && $self->{running_user_command} == 0) { + $self->{running_user_command} = 1; + urxvt::invoke($tab->{term}, 20, $cmd); + $self->{running_user_command} = 0; + } + } + + (); +} + +sub change_tab { + my ($self, $tab, $direction) = @_; + + my $idx = 0; + ++$idx while $self->{tabs}[$idx] != $tab; + $idx += $direction; + $self->make_current ($self->{tabs}[$idx % @{ $self->{tabs}}]); + + (); +} + +package urxvt::ext::tabbedex::tab; + +# helper extension implementing the subwindows of a tabbed terminal. +# simply proxies all interesting calls back to the tabbedex class. + +{ + for my $hook qw(start destroy user_command key_press property_notify add_lines) { + eval qq{ + sub on_$hook { + my \$parent = \$_[0]{term}{parent} + or return; + \$parent->tab_$hook (\@_) + } + }; + die if $@; + } +} + + diff --git a/.vim/plugin/VimExplorer.vim b/.vim/plugin/VimExplorer.vim new file mode 100644 index 0000000..4ef4127 --- /dev/null +++ b/.vim/plugin/VimExplorer.vim @@ -0,0 +1,3538 @@ +"================================================== +" File: VimExplorer.vim +" Brief: VE - the File Manager within Vim! +" Authors: Ming Bai +" Last Change: 2009-05-06 00:20:25 +" Version: 0.99 +" Licence: LGPL +" +" Usage: :h VimExplorer +" +"================================================== + + +" See if we are already loaded, thanks to Dennis Hostetler. +if exists("loaded_vimExplorer") + finish +else + let loaded_vimExplorer = 1 +endif +" + +" Vim version 7.x is needed. +if v:version < 700 + echohl ErrorMsg | echomsg "VimExplorer needs vim version >= 7.0!" | echohl None + finish +endif + +"Load config {{{1 +"####################################################################### +"VimExplorer configuration. +" +let VEConf = {} + +"Normal configurations. + +"Common settings +"========================================== + +"Important! It is used to do iconv() to the path when calling +"sytem() function. Mine is Simplified Chinese (cp936). +if exists("g:VEConf_systemEncoding") + let VEConf.systemEncoding = g:VEConf_systemEncoding +else + let VEConf.systemEncoding = '' +endif + +"VimExplorer will check all the disks in this list at startup. +"Delete some of these to fit your system can increase start up +"speed. +"let VEConf.win32Disks = ["C:","D:","E:"] +if exists("g:VEConf_win32Disks") + let VEConf.win32Disks = g:VEConf_win32Disks +else + let VEConf.win32Disks = ["A:","B:","C:","D:","E:","F:","G:","H:", + \"I:","J:","K:","L:","M:","N:","O:","P:","Q:","R:", + \"S:","T:","U:","V:","W:","X:","Y:","Z:"] +endif + +"Set the forward and backward history stack depth. +if exists("g:VEConf_browseHistory") + let VEConf.browseHistory = g:VEConf_browseHistory +else + let VEConf.browseHistory = 100 +endif + +"Split location of preview window +if exists("g:VEConf_previewSplitLocation") + let VEConf.previewSplitLocation = g:VEConf_previewSplitLocation +else + let VEConf.previewSplitLocation = "belowright" +endif + +"Show hidden files ( .* ) +if exists("g:VEConf_showHiddenFiles") + let VEConf.showHiddenFiles = VEConf_showHiddenFiles +else + let VEConf.showHiddenFiles = 1 +endif + +"External explorer name +if (has("win32") || has("win95") || has("win64") || has("win16") || has("dos32")) + if exists("g:VEConf_externalExplorer") + let VEConf.externalExplorer = g:VEConf_externalExplorer + else + let VEConf.externalExplorer = "explorer.exe" + endif +else + if exists("g:VEConf_externalExplorer") + let VEConf.externalExplorer = g:VEConf_externalExplorer + else + let VEConf.externalExplorer = "nautilus" + endif +endif + +"Sort case sensitive , for everything +if exists("g:VEConf_sortCaseSensitive") + let VEConf.sortCaseSensitive = g:VEConf_sortCaseSensitive +else + let VEConf.sortCaseSensitive = 0 +endif + +"favorite file name +if exists("g:VEConf_favorite") + let VEConf.favorite = g:VEConf_favorite +else + let VEConf.favorite = ".ve_favorite" +endif + +"Overwrite existing files. +"boverWrite 0 ask, 1 allyes, 2 allno +if exists("g:VEConf_overWriteExisting") + let VEConf.overWriteExisting = g:VEConf_overWriteExisting +else + let VEConf.overWriteExisting = 0 +endif + +"Kde or gonme. +if !exists("g:VEConf_usingKDE") + let g:VEConf_usingKDE = 0 +endif +if !exists("g:VEConf_usingGnome") + let g:VEConf_usingGnome = 0 +endif + +"Recycle path +if !exists("g:VEConf_recyclePath") + let g:VEConf.recyclePath = '' +else + let g:VEConf.recyclePath = g:VEConf_recyclePath +endif + +"Tree panel settings +"========================================== + +"Show '+' before empty folders. +"It will cause a little performance lost. +if exists("g:VEConf_showFolderStatus") + let VEConf.showFolderStatus = g:VEConf_showFolderStatus +else + let VEConf.showFolderStatus = 1 +endif + +"Tree panel width +if exists("g:VEConf_treePanelWidth") + let VEConf.treePanelWidth = g:VEConf_treePanelWidth +else + let VEConf.treePanelWidth = 30 +endif + +"Split mode of tree panel +if exists("g:VEConf_treePanelSplitMode") + let VEConf.treePanelSplitMode = g:VEConf_treePanelSplitMode +else + let VEConf.treePanelSplitMode = "vertical" +endif + +"Split location of file panel +if exists("g:VEConf_treePanelSplitLocation") + let VEConf.treePanelSplitLocation = g:VEConf_treePanelSplitLocation +else + let VEConf.treePanelSplitLocation = "leftabove" +endif + +"Set the tree panel sort direction. +if exists("g:VEConf_treeSortDirection") + let VEConf.treeSortDirection = g:VEConf_treeSortDirection +else + let VEConf.treeSortDirection = 1 +endif + +"File panel settings +"========================================== + +"Set the file group sort direction. +if exists("g:VEConf_fileGroupSortDirection") + let VEConf.fileGroupSortDirection = g:VEConf_fileGroupSortDirection +else + let VEConf.fileGroupSortDirection = 1 +endif + +"Delete file confirm. +if exists("g:VEConf_fileDeleteConfirm") + let VEConf.fileDeleteConfirm = g:VEConf_fileDeleteConfirm +else + let VEConf.fileDeleteConfirm = 1 +endif + +"File panel width +if exists("g:VEConf_filePanelWidth") + let VEConf.filePanelWidth = g:VEConf_filePanelWidth +else + let VEConf.filePanelWidth = 40 +endif + +"Split mode of file panel +if exists("g:VEConf_filePanelSplitMode") + let VEConf.filePanelSplitMode = g:VEConf_filePanelSplitMode +else + let VEConf.filePanelSplitMode = "vertical" +endif + +"Split location of file panel +if exists("g:VEConf_filePanelSplitLocation") + let VEConf.filePanelSplitLocation = g:VEConf_filePanelSplitLocation +else + let VEConf.filePanelSplitLocation = "belowright" +endif + +"File panel sort type. +if exists("g:VEConf_filePanelSortType") + let VEConf.filePanelSortType = g:VEConf_filePanelSortType +else + let VEConf.filePanelSortType = 0 +endif + +"Show file size in M/K/B +if exists("g:VEConf_showFileSizeInMKB") + let VEConf.showFileSizeInMKB = g:VEConf_showFileSizeInMKB +else + let VEConf.showFileSizeInMKB = 1 +endif + +"File panel filter. +if exists("g:VEConf_filePanelFilter") + let VEConf.filePanelFilter = g:VEConf_filePanelFilter +else + let VEConf.filePanelFilter = '' +endif + + +"####################################################################### +"Tree panel hot key bindings. +let VEConf.treePanelHotkey = {} +let VEConf.treePanelHotkey.help = '?' +let VEConf.treePanelHotkey.toggleNode = '' +let VEConf.treePanelHotkey.toggleNodeMouse = '<2-LeftMouse>' +let VEConf.treePanelHotkey.refresh = 'r' +let VEConf.treePanelHotkey.favorite = 'f' +let VEConf.treePanelHotkey.addToFavorite = 'F' +let VEConf.treePanelHotkey.browseHistory = 'b' +let VEConf.treePanelHotkey.toggleFilePanel = 't' +let VEConf.treePanelHotkey.toUpperDir = '' +let VEConf.treePanelHotkey.switchPanel = '' +let VEConf.treePanelHotkey.gotoPath = '' +let VEConf.treePanelHotkey.quitVE = 'Q' + +if exists("g:VEConf_treeHotkey") + if type(g:VEConf_treeHotkey) != type({}) + echohl WarningMsg | echo "g:VEConf_treeHotkey is not dictionary type!" | echohl None + finish + endif + for i in keys(g:VEConf_treeHotkey) + let VEConf.treePanelHotkey[i] = g:VEConf_treeHotkey[i] + endfor +endif + +"File panel hot key bindings. +"normal mode hotkeys +let VEConf.filePanelHotkey = {} +"normal +let VEConf.filePanelHotkey.help = '?' +let VEConf.filePanelHotkey.itemClicked = '' +let VEConf.filePanelHotkey.itemClickMouse = '<2-LeftMouse>' +let VEConf.filePanelHotkey.refresh = 'r' +let VEConf.filePanelHotkey.toggleTreePanel = 't' +let VEConf.filePanelHotkey.toggleModes = 'i' +let VEConf.filePanelHotkey.newFile = '+f' +let VEConf.filePanelHotkey.newDirectory = '+d' +let VEConf.filePanelHotkey.switchPanel = '' +let VEConf.filePanelHotkey.quitVE = 'Q' +let VEConf.filePanelHotkey.toggleHidden = 'H' +let VEConf.filePanelHotkey.search = 'g/' +let VEConf.filePanelHotkey.markPlace = 'm' +let VEConf.filePanelHotkey.gotoPlace = "'" +let VEConf.filePanelHotkey.viewMarks = 'J' +let VEConf.filePanelHotkey.contextMenuN = '' +"Browsing +let VEConf.filePanelHotkey.toUpperDir = '' +let VEConf.filePanelHotkey.gotoForward = '' +let VEConf.filePanelHotkey.gotoBackward = '' +let VEConf.filePanelHotkey.favorite = 'f' +let VEConf.filePanelHotkey.addToFavorite = 'F' +let VEConf.filePanelHotkey.browseHistory = 'b' +let VEConf.filePanelHotkey.gotoPath = '' +"single file actions +let VEConf.filePanelHotkey.rename = 'R' +let VEConf.filePanelHotkey.yankSingle = 'yy' +let VEConf.filePanelHotkey.cutSingle = 'xx' +let VEConf.filePanelHotkey.showYankList = 'yl' +let VEConf.filePanelHotkey.deleteSingle = 'dd' +let VEConf.filePanelHotkey.deleteSingleF = 'DD' +let VEConf.filePanelHotkey.openPreview = 'u' +let VEConf.filePanelHotkey.closePreview = 'U' +"mark +let VEConf.filePanelHotkey.toggleSelectUp = '' +let VEConf.filePanelHotkey.toggleSelectDown= '' +let VEConf.filePanelHotkey.toggleSelMouse = '' +let VEConf.filePanelHotkey.markViaRegexp = 'Mr' +let VEConf.filePanelHotkey.markVimFiles = 'Mv' +let VEConf.filePanelHotkey.markDirectory = 'Md' +let VEConf.filePanelHotkey.markExecutable = 'Me' +let VEConf.filePanelHotkey.clearSelect = 'Mc' +"multiple file actions +let VEConf.filePanelHotkey.deleteSelected = 'sd' +let VEConf.filePanelHotkey.deleteSelectedF = 'sD' +let VEConf.filePanelHotkey.yankSelected = 'sy' +let VEConf.filePanelHotkey.cutSelected = 'sx' +let VEConf.filePanelHotkey.tabViewMulti = 'se' +let VEConf.filePanelHotkey.paste = 'p' +let VEConf.filePanelHotkey.diff2files = '=' +"visual mode hotkeys. +let VEConf.filePanelHotkey.visualSelect = '' +let VEConf.filePanelHotkey.visualDelete = 'd' +let VEConf.filePanelHotkey.visualDeleteF = 'D' +let VEConf.filePanelHotkey.visualYank = 'y' +let VEConf.filePanelHotkey.visualCut = 'x' +"User defined hotkeys, see below. +let VEConf.filePanelHotkey.tabView = 'e' +let VEConf.filePanelHotkey.openRenamer = ';r' +let VEConf.filePanelHotkey.startShell = ';c' +let VEConf.filePanelHotkey.startExplorer = ';e' + +if exists("g:VEConf_fileHotkey") + if type(g:VEConf_fileHotkey) != type({}) + echohl WarningMsg | echo "g:VEConf_fileHotkey is not dictionary type!" | echohl None + finish + endif + for i in keys(g:VEConf_fileHotkey) + let VEConf.filePanelHotkey[i] = g:VEConf_fileHotkey[i] + endfor +endif + +"####################################################################### +"User defined file actions. +if !exists("g:VEConf_normalActions") + let VEConf_normalActions = {} +endif +if !exists("g:VEConf_normalHotKeys") + let VEConf_normalHotKeys = {} +endif +if !exists("g:VEConf_singleFileActions") + let VEConf_singleFileActions = {} +endif +if !exists("g:VEConf_singleFileHotKeys") + let VEConf_singleFileHotKeys = {} +endif + +if !exists("g:VEConf_multiFileActions") + let VEConf_multiFileActions = {} +endif +if !exists("g:VEConf_multiFileHotKeys") + let VEConf_multiFileHotKeys = {} +endif + +"Template +" let VEConf_singleFileHotKeys['actionName'] = '' +" function! VEConf_singleFileActions['actionName'](path) +" "do some jobs here. +" endfunction +" +"the 'path' is the file name under cursor in the file panel, you +"can use this path to do some actions. +"Pay attention to the hotKeys you have defined, dont conflict +"whth the default hotKey bindings. +"Normal Actions just run in current path, no path needed to +"pass. + +"There are some examples: +"Open current file using vim in a new tab. +let VEConf_singleFileHotKeys['openInNewTab'] = VEConf.filePanelHotkey.tabView +function! VEConf_singleFileActions['openInNewTab'](path) + if !isdirectory(a:path) + exec "tabe " . g:VEPlatform.escape(a:path) + else + exec "VE " . g:VEPlatform.escape(a:path) + endif +endfunction + +"Renamer is a very good plugin. +let VEConf_normalHotKeys['openRenamer'] = VEConf.filePanelHotkey.openRenamer +function! VEConf_normalActions['openRenamer']() + Renamer +endfunction + +"start shell in current directory. +let VEConf_normalHotKeys['startShell'] = VEConf.filePanelHotkey.startShell +function! VEConf_normalActions['startShell']() + call g:VEPlatform.startShell() +endfunction + +"start file explorer in current directory +"(nautilus,konquer,Explorer.exe and so on). +let VEConf_normalHotKeys['startExplorer'] = VEConf.filePanelHotkey.startExplorer +function! VEConf_normalActions['startExplorer']() + call g:VEPlatform.startExplorer() +endfunction + +"Multiple file name are contained in the fileList. +let VEConf_multiFileHotKeys['openMultiFilesWithVim'] = VEConf.filePanelHotkey.tabViewMulti +function! VEConf_multiFileActions['openMultiFilesWithVim'](fileList) + if empty(a:fileList) + return + endif + for i in a:fileList + exec "tabe " . g:VEPlatform.escape(i) + endfor +endfunction + +"####################################################################### +"Syntax and highlight configuration. +function! VEConf.treePanelSyntax() + syn clear + syn match Question "^.*Press ? for help.*$" "Host name + syn match WarningMsg "\[[A-Z]:[\\/]\]" "root node name + syn match Identifier "^\s*\zs[+-]" "+- + syn match SpecialKey "^.*\[current\]$" "current folder +endfunction + +function! VEConf.filePanelSyntax() + syntax clear + syn match Type "\[ .* \]" "group + syn match Comment '\t.\{10}' "file size + syn match Comment '\d\{4}-\d\{2}-\d\{2}\ \d\{2}:\d\{2}:\d\{2}' "time + syn match Special '^Path: .*$' "path + syn match WarningMsg '^\~*$' "line + syn match Function '^.*[\\/]' "directory + syn match Search '^\*.*$' "selectedFiles + syn match LineNr '[rwx-]\{9}' "perm +endfunction + +"####################################################################### + +" classes relationship +" +" VEFrameWork +" VETreePanel +" VETree +" VENode +" VEFilePanel +" VEPlatform + +" class VEPlatform {{{1 +"============================= +let VEPlatform = {} + +"it's a static class, no constructor + +"has win +function! VEPlatform.haswin32() + if (has("win32") || has("win95") || has("win64") || has("win16") || has("dos32")) + return 1 + else + return 0 + endif +endfunction + +"return a path always end with slash. +function! VEPlatform.getcwd() + let path = getcwd() + if g:VEPlatform.haswin32() && !&ssl + if path[-1:] != "\\" + let path = path . "\\" + endif + else + if path[-1:] != "/" + let path = path . "/" + endif + endif + return path +endfunction + +"get home path, end with a slash +function! VEPlatform.getHome() + if g:VEPlatform.haswin32() && !&ssl + if $HOME[-1:] != "\\" + return $HOME . "\\" + else + return $HOME + endif + else + if $HOME[-1:] != "/" + return $HOME . "/" + else + return $HOME + endif + endif +endfunction + +function! VEPlatform.escape(path) + if g:VEPlatform.haswin32() + return escape(a:path,'%#') + else + return escape(a:path,' %#') + endif +endfunction + +"start a program and then return to vim, no wait. +function! VEPlatform.start(path) + let convPath = self.escape(a:path) + "escape() function will do iconv to the string, so call it + "before iconv(). + if g:VEPlatform.haswin32() + let convPath = substitute(convPath,'/',"\\",'g') + let convPath = " start \"\" \"" . convPath . "\"" + let ret = self.system(convPath) + else + if g:VEConf_usingKDE + let convPath = "kfmclient exec " . convPath + let ret = self.system(convPath) + elseif g:VEConf_usingGnome + let convPath = "gnome-open " . convPath + let ret = self.system(convPath) + else " default using gnome-open. + let convPath = "gnome-open " . convPath + let ret = self.system(convPath) + endif + endif + if !ret + echohl ErrorMsg | echomsg "Failed to start " . a:path | echohl None + return 0 + endif + return 1 +endfunction + +function! VEPlatform.system(cmd) + "can not escape here! example: 'rm -r blabla\ bbb' + "let convCmd = escape(a:cmd,' %#') + let convCmd = a:cmd + if g:VEConf.systemEncoding != '' + let convCmd = iconv(convCmd,&encoding,g:VEConf.systemEncoding) + endif + call system(convCmd) + return !(v:shell_error) +endfunction + +" Return successful copyed file list. +function! VEPlatform.copyMultiFile(fileList,topath) + let boverWrite = g:VEConf.overWriteExisting + let retList = [] + for i in a:fileList + "boverWrite 0 ask, 1 allyes, 2 allno + if boverWrite == 0 + if i[-1:] == "\\" || i[-1:] == "/" + let i = i[:-2] + endif + let tofile = a:topath . matchstr(i,'[\\/]\zs[^\\/]\+$') + if findfile(tofile) != '' + "echohl WarningMsg + "let result = tolower(input("File [ " . tofile . " ] exists! Over write ? (Y)es/(N)o/(A)llyes/A(L)lno/(C)ancel ","Y")) + let result = confirm("File [ " . matchstr(i,'[\\/]\zs[^\\/]\+$') . + \" ] exists! Over write ? ","&Yes\n&No\nYes to &All\nNo &To All\n&Cancel ",1) + "echohl None + if result == 1 + if !self.copyfile(i,a:topath) + echohl ErrorMsg | echomsg "Copy file error: " . i | echohl None + else + let retList += [i] + endif + elseif result == 2 + continue + elseif result == 3 + let boverWrite = 1 + if !self.copyfile(i,a:topath) + echohl ErrorMsg | echomsg "Copy file error: " . i | echohl None + else + let retList += [i] + endif + elseif result == 4 + let boverWrite = 2 + else + break + endif + else + if !self.copyfile(i,a:topath) + echohl ErrorMsg | echomsg "Copy file error: " . i | echohl None + else + let retList += [i] + endif + endif + elseif boverWrite == 1 + if !self.copyfile(i,a:topath) + echohl ErrorMsg | echomsg "Copy file error: " . i | echohl None + else + let retList += [i] + endif + elseif boverWrite == 2 + if i[-1:] == "\\" || i[-1:] == "/" + let i = i[:-2] + endif + let tofile = a:topath . matchstr(i,'[\\/]\zs[^\\/]\+$') + if findfile(tofile) != '' + continue + endif + if !self.copyfile(i,a:topath) + echohl ErrorMsg | echomsg "Copy file error: " . i | echohl None + else + let retList += [i] + endif + endif + endfor + echohl Special | echomsg " " . len(retList) . " file(s) pasted!" | echohl None + return retList +endfunction + +function! VEPlatform.copyfile(filename,topath) + "return + let filename = self.escape(a:filename) + let topath = self.escape(a:topath) + if g:VEPlatform.haswin32() + let filename = substitute(a:filename,'/',"\\",'g') + let topath = substitute(a:topath,'/',"\\",'g') + if isdirectory(filename) + if filename[-1:] == "\\" + let filename = filename[:-2] + endif + let topath = "\"" . topath . matchstr(filename,'[^\\]*$') . "\"" + let filename = "\"" . filename . "\"" + let cmd = "xcopy ".filename . " " . topath . " /E /I /H /R /Y" + else + let topath = "\"" . topath . "\"" + let filename = "\"" . filename . "\"" + let cmd = "xcopy ". filename . " " . topath . " /I /H /R /Y" + endif + return self.system(cmd) + else + let cmd = "cp -r " . filename . " " . topath . "&" + return self.system(cmd) + endif +endfunction + +" The "move" command in win32 is so poor.. +" So I have no choice but copy then delete. +"function! VEPlatform.movefile(filename,topath) +" let filename = self.escape(a:filename) +" let topath = self.escape(a:topath) +" if executable("mv") +" let cmd = "mv -f " . filename . " " . topath +" return self.system(cmd) +" else +" if self.copyfile(a:filename,a:topath) +" return self.delete(a:filename,1) +" else +" return 0 +" endif +" endif +"endfunction + +function! VEPlatform.mkdir(path) + if g:VEConf.systemEncoding != '' + let convPath = iconv(a:path,&encoding,g:VEConf.systemEncoding) + else + let convPath = a:path + endif + return mkdir(convPath,'p') +endfunction + +function! VEPlatform.mkfile(filename) + if findfile(a:filename) != '' || isdirectory(a:filename) + return 0 + endif + if writefile([],a:filename) == 0 "here it is not need to convert filename + return 1 + else + return 0 + endif +endfunction + +function! VEPlatform.executable(filename) + if isdirectory(a:filename) + return 0 + endif + if getfperm(a:filename)[2] == 'x' + return 1 + else + return 0 + endif +endfunction + +function! VEPlatform.search(filename,path) + if a:filename == '.' || a:filename == '..' + return [] + else + return split(globpath(a:path,"**/" . a:filename),"\n") + endif +endfunction + +function! VEPlatform.globpath(path) + if g:VEConf.showHiddenFiles + let tmp = globpath(a:path,"*") . "\n" . globpath(a:path,".[^.]*") "need to cut . and .. + " can not show files start with .. such as ..foo , :( + " I do not know how to write the shell regexp. + if tmp == "\n" + return '' + else + return tmp + endif + else + return globpath(a:path,"*") + endif +endfunction + +"globpath used in file panel, including filter. +function! VEPlatform.globpath_file(path) + if g:VEConf.filePanelFilter != '' + return globpath(a:path,g:VEConf.filePanelFilter) + endif + if g:VEConf.showHiddenFiles + let tmp = globpath(a:path,"*") . "\n" . globpath(a:path,".[^.]*") "need to cut . and .. + " can not show files start with .. such as ..foo , :( + " I do not know how to write the shell regexp. + if tmp == "\n" + return '' + else + return tmp + endif + else + return globpath(a:path,"*") + endif +endfunction + +function! VEPlatform.cdToPath(path) + try + "In win32, VE can create folder starts with space. So ... + exec "lcd " . escape(a:path,' %#') + catch + echohl ErrorMsg | echomsg "Can not cd to path: " . a:path | echohl None + endtry +endfunction + +function! VEPlatform.startShell() + if g:VEPlatform.haswin32() + !start cmd.exe + else + shell + endif +endfunction + +function! VEPlatform.startExplorer() + let pwd = self.escape(g:VEPlatform.getcwd()) + if g:VEPlatform.haswin32() + let pwd = substitute(pwd,'/',"\\",'g') + endif + if !self.system(g:VEConf.externalExplorer . " " . pwd) + "echohl ErrorMsg | echomsg "Failed to start external explorer: " . g:VEConf.externalExplorer | echohl None + " M$ windows Explorer.exe always return 1 even it starts successfully, shit! + endif +endfunction + +function! VEPlatform.getRoot(rootDict) + if g:VEPlatform.haswin32() + "Create new root list. + let newRootList = [] + for i in g:VEConf.win32Disks + if &ssl + let i = i . "/" + else + let i = i . "\\" + endif + if g:VEPlatform.globpath(i) != '' + call add(newRootList,i) + endif + endfor + "Remove nolonger exist root nodes. + for i in keys(a:rootDict) + if index(newRootList,i) == -1 + call remove(a:rootDict,i) + endif + endfor + "Create new root nodes. + for i in newRootList + if !has_key(a:rootDict,i) + let a:rootDict[i] = deepcopy(s:VENode) + call a:rootDict[i].init(i) + let a:rootDict[i].hasOwnChilds = 1 + endif + endfor + else "Assert the other platform acts like UNIX + let newRootList = ["/"] " ~/ + for i in newRootList + if !has_key(a:rootDict,i) + let a:rootDict[i] = deepcopy(s:VENode) + call a:rootDict[i].init(i) + let a:rootDict[i].hasOwnChilds = 1 + endif + endfor + endif +endfunction + +function! VEPlatform.pathToName(path) + let time = strftime("%Y-%m-%d %H:%M:%S",getftime(a:path)) + let size = getfsize(a:path) + let perm = getfperm(a:path) + if g:VEPlatform.haswin32() && !&ssl + if a:path[-1:] != "\\" + let name = substitute(a:path,'^.*\\','','g') + else + let name = substitute(a:path,'^.*\\\ze.\+\\$','','g') + endif + else + if a:path[-1:] != "/" + let name = substitute(a:path,'^.*\/','','g') + else + let name = substitute(a:path,'^.*\/\ze.\+\/$','','g') + endif + endif + if g:VEConf.showFileSizeInMKB + if size > (1024 * 1024) + let size = (size / 1024 / 1024) . ' M' + elseif size > 1024 + let size = (size / 1024) . ' K' + elseif size > 0 + let size = size . ' B' + endif + endif + let tail = printf("%10.10s ".perm . ' ' .time,size==0?'':size) + return name . "\t" . tail +endfunction + +function! VEPlatform.getUpperDir(path) + if g:VEPlatform.haswin32() && !&ssl + return substitute(a:path,'\\\zs[^\\]\+\\$','','g') + else + return substitute(a:path,'\/\zs[^/]\+\/$','','g') + endif +endfunction + +"default choice and return value: 1:YES 0:NO +function! VEPlatform.confirm(text,defaultChoice) + if a:defaultChoice + let ret = confirm(a:text,"&Yes\n&No",1) + else + let ret = confirm(a:text,"&Yes\n&No",2) + endif + if ret == 1 + return 1 + else + return 0 + endif + "if a:defaultChoice + " echohl WarningMsg + " let result = tolower(input(a:text . " ","Y")) + " echohl None + "else + " echohl WarningMsg + " let result = tolower(input(a:text . " "),"N") + " echohl None + "endif + "if result == "y" || result == "ye" || result == "yes" + " return 1 + "else + " return 0 + "endif +endfunction + +"delete a single file or directory +"return 0:failed 1:success +function! VEPlatform.deleteSingle(path,bforce) + if !isdirectory(a:path) + if g:VEConf.fileDeleteConfirm && !self.confirm("Delete \n\"".a:path."\" ?",1) + echo " " + "clear the command line + return 0 + endif + if self.delete(a:path,a:bforce) + echohl Special | echomsg "File: [" . a:path . "] deleted!" | echohl None + return 1 + else + echohl ErrorMsg | echomsg "Can not delete the file! [" . a:path . "]" | echohl None + return 0 + endif + else + if g:VEConf.fileDeleteConfirm && !self.confirm("Remove the folder \n\"".a:path."\" and all its contents?",1) + echo " " + return 0 + endif + echo " " + return self.delete(a:path,a:bforce) + endif +endfunction + +"delete multiple files/directory. +"return 0:failed 1:success +function! VEPlatform.deleteMultiple(fileList,bforce) + if g:VEConf.fileDeleteConfirm && !self.confirm("Delete selected file(s) ?",1) + echo " " + return 0 + endif + for i in a:fileList + if !self.delete(i,a:bforce) + echohl ErrorMsg | echomsg "Failed to delete: " . i | echohl None + endif + endfor + return 1 +endfunction + +function! VEPlatform.delete(name,bforce) + if g:VEPlatform.haswin32() + let recPath = tolower(g:VEConf.recyclePath) + let delName = tolower(a:name) + else + let recPath = g:VEConf.recyclePath + let delName = a:name + endif + if !a:bforce && g:VEConf.recyclePath != '' && (stridx(delName,recPath) == -1) + if !isdirectory(g:VEConf.recyclePath) + if !self.mkdir(g:VEConf.recyclePath) || !isdirectory(g:VEConf.recyclePath) + echohl ErrorMsg | echomsg "Can not access recycle bin!" | echohl None + return 0 + endif + endif + if !self.copyfile(a:name,g:VEConf.recyclePath) + echohl ErrorMsg | echomsg "Failed to move the file: [" . a:name . "] to recycle bin." | echohl None + return 0 + "else + " return 1 + endif + endif + if isdirectory(a:name) + if g:VEPlatform.haswin32() + return g:VEPlatform.system(" rmdir /S /Q \"" . self.escape(a:name) . "\"") + else + return g:VEPlatform.system("rm -r " . self.escape(a:name) . "&") + endif + else + if delete(a:name) == 0 + return 1 + else + return 0 + endif + endif +endfunction + +function! VEPlatform.select(list,title) + let selectList = deepcopy(a:list) + if len(selectList) == 0 + return + endif + call insert(selectList,a:title,0) + for i in range(1,len(selectList)-1) + let selectList[i] = i . " " . selectList[i] + endfor + let result = inputlist(selectList) + if result > len(a:list) || result <= 0 + return -1 + else + return result-1 + endif +endfunction + +" This is not a member of VEPlatform, because sort() +" can not use dict function. +function! VEPlatform_sortCompare(t1,t2) + if g:VEConf.sortCaseSensitive + return a:t1 ==# a:t2 ? 0 : a:t1 ># a:t2 ? 1 : -1 + else + return a:t1 ==? a:t2 ? 0 : a:t1 >? a:t2 ? 1 : -1 + endif +endfunction + + +" class VENode {{{1 +"============================= +let s:VENode = {} +let s:VENode.name = '' +let s:VENode.path = '' +let s:VENode.isopen = 0 +let s:VENode.hasOwnChilds = 0 +let s:VENode.childs = {} + +"Object Constructor +function! s:VENode.init(path) + let self.path = a:path + if g:VEPlatform.haswin32() && !&ssl + let self.name = matchstr(a:path,'[^\\]*\\$','','g') + else + let self.name = matchstr(a:path,'[^/]*\/$','','g') + endif +endfunction + +"Refresh tree node +function! s:VENode.updateNode() + "Once a node is updated, it means that the node has been opened. + let self.isopen = 1 + "Create new dir list + let newDirList = [] + for i in split(g:VEPlatform.globpath(self.path),"\n") + if isdirectory(i) == 1 + if g:VEPlatform.haswin32() && !&ssl + let i = matchstr(i,'[^\\]*$','','g') . "\\" + else + let i = matchstr(i,'[^/]*$','','g') . "/" + endif + call add(newDirList,i) + endif + endfor + "Remove nolonger exist dirs. + for i in keys(self.childs) + if index(newDirList,i) == -1 + call remove(self.childs,i) + endif + endfor + "Create new nodes + for i in newDirList + if !has_key(self.childs,i) + let self.childs[i] = deepcopy(s:VENode) + call self.childs[i].init(self.path . i) + endif + endfor + "find out which child has their own childs + if !empty(self.childs) + let self.hasOwnChilds = 1 + else + let self.hasOwnChilds = 0 + return + endif + if g:VEConf.showFolderStatus == 0 + for i in keys(self.childs) + let self.childs[i].hasOwnChilds = 1 + endfor + else + for i in keys(self.childs) + let _hasOwnChilds = 0 + for j in split(g:VEPlatform.globpath(self.childs[i].path),"\n") + if isdirectory(j) == 1 + let _hasOwnChilds = 1 + break + endif + endfor + if _hasOwnChilds == 1 + let self.childs[i].hasOwnChilds = 1 + endif + endfor + endif + "update opened child nodes + for i in keys(self.childs) + if self.childs[i].isopen == 1 + call self.childs[i].updateNode() + endif + endfor +endfunction + +"Toggle open/close status of one node +"the path should end with '\' such as c:\aaa\bbb\ +"example "c:\\aaa\\bbb\\" "aaa\\bbb\\" "bbb\\" +function! s:VENode.toggle(path) + if g:VEPlatform.haswin32() && !&ssl + let childPath = substitute(a:path,'^.\{-}\\','','g') + else + let childPath = substitute(a:path,'^.\{-}\/','','g') + endif + if childPath == '' + let self.isopen = !self.isopen + if self.isopen == 1 + call self.updateNode() + endif + else + if g:VEPlatform.haswin32() && !&ssl + let nodeName = matchstr(childPath,'^.\{-}\\') + else + let nodeName = matchstr(childPath,'^.\{-}\/') + endif + if !has_key(self.childs,nodeName) + echoerr "path error" + endif + let self.isopen = 1 + call self.childs[nodeName].toggle(childPath) + endif +endfunction + +"Open the giving path +"the path should end with '\' such as c:\aaa\bbb\ +"example "c:\\aaa\\bbb\\" "aaa\\bbb\\" "bbb\\" +function! s:VENode.openPath(path) + if g:VEPlatform.haswin32() && !&ssl + let childPath = substitute(a:path,'^.\{-}\\','','g') + else + let childPath = substitute(a:path,'^.\{-}\/','','g') + endif + if childPath == '' + if empty(self.childs) + call self.updateNode() + endif + return + else + if g:VEPlatform.haswin32() && !&ssl + let nodeName = matchstr(childPath,'^.\{-}\\') + else + let nodeName = matchstr(childPath,'^.\{-}\/') + endif + if !has_key(self.childs,nodeName) + call self.updateNode() + endif + if !has_key(self.childs,nodeName) "refreshed and still can not find the path. + echoerr "Path error!" + return + else + let self.isopen = 1 + call self.childs[nodeName].openPath(childPath) + endif + endif +endfunction + + +"Draw the tree, depend on the status of every tree node. +function! s:VENode.draw(tree,depth) + if self.hasOwnChilds == 0 + let name = repeat(' ',a:depth*2).' '.self.name + call add(a:tree,[name,self.path]) + return + endif + if self.isopen + let name = repeat(' ',a:depth*2).'- '.self.name + if a:depth == 0 "let the root node looks different + let name = '- [' . self.name . ']' + endif + call add(a:tree,[name,self.path]) + let keys = sort(keys(self.childs),"VEPlatform_sortCompare") + if !g:VEConf.treeSortDirection + call reverse(keys) + endif + for i in keys + call self.childs[i].draw(a:tree,a:depth+1) + endfor + else + let name = repeat(' ',a:depth*2).'+ '.self.name + if a:depth == 0 "let the root node looks different + let name = '+ [' . self.name . ']' + endif + call add(a:tree,[name,self.path]) + endif +endfunction + +" class VETree {{{1 +"============================= +let s:VETree = {} +let s:VETree.content = [] +let s:VETree.rootNodes = {} + +"Object Constructor +function! s:VETree.init() + call g:VEPlatform.getRoot(self.rootNodes) + "for i in keys(self.rootNodes) + " call self.rootNodes[i].updateNode() + "endfor +endfunction + +function! s:VETree.togglePath(path) + if g:VEPlatform.haswin32() && !&ssl + let rootNodeName = matchstr(a:path,'^.\{-}\\') + else + let rootNodeName = matchstr(a:path,'^.\{-}\/') + endif + call self.rootNodes[rootNodeName].toggle(a:path) +endfunction + +function! s:VETree.openPath(path) + if g:VEPlatform.haswin32() && !&ssl + let rootNodeName = matchstr(a:path,'^.\{-}\\') + else + let rootNodeName = matchstr(a:path,'^.\{-}\/') + endif + call self.rootNodes[rootNodeName].openPath(a:path) +endfunction + +" fill self.content +function! s:VETree.draw() + let keys = sort(keys(self.rootNodes),"VEPlatform_sortCompare") + if g:VEConf.treeSortDirection == 0 + call reverse(keys) + endif + for i in keys + call self.rootNodes[i].draw(self.content,0) + endfor +endfunction + +function! s:VETree.update(path) + call g:VEPlatform.getRoot(self.rootNodes) + "toggle twice to update current directory + call self.togglePath(a:path) + call self.togglePath(a:path) + " costs too much time. + "for i in keys(self.rootNodes) + " call self.rootNodes[i].updateNode() + "endfor +endfunction + +" class VETreePanel {{{1 +"============================= +let s:VETreePanel = {} +let s:VETreePanel.tree = {} +let s:VETreePanel.name = '' +let s:VETreePanel.path = '' +let s:VETreePanel.width = 0 +let s:VETreePanel.splitMode = '' +let s:VETreePanel.splitLocation = '' + +"Object Constructor +function! s:VETreePanel.init(name,path) + let self.name = "VETreePanel" . a:name + let self.path = a:path + let self.width = g:VEConf.treePanelWidth + let self.splitMode = g:VEConf.treePanelSplitMode + let self.splitLocation = g:VEConf.treePanelSplitLocation + let self.tree = deepcopy(s:VETree) + call self.tree.init() + call self.tree.openPath(a:path) +endfunction + +function! s:VETreePanel.setFocus() + let VETreeWinNr = bufwinnr(self.name) + if VETreeWinNr != -1 + exec VETreeWinNr . " wincmd w" + return 1 + else + let bufNr = bufnr(self.name) + if bufNr != -1 + exec "bwipeout " . bufNr + endif + return 0 + endif +endfunction + +"Sync the tree with filesystem and refresh the tree panel +function! s:VETreePanel.refresh() + if !self.setFocus() + return + endif + call self.tree.update(self.path) + call self.drawTree() +endfunction + +"Draw the dir tree but do not sync the tree with filesystem +function! s:VETreePanel.drawTree() + if !self.setFocus() + return + endif + if !empty(self.tree.content) + call remove(self.tree.content,0,-1) + endif + call add(self.tree.content,[hostname() . " (Press ? for help)",""]) + call self.tree.draw() + let tree = [] + let lineNr = line(".") + for i in self.tree.content + if i[1] == self.path + let i[0] = i[0] . " [current]" + let lineNr = index(self.tree.content,i) + 1 + endif + call add(tree,i[0]) + endfor + setlocal noreadonly + setlocal modifiable + "Let the cursor go back to right line and right position in + "the screen. + normal! H + let Hline = line(".") + silent normal! ggdG + call append(0,tree) + silent normal! Gddgg + exec "normal! " . Hline . "G" + normal! zt + exec "normal! " . lineNr . "G" + setlocal readonly + setlocal nomodifiable +endfunction + +"Show tree panel +function! s:VETreePanel.show() + if self.setFocus() + return + endif + let cmd = self.splitLocation . " " . self.splitMode . ' ' . self.width . ' new ' . self.name + silent! execute cmd + let VETreeWinNr = bufwinnr(self.name) + if VETreeWinNr != -1 + exec VETreeWinNr . " wincmd w" + setlocal winfixwidth + setlocal noswapfile + setlocal buftype=nowrite + setlocal bufhidden=delete + setlocal nowrap + setlocal foldcolumn=0 + setlocal nobuflisted + setlocal nospell + setlocal nonumber + setlocal cursorline + setlocal readonly + setlocal nomodifiable + "call self.refresh() + call self.drawTree() + call self.createActions() + call self.createSyntax() + else + echoerr "create tree window failed!" + endif +endfunction + +"Hide tree panel +function! s:VETreePanel.hide() + if !self.setFocus() + return + else + "make sure there are no more than 1 buffer has the same name + let bufNr = bufnr('%') + "exec "wincmd c" + quit + exec "bwipeout ".bufNr + endif +endfunction + +function! s:VETreePanel.getPathUnderCursor(num) + return self.tree.content[a:num][1] +endfunction + +function! s:VETreePanel.nodeClicked(num) + if self.tree.content[a:num][1] == "" + return + endif + let path = self.tree.content[a:num][1] + if self.path != path + "let self.path = path + call VE_GotoPath(path) + "Do not toggle if it is the first time switch to another tree node. + call self.setFocus() + return + endif + call self.tree.togglePath(path) + call self.drawTree() +endfunction + +function! s:VETreePanel.pathChanged(path) + if self.path == a:path + return + endif + call g:VEPlatform.cdToPath(a:path) + let self.path = g:VEPlatform.getcwd() + call self.tree.openPath(self.path) + call self.drawTree() +endfunction + +function! s:VETreePanel.createActions() + exec "nnoremap " . g:VEConf.treePanelHotkey.help . " :tab h VimExplorer" + exec "nnoremap " . g:VEConf.treePanelHotkey.toggleNode . " :call VE_OnTreeNodeClick()" + exec "nnoremap " . g:VEConf.treePanelHotkey.toggleNodeMouse. " :call VE_OnTreeNodeClick()" + exec "nnoremap " . g:VEConf.treePanelHotkey.refresh . " :call VE_TreeRefresh()" + exec "nnoremap " . g:VEConf.treePanelHotkey.toggleFilePanel ." :call VE_ToggleFilePanel()" + exec "nnoremap " . g:VEConf.treePanelHotkey.toUpperDir . " :call VE_ToUpperDir()" + exec "nnoremap " . g:VEConf.treePanelHotkey.switchPanel . " " + exec "nnoremap " . g:VEConf.treePanelHotkey.favorite . " :call VE_GotoFavorite()" + exec "nnoremap " . g:VEConf.treePanelHotkey.addToFavorite . " :call VE_AddToFavorite('treePanel')" + exec "nnoremap " . g:VEConf.treePanelHotkey.browseHistory . " :call VE_BrowseHistory()" + exec "nnoremap " . g:VEConf.treePanelHotkey.gotoPath . " :call VE_OpenPath()" + exec "nnoremap " . g:VEConf.treePanelHotkey.quitVE . " :call VEDestroy()" + " autocmd + au! * + au BufEnter call VE_SyncDir() + " Status line + setlocal statusline=%{getcwd()} +endfunction + +function! s:VETreePanel.createSyntax() + if !self.setFocus() + return + endif + call g:VEConf.treePanelSyntax() +endfunction + + +" class VEFilePanel {{{1 +"============================= +let s:VEFilePanel = {} +let s:VEFilePanel.fileList = [] +let s:VEFilePanel.displayList = [] +" displayList [ +" [ "display name", "real path" ], +" ... +" ] +let s:VEFilePanel.selectedFiles = [] +let s:VEFilePanel.leavePosition = {} +let s:VEFilePanel.name = '' +let s:VEFilePanel.path = '' +let s:VEFilePanel.width = 0 +let s:VEFilePanel.splitMode = "" +let s:VEFilePanel.splitLocation = "" + +function! s:VEFilePanel.init(name,path) + let self.name = "VEFilePanel".a:name + let self.path = a:path + let self.splitMode = g:VEConf.filePanelSplitMode + let self.splitLocation = g:VEConf.filePanelSplitLocation + let self.width = g:VEConf.filePanelWidth +endfunction + +function! s:VEFilePanel.show() + if self.setFocus() + return + endif + let cmd = self.splitLocation . " " . self.splitMode . ' ' . self.width . ' new ' . self.name + silent! exec cmd + if !self.setFocus() + echoerr "create file window failed!" + endif + setlocal winfixwidth + setlocal noswapfile + setlocal buftype=nowrite + setlocal bufhidden=delete + setlocal nowrap + setlocal foldcolumn=0 + setlocal nobuflisted + setlocal nospell + setlocal nonumber + setlocal cursorline + setlocal readonly + setlocal nomodifiable + setlocal tabstop=40 + "This is used to display file list more orderliness. + call self.refresh() + call self.createActions() + call self.createSyntax() +endfunction + +function! s:VEFilePanel.only() + if !self.setFocus() + return + endif + only +endfunction + +function! s:VEFilePanel.hide() + if !self.setFocus() + return + else + let bufNr = bufnr('%') + exec "wincmd c" + exec "bwipeout ".bufNr + endif +endfunction + +function! s:VEFilePanel.refresh() + call self.getFileListFromCwd() + call self.updateDisplayList() + call self.drawList() +endfunction + +"Draw the displayList on the screen. +function! s:VEFilePanel.drawList() + if !self.setFocus() + return + endif + "calculate window width + let VEFileWinNr = bufwinnr(self.name) + let winWidth = winwidth(VEFileWinNr) + exec "setlocal tabstop=" . ((winWidth-41)<20?20:(winWidth-41)) + setlocal noreadonly + setlocal modifiable + let curLine = line(".") + normal! H + let Hline = line(".") + silent normal! ggdG + let displayContent = [] + for i in self.displayList "here i is reference,not copy + if index(self.selectedFiles,i[1]) != -1 + let tmpi = '*' . substitute(i[0],'^.','','g') + else + let tmpi = i[0] + endif + call add(displayContent,tmpi) + endfor + call append(0,displayContent) + normal! Gddgg + exec "normal! " . Hline . "G" + normal! zt + exec "normal! " . curLine . "G" + setlocal readonly + setlocal nomodifiable +endfunction + +"Update the displayList. +function! s:VEFilePanel.updateDisplayList() + if g:VEConf.filePanelSortType == 1 + call self.sortByName() + elseif g:VEConf.filePanelSortType == 2 + call self.sortByTime() + else + call self.sortByType() + endif +endfunction + +function! s:VEFilePanel.toggleModes() + if g:VEConf.filePanelSortType < 2 + let g:VEConf.filePanelSortType = g:VEConf.filePanelSortType + 1 + else + let g:VEConf.filePanelSortType = 0 + endif + call self.updateDisplayList() + call self.drawList() +endfunction + +function! s:VEFilePanel.getFileListFromCwd() + let self.fileList = split(g:VEPlatform.globpath_file(self.path),"\n") +endfunction + +" 1 +function! s:VEFilePanel.sortByName() + let fileGroup = {} + " example + " { + " "name" : "path" + " } + for i in self.fileList + if g:VEPlatform.haswin32() && !&ssl + let name = matchstr(i,'[^\\]*$','','g') + else + let name = matchstr(i,'[^/]*$','','g') + endif + if isdirectory(i) + if g:VEPlatform.haswin32() && !&ssl + if i[-1:] != "\\" + let i = i . "\\" + endif + else + if i[-1:] != "/" + let i = i . "/" + endif + endif + " add # before directory to sort separately. + let name = '#' . name + endif + let fileGroup[name] = i + endfor + let keys = sort(keys(fileGroup),"VEPlatform_sortCompare") + if !g:VEConf.fileGroupSortDirection + call reverse(keys) + endif + let self.displayList = [] + call add(self.displayList,["Path: ".self.path,'']) + call add(self.displayList,[repeat("~",100),'']) + call add(self.displayList,['[ Sort by name ]','']) + for i in keys + call add(self.displayList,[" " . g:VEPlatform.pathToName(fileGroup[i]),fileGroup[i]]) + endfor +endfunction + +" 2 +function! s:VEFilePanel.sortByTime() + let fileGroup = {} + " example + " { + " "name" : "path" + " } + for i in self.fileList + let time = strftime("%Y-%m-%d %H:%M:%S",getftime(i)) + let time = time . i "let the key of dict unique + if isdirectory(i) + if g:VEPlatform.haswin32() && !&ssl + if i[-1:] != "\\" + let i = i . "\\" + endif + else + if i[-1:] != "/" + let i = i . "/" + endif + endif + endif + let fileGroup[time] = i + endfor + let keys = sort(keys(fileGroup),"VEPlatform_sortCompare") + if !g:VEConf.fileGroupSortDirection + call reverse(keys) + endif + let self.displayList = [] + call add(self.displayList,["Path: ".self.path,'']) + call add(self.displayList,[repeat("~",100),'']) + call add(self.displayList,['[ Sort by time ]','']) + for i in keys + call add(self.displayList,[" " . g:VEPlatform.pathToName(fileGroup[i]),fileGroup[i]]) + endfor +endfunction + +" 3 not implemented yet +"function! s:VEFilePanel.sortBySize() +" let fileGroup = {} +" " example +" " { +" " "name" : "path" +" " } +" for i in self.fileList +" let time = strftime("%Y-%m-%d %H:%M:%S",getftime(i)) +" let time = time . i "let the key of dict unique +" if isdirectory(i) +" " add # before directory to sort separately. +" " need?? +" "let time = '#' . time +" if i[-1:] != "\\" +" let i = i . "\\" +" endif +" endif +" let fileGroup[time] = i +" endfor +" let keys = sort(keys(fileGroup)) +" if !g:VEConf.fileGroupSortDirection +" call reverse(keys) +" endif +" let self.displayList = [] +" call add(self.displayList,["Path: ".self.path,'']) +" call add(self.displayList,[repeat("~",100),'']) +" call add(self.displayList,['[ Sort by time ]','']) +" for i in keys +" call add(self.displayList,[" " . g:VEPlatform.pathToName(fileGroup[i]),fileGroup[i]]) +" endfor +"endfunction + +" 0 +function! s:VEFilePanel.sortByType() + let fileGroup = {} + " example + " { + " "directory" : [ + " "c:\\aaa\\", + " "c:\\bbb\\" + " ] + " "txt" : [ + " "c:\\mm.txt", + " "c:\\nn.txt" + " ] + " } + for i in self.fileList + " i ("c:\\ddd\\eee.fff") + if isdirectory(i) + "if the group dos not exist,create it first + if !has_key(fileGroup,'#Directory') "assert file name does not contain '#' + let fileGroup['#Directory'] = [] + endif + if g:VEPlatform.haswin32() && !&ssl + if i[-1:] != "\\" + let i = i . "\\" + endif + else + if i[-1:] != "/" + let i = i . "/" + endif + endif + call add(fileGroup['#Directory'],i) + continue + endif + if g:VEPlatform.haswin32() && !&ssl + let matchStr = '\\\.[^\\]\+$' + else + let matchStr = '\/\.[^/]\+$' + endif + if matchstr(i,matchStr) != '' + if !has_key(fileGroup,'#Hidden files') + let fileGroup['#Hidden files'] = [] + endif + call add(fileGroup['#Hidden files'],i) + continue + endif + if g:VEPlatform.haswin32() && !&ssl + let fileExtension = matchstr(substitute(i,'^.*\\','','g'),'\.[^.]\{-}$') + else + let fileExtension = matchstr(substitute(i,'^.*\/','','g'),'\.[^.]\{-}$') + endif + if fileExtension == '' "files have no extensions + if !has_key(fileGroup,'#Files') + let fileGroup['#Files'] = [] + endif + call add(fileGroup['#Files'],i) + continue + else "group the file by it's ext.name + " # is always smaller than $ + " so it can keep dir in the top + if !has_key(fileGroup,"$".fileExtension) + let fileGroup["$".fileExtension] = [] + endif + call add(fileGroup["$".fileExtension],i) + endif + endfor + "update self.displayList + let self.displayList = [] + call add(self.displayList,["Path: ".self.path,'']) + call add(self.displayList,[repeat("~",100),'']) + let keys = sort(keys(fileGroup),"VEPlatform_sortCompare") + if !g:VEConf.fileGroupSortDirection + call reverse(keys) + endif + for i in keys + call add(self.displayList,['[ '.i[1:].' ]','']) + call sort(fileGroup[i],"VEPlatform_sortCompare") + if !g:VEConf.fileGroupSortDirection + call reverse(fileGroup[i]) + endif + for j in fileGroup[i] + call add(self.displayList,[" " . g:VEPlatform.pathToName(j),j]) + endfor + call add(self.displayList,[" ",'']) + endfor + if self.displayList[-1][0] == " " + call remove(self.displayList,-1) "remove last empty line + endif +endfunction + +function! s:VEFilePanel.pathChanged(path) + call self.setFocus() + if self.path == a:path + return + endif + "store the current mouse position. + let linePos = line('.') + normal! H + let topPos = line('.') + let self.leavePosition[self.path] = [topPos,linePos] + " + call g:VEPlatform.cdToPath(a:path) + let self.selectedFiles = [] "clear the selectedFile list + let self.path = g:VEPlatform.getcwd() + call self.refresh() + "restore position + if has_key(self.leavePosition,self.path) + exec "normal! " . self.leavePosition[self.path][0] . "G" + normal! zt + exec "normal! " . self.leavePosition[self.path][1] . "G" + else + normal! ggM + if line('.') < 4 "put the cursor to first dir. + normal! 4G + endif + endif +endfunction + +function! s:VEFilePanel.setFocus() + let VEFileWinNr = bufwinnr(self.name) + if VEFileWinNr != -1 + exec VEFileWinNr . " wincmd w" + return 1 + else + "If the window of buffer was closed by hand and the + "buffer still in buffer list, wipeout it. + "In case of bufnr() returns empty when there are two + "buffers have the same name. + let bufNr = bufnr(self.name) + if bufNr != -1 + exec "bwipeout " . bufNr + endif + return 0 + endif +endfunction + +function! s:VEFilePanel.itemClicked(line) + let path = self.displayList[a:line][1] + if path == '' + return + endif + if isdirectory(path) + call VE_GotoPath(path) + call self.setFocus() + return + else + call g:VEPlatform.start(path) + endif +endfunction + +function! s:VEFilePanel.itemPreview(line) + let path = self.displayList[a:line][1] + if path == '' + return + endif + exec g:VEConf.previewSplitLocation . " pedit " . g:VEPlatform.escape(path) +endfunction + +function! s:VEFilePanel.singleFileAction(line,actionName) + let path = self.displayList[a:line][1] + if path == '' + return + endif + call g:VEConf_singleFileActions[a:actionName](path) +endfunction + +function! s:VEFilePanel.normalAction(actionName) + call g:VEConf_normalActions[a:actionName]() +endfunction + +function! s:VEFilePanel.multiAction(actionName) + call g:VEConf_multiFileActions[a:actionName](self.selectedFiles) +endfunction + +function! s:VEFilePanel.deleteSingle(line,bForce) + let path = self.displayList[a:line][1] + if path == '' + return + endif + if g:VEPlatform.deleteSingle(path,a:bForce) + if index(self.selectedFiles,path) != -1 + call remove(self.selectedFiles,index(self.selectedFiles,path)) + endif + call self.refresh() + endif +endfunction + +function! s:VEFilePanel.deleteSelectedFiles(bForce) + if empty(self.selectedFiles) + return + endif + if g:VEPlatform.deleteMultiple(self.selectedFiles,a:bForce) + let self.selectedFiles = [] + call self.refresh() + endif +endfunction + +function! s:VEFilePanel.toggleSelect(direction) + if a:direction == "up" + exec "norm " . "\" + endif + let line = line(".") - 1 + let path = self.displayList[line][1] + if path != '' + let idx = index(self.selectedFiles,path) + if idx == -1 + call add(self.selectedFiles,path) + else + call remove(self.selectedFiles,idx) + endif + call self.drawList() + endif + if a:direction == "down" + exec "norm " . "\" + endif +endfunction! + +function! s:VEFilePanel.clearSelect() + let self.selectedFiles = [] + call self.drawList() +endfunction + +function! s:VEFilePanel.visualSelect(firstLine,lastLine) + for line in range(a:firstLine,(a:lastLine>=len(self.displayList)?(len(self.displayList)-1):a:lastLine)) + let path = self.displayList[line][1] + if path == '' + continue + endif + let idx = index(self.selectedFiles,path) + if idx == -1 + call add(self.selectedFiles,path) + else + call remove(self.selectedFiles,idx) + endif + endfor + call self.drawList() +endfunction + +function! s:VEFilePanel.visualDelete(firstLine,lastLine,bForce) + let displayList = [] + for line in range(a:firstLine,(a:lastLine>=len(self.displayList)?(len(self.displayList)-1):a:lastLine)) + let path = self.displayList[line][1] + if path == '' + continue + endif + call add(displayList,path) + endfor + if empty(displayList) + return + endif + if g:VEPlatform.deleteMultiple(displayList,a:bForce) + call self.refresh() + endif +endfunction + +function! s:VEFilePanel.visualYank(firstLine,lastLine,mode) + let displayList = [] + for line in range(a:firstLine,(a:lastLine>=len(self.displayList)?(len(self.displayList)-1):a:lastLine)) + let path = self.displayList[line][1] + if path == '' + continue + endif + call add(displayList,path) + endfor + if empty(displayList) + return + endif + let winName = matchstr(bufname("%"),'_[^_]*$') + let s:VEContainer.yankMode = a:mode + let s:VEContainer.clipboard = displayList + call s:VEContainer.showClipboard() +endfunction + +function! s:VEFilePanel.yankSingle(mode) + let line = line(".") - 1 + let path = self.displayList[line][1] + if path != '' + let s:VEContainer.yankMode = a:mode + let s:VEContainer.clipboard = [] + call add(s:VEContainer.clipboard,path) + endif + call s:VEContainer.showClipboard() +endfunction + +function! s:VEFilePanel.paste() + if s:VEContainer.yankMode == '' || s:VEContainer.clipboard == [] + return + endif + let retList = g:VEPlatform.copyMultiFile(s:VEContainer.clipboard,self.path) + if s:VEContainer.yankMode == 'cut' && len(retList) != 0 + "let tmpRec = g:VEConf.recyclePath " save recycle path + "let g:VEConf.recyclePath = '' + for i in retList + call g:VEPlatform.delete(i,1) "force delete + endfor + "let g:VEConf.recyclePath = tmpRec + let s:VEContainer.yankMode = '' + let s:VEContainer.clipboard = [] + endif + "if s:VEContainer.yankMode == 'cut' + " call g:VEPlatform.copyMultiFile(s:VEContainer.clipboard,self.path,1) + "else + " call g:VEPlatform.copyMultiFile(s:VEContainer.clipboard,self.path,0) + "endif + let s:VEContainer.yankMode = '' + let s:VEContainer.clipboard = [] + call self.refresh() + "call s:VEContainer.showClipboard() +endfunction! + +function! s:VEFilePanel.markViaRegexp(regexp) + if a:regexp == '' + echohl Special + let regexp = input("Mark files (regexp): ") + echohl None + else + let regexp = a:regexp + endif + let self.selectedFiles = [] + for i in self.displayList + if g:VEPlatform.haswin32() && !&ssl + let name = matchstr(i[1],'[^\\]*.$','','g') + else + let name = matchstr(i[1],'[^/]*.$','','g') + endif + if matchstr(name,regexp) != '' + call add(self.selectedFiles,i[1]) + endif + endfor + call self.drawList() +endfunction + +function! s:VEFilePanel.markExecutable() + let self.selectedFiles = [] + for i in self.displayList + if g:VEPlatform.executable(i[1]) + call add(self.selectedFiles,i[1]) + endif + endfor + call self.drawList() +endfunction + +function! s:VEFilePanel.newFile() + echohl Special + let filename = input("Create file : ",self.path,"file") + echohl None + if filename == '' + echo " " + return + endif + if g:VEPlatform.mkfile(filename) + echohl Special | echomsg "OK" | echohl None + call self.refresh() + else + echohl ErrorMsg | echomsg "Can not create file!" | echohl None + endif +endfunction + +function! s:VEFilePanel.newDirectory() + if !exists("*mkdir") + echoerr "mkdir feature not found!" + endif + echohl Special + let dirname = input("Create directory : ",self.path,"file") + echohl None + if dirname == '' + echo " " + return + endif + if findfile(dirname) == '' && g:VEPlatform.mkdir(dirname) + echohl Special | echomsg "OK" | echohl None + call self.refresh() + else + echohl ErrorMsg | echomsg "Can not create directory!" | echohl None + endif +endfunction + +function! s:VEFilePanel.rename(line) + let path = self.displayList[a:line][1] + if path == '' + return + endif + echohl Special + let name = input("Rename to: ",path,"file") + echohl None + if name == '' + echo " " + return + endif + if findfile(name) != '' + echohl ErrorMsg | echomsg "File exists!" | echohl None + return + endif + if rename(path,name) == 0 + echohl Special | echomsg "OK" | echohl None + call self.refresh() + else + echohl ErrorMsg | echomsg "Can not rename!" | echohl None + endif +endfunction + +function! s:VEFilePanel.search() + echohl Special + let filename = input("Search : ") + echohl None + if filename == '' + echo " " + return + endif + echohl Special | echomsg "Searching [" . filename . "] in " . self.path . ", please wait...(Ctrl-C to break)" | echohl None + let self.fileList = g:VEPlatform.search(filename,self.path) + call self.updateDisplayList() + call self.drawList() +endfunction + +function! s:VEFilePanel.statusFileName() + let line = line(".") - 1 + let fname = self.displayList[line][1] + "let fname = substitute(fname,self.path,'','g') + let fname = fname[len(self.path):] + return fname +endfunction + +function! s:VEFilePanel.createActions() + exec "nnoremap " . g:VEConf.filePanelHotkey.help . " :tab h VimExplorer" + exec "nnoremap " . g:VEConf.filePanelHotkey.switchPanel . " " + exec "nnoremap " . g:VEConf.filePanelHotkey.itemClicked . " :call VE_OnFileItemClick()" + exec "nnoremap " . g:VEConf.filePanelHotkey.itemClickMouse. " :call VE_OnFileItemClick()" + exec "nnoremap " . g:VEConf.filePanelHotkey.toggleTreePanel ." :call VE_ToggleTreePanel()" + exec "nnoremap " . g:VEConf.filePanelHotkey.toUpperDir . " :call VE_ToUpperDir()" + exec "nnoremap " . g:VEConf.filePanelHotkey.gotoForward . " :call VE_GotoForward()" + exec "nnoremap " . g:VEConf.filePanelHotkey.gotoBackward . " :call VE_GotoBackward()" + exec "nnoremap " . g:VEConf.filePanelHotkey.openPreview . " :call VE_OnFileOpenPreview()" + exec "nnoremap " . g:VEConf.filePanelHotkey.closePreview . " :call VE_ClosePreviewPanel()" + exec "nnoremap " . g:VEConf.filePanelHotkey.deleteSingle . " :call VE_DeleteSingle(0)" + exec "nnoremap " . g:VEConf.filePanelHotkey.deleteSingleF. " :call VE_DeleteSingle(1)" + exec "nnoremap " . g:VEConf.filePanelHotkey.rename . " :call VE_Rename()" + exec "nnoremap " . g:VEConf.filePanelHotkey.refresh . " :call VE_RefreshFilePanel()" + exec "nnoremap " . g:VEConf.filePanelHotkey.toggleSelectUp ." :call VE_ToggleSelectFile(\"up\")" + exec "nnoremap " . g:VEConf.filePanelHotkey.toggleSelectDown." :call VE_ToggleSelectFile(\"down\")" + exec "nnoremap " . g:VEConf.filePanelHotkey.clearSelect . " :call VE_ClearSelectFile()" + exec "nnoremap " . g:VEConf.filePanelHotkey.deleteSelected . " :call VE_DeleteSelectedFiles(0)" + exec "nnoremap " . g:VEConf.filePanelHotkey.deleteSelectedF. " :call VE_DeleteSelectedFiles(1)" + exec "nnoremap " . g:VEConf.filePanelHotkey.yankSelected . " :call VE_YankSelectedFiles(\"copy\")" + exec "nnoremap " . g:VEConf.filePanelHotkey.cutSelected . " :call VE_YankSelectedFiles(\"cut\")" + exec "nnoremap " . g:VEConf.filePanelHotkey.yankSingle . " :call VE_YankSingle(\"copy\")" + exec "nnoremap " . g:VEConf.filePanelHotkey.cutSingle . " :call VE_YankSingle(\"cut\")" + exec "nnoremap " . g:VEConf.filePanelHotkey.showYankList . " :call VE_ShowYankList()" + exec "nnoremap " . g:VEConf.filePanelHotkey.toggleModes . " :call VE_ToggleModes()" + exec "nnoremap " . g:VEConf.filePanelHotkey.paste . " :call VE_Paste()" + exec "nnoremap " . g:VEConf.filePanelHotkey.markViaRegexp . " :call VE_MarkViaRegexp('')" + exec "nnoremap " . g:VEConf.filePanelHotkey.markExecutable . " :call VE_MarkExecutable()" + exec "nnoremap " . g:VEConf.filePanelHotkey.markVimFiles . " :call VE_MarkViaRegexp('.*.vim$')" + exec "nnoremap " . g:VEConf.filePanelHotkey.markDirectory . " :call VE_MarkViaRegexp('.*[\\/]$')" + exec "nnoremap " . g:VEConf.filePanelHotkey.newFile . " :call VE_NewFile()" + exec "nnoremap " . g:VEConf.filePanelHotkey.newDirectory . " :call VE_NewDirectory()" + exec "nnoremap " . g:VEConf.filePanelHotkey.markViaRegexp . " :call VE_MarkViaRegexp('')" + exec "nnoremap " . g:VEConf.filePanelHotkey.favorite . " :call VE_GotoFavorite()" + exec "nnoremap " . g:VEConf.filePanelHotkey.addToFavorite . " :call VE_AddToFavorite('filePanel')" + exec "nnoremap " . g:VEConf.filePanelHotkey.browseHistory . " :call VE_BrowseHistory()" + exec "nnoremap " . g:VEConf.filePanelHotkey.gotoPath . " :call VE_OpenPath()" + exec "nnoremap " . g:VEConf.filePanelHotkey.diff2files . " :call VE_Diff()" + exec "nnoremap " . g:VEConf.filePanelHotkey.quitVE . " :call VEDestroy()" + exec "nnoremap " . g:VEConf.filePanelHotkey.toggleHidden . " :call VE_ToggleHidden()" + exec "nnoremap " . g:VEConf.filePanelHotkey.search . " :call VE_FileSearch()" + exec "nnoremap " . g:VEConf.filePanelHotkey.toggleSelMouse . " :call VE_ToggleSelectFile(\"\")" + exec "nnoremap " . g:VEConf.filePanelHotkey.contextMenuN . " :popup ]FilePanelPopup" + + let letter = char2nr('a') + while letter <= char2nr('z') + exec "nnoremap " . g:VEConf.filePanelHotkey.markPlace . nr2char(letter) . + \" :call VE_MarkPlace(\"" . nr2char(letter) . "\")" + exec "nnoremap " . g:VEConf.filePanelHotkey.gotoPlace . nr2char(letter) . + \" :call VE_MarkSwitchTo(\"" . nr2char(letter) . "\")" + let letter = letter + 1 + endwhile + exec "nnoremap " . g:VEConf.filePanelHotkey.viewMarks . " :call VE_MarkList()" + + " visual mode map + exec "vnoremap " . g:VEConf.filePanelHotkey.visualSelect . " :call VE_VisualSelect()" + exec "vnoremap " . g:VEConf.filePanelHotkey.visualDelete . " :call VE_VisualDelete(0)" + exec "vnoremap " . g:VEConf.filePanelHotkey.visualDeleteF. " :call VE_VisualDelete(1)" + exec "vnoremap " . g:VEConf.filePanelHotkey.visualYank . " :call VE_VisualYank(\"copy\")" + exec "vnoremap " . g:VEConf.filePanelHotkey.visualCut . " :call VE_VisualYank(\"cut\")" + + " User defined map + for i in keys(g:VEConf_normalHotKeys) + exec "nnoremap " . g:VEConf_normalHotKeys[i] . + \" :call VE_NormalAction(\"" . i . "\")" + endfor + for i in keys(g:VEConf_singleFileHotKeys) + exec "nnoremap " . g:VEConf_singleFileHotKeys[i] . + \" :call VE_SingleFileAction(\"" . i . "\")" + endfor + for i in keys(g:VEConf_multiFileHotKeys) + exec "nnoremap " . g:VEConf_multiFileHotKeys[i] . + \" :call VE_MultiFileAction(\"" . i . "\")" + endfor + " Auto commands + au! * + au BufEnter call VE_SyncDir() + " Status line + setlocal statusline=%{VE_GetStatusFileName()}%=[%{getcwd()}]\ %{strftime(\"\%Y-\%m-\%d\ \%H:\%M\")} +endfunction + +function! s:VEFilePanel.createSyntax() + let VEFileWinNr = bufwinnr(self.name) + if VEFileWinNr != -1 + exec VEFileWinNr . " wincmd w" + else + return + endif + call g:VEConf.filePanelSyntax() +endfunction + +function! s:VEFilePanel.getPathUnderCursor(num) + return self.displayList[a:num][1] +endfunction + +" class VEPreviewPanel {{{1 +"============================= +"let s:VEPreviewPanel = {} +"let s:VEPreviewPanel.name = '' +"let s:VEPreviewPanel.width = 0 +"let s:VEPreviewPanel.splitMode = '' +"let s:VEPreviewPanel.splitLocation = '' +" +"function! s:VEPreviewPanel.init(name) +" let self.name = "VEPreviewPanel" . a:name +" let self.width = g:VEConf.previewPanelWidth +" let self.splitMode = g:VEConf.previewPanelSplitMode +" let self.splitLocation = g:VEConf.previewPanelSplitLocation +"endfunction + +"function! s:VEPreviewPanel.show() +" if self.setFocus() +" return +" endif +" let cmd = self.splitLocation . " " . self.splitMode . self.width . ' new ' +" exec cmd +" if !self.setFocus() +" echoerr "create file window failed!" +" else +" edit self.name +" endif +"endfunction + +"function! s:VEPreviewPanel.setFocus() +" let VEPreviewWinNr = bufwinnr(self.name) +" if VEPreviewWinNr != -1 +" exec VEPreviewWinNr . " wincmd w" +" return 1 +" else +" "If the window of buffer was closed by hand and the +" "buffer still in buffer list, wipeout it. +" "In case of bufnr() returns empty when there are two +" "buffers have the same name. +" let bufNr = bufnr(self.name) +" if bufNr != -1 +" exec "bwipeout " . bufNr +" endif +" return 0 +" endif +"endfunction +" +"function! s:VEPreviewPanel.hide() +" if !self.setFocus() +" return +" else +" let bufNr = bufnr('%') +"" exec "wincmd c" +" exec "bwipeout ".bufNr +" endif +"endfunction +" +"function! s:VEPreviewPanel.preview(path) +" if !self.setFocus() +" let self.name = a:path +" let cmd = self.splitLocation . " " . self.splitMode . self.width . ' new' +" exec cmd +" exec "edit " . self.name +" return +" else +" let self.name = a:path +" exec "edit " . self.name +" endif +"endfunction + + + +" class VEFrameWork {{{1 +"============================= +let s:VEFrameWork = {} +let s:VEFrameWork.name = '' +let s:VEFrameWork.treePanel = {} +let s:VEFrameWork.filePanel = {} +"let s:VEFrameWork.previewPanel = {} +let s:VEFrameWork.pathHistory = [] +let s:VEFrameWork.pathPosition = -1 + +"Object Constructor +function! s:VEFrameWork.init(name,path) + let self.name = "VEFrameWork".a:name + let self.filePanel = deepcopy(s:VEFilePanel) + let self.treePanel = deepcopy(s:VETreePanel) + "let self.previewPanel = deepcopy(s:VEPreviewPanel) + call self.filePanel.init(a:name,a:path) + call self.treePanel.init(a:name,a:path) + "call self.previewPanel.init(a:name) + call add(self.pathHistory,a:path) + let self.pathPosition += 1 +endfunction + +function! s:VEFrameWork.show() + tabnew + call self.filePanel.show() + call self.filePanel.only() "so,here it means filePanel should be displayed first + call self.treePanel.show() + call self.filePanel.setFocus() + call self.filePanel.refresh() + normal! M +endfunction + +"Switch to another path, it will change the forward/backward +"history. +function! s:VEFrameWork.gotoPath(path) + call self.treePanel.pathChanged(a:path) + call self.filePanel.pathChanged(a:path) + if len(self.pathHistory) > self.pathPosition+1 + call remove(self.pathHistory,self.pathPosition+1,-1) + endif + call add(self.pathHistory,a:path) + if len(self.pathHistory) > g:VEConf.browseHistory + call remove(self.pathHistory,0) + else + let self.pathPosition += 1 + endif +endfunction + +"Forward and backward +function! s:VEFrameWork.gotoForward() + if self.pathPosition >= len(self.pathHistory) || + \ self.pathPosition < 0 || + \ empty(self.pathHistory) + return + endif + if self.pathPosition+1 == len(self.pathHistory) "Can not forward + return + endif + let self.pathPosition += 1 + "Do not call VE_GotoPath here! It will change pathHistory. + "Call the follows instead. + call self.treePanel.pathChanged(self.pathHistory[self.pathPosition]) + call self.filePanel.pathChanged(self.pathHistory[self.pathPosition]) +endfunction + +function! s:VEFrameWork.gotoBackward() + if self.pathPosition >= len(self.pathHistory) || + \ self.pathPosition < 0 || + \ empty(self.pathHistory) + return + endif + if self.pathPosition == 0 "Can not go back. + return + endif + let self.pathPosition -= 1 + "Do not call VE_GotoPath here! It will change pathHistory. + "Call the follows instead. + call self.treePanel.pathChanged(self.pathHistory[self.pathPosition]) + call self.filePanel.pathChanged(self.pathHistory[self.pathPosition]) +endfunction + +"Object destructor +function! s:VEFrameWork.destroy() + call self.filePanel.hide() + call self.treePanel.hide() +endfunction + + + + + + +"#################################################### +"global variables and functions {{{1 + +let s:VEContainer = {} "contains all VEFrameWorks +let s:VEContainer.clipboard = [] "shared clipboard +let s:VEContainer.yankMode = '' "cut or yank +let s:VEContainer.markPlaces = {} + +function! s:VECreatePopMenu() + silent! unmenu ]FilePanelPopup + menu ]FilePanelPopup.&Open :call VE_OnFileItemClick() + menu ]FilePanelPopup.-sep0- : + menu ]FilePanelPopup.&Copy :call VE_YankSingle("copy") + menu ]FilePanelPopup.C&ut :call VE_YankSingle("cut") + menu ]FilePanelPopup.-sep1- : + menu ]FilePanelPopup.&Rename :call VE_Rename() + menu ]FilePanelPopup.&Delete :call VE_DeleteSingle(0) + menu ]FilePanelPopup.Pre&view :call VE_OnFileOpenPreview() + menu ]FilePanelPopup.&Mark :call VE_ToggleSelectFile("") + menu ]FilePanelPopup.-sep2- : + menu ]FilePanelPopup.&Paste :call VE_Paste() + menu ]FilePanelPopup.&New.&File :call VE_NewFile() + menu ]FilePanelPopup.&New.&Directory :call VE_NewDirectory() + menu ]FilePanelPopup.-sep3- : + menu ]FilePanelPopup.Re&fresh :call VE_RefreshFilePanel() +endfunction + +function! VENew(path) + call s:VECreatePopMenu() + let frameName = '_' . substitute(reltimestr(reltime()),'\.','','g') + if a:path == '' + echohl Special + let workPath = input("VimExplorer (directory): ",g:VEPlatform.getcwd(),"file") + echohl None + if workPath == '' + return + endif + else + let workPath = a:path + endif + call g:VEPlatform.cdToPath(workPath) + let workPath = g:VEPlatform.getcwd() "Conversions capitalisations + "does not work here. + if !isdirectory(workPath) + echohl ErrorMsg | echomsg "Directory not exist!" | echohl None + return + endif + let s:VEContainer[frameName] = deepcopy(s:VEFrameWork) + call s:VEContainer[frameName].init(frameName,workPath) + call s:VEContainer[frameName].show() + let letter = char2nr('a') + while letter <= char2nr('z') + let s:VEContainer.markPlaces[nr2char(letter)] = '' + let letter = letter + 1 + endwhile +endfunction + +function! VEDestroy() + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + call s:VEContainer[winName].destroy() + call remove(s:VEContainer,winName) + endif +endfunction + +function! s:VEContainer.showClipboard() + echohl Special + let msg = len(self.clipboard) . " files in clipboard, Mode: " . self.yankMode . ", " + let msg = msg . '(press ' . g:VEConf.filePanelHotkey.showYankList . ' to show file list)' + echomsg msg + echohl None +endfunction + +" Get path name under cursor +function! VE_getPathUnderCursor(where) + let winName = matchstr(bufname("%"),'_[^_]*$') + let path = '' + if has_key(s:VEContainer,winName) + if a:where == 'treePanel' + let path = s:VEContainer[winName].treePanel.getPathUnderCursor(line(".")-1) + elseif a:where == 'filePanel' + let path = s:VEContainer[winName].filePanel.getPathUnderCursor(line(".")-1) + endif + endif + + if !isdirectory(path) + return '' + else + return path + endif +endfunction + + +"Command handlers +"=================================== + +"TreePanel command handlers +"---------------------------- +"Node click event +function! VE_OnTreeNodeClick() + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + call s:VEContainer[winName].treePanel.nodeClicked(line(".")-1) + endif +endfunction + +"Refresh tree command +function! VE_TreeRefresh() + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + call s:VEContainer[winName].treePanel.refresh() + endif +endfunction + +"FilePanel command handlers +"---------------------------- +"Item click event. +function! VE_OnFileItemClick() + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + call s:VEContainer[winName].filePanel.itemClicked(line(".")-1) + endif +endfunction + +"Open preview. +function! VE_OnFileOpenPreview() + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + call s:VEContainer[winName].filePanel.itemPreview(line(".")-1) + endif +endfunction + +"Refresh the panel. +function! VE_RefreshFilePanel() + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + call s:VEContainer[winName].filePanel.refresh() + endif +endfunction + +"User defined single file actions. +function! VE_SingleFileAction(actionName) + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + call s:VEContainer[winName].filePanel.singleFileAction((line(".")-1),a:actionName) + endif +endfunction + +"User defined normal actions. +function! VE_NormalAction(actionName) + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + call s:VEContainer[winName].filePanel.normalAction(a:actionName) + endif +endfunction + +"Multiple file actions. +function! VE_MultiFileAction(actionName) + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + call s:VEContainer[winName].filePanel.multiAction(a:actionName) + endif +endfunction + +"Delete single file or directory. +function! VE_DeleteSingle(bForce) + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + call s:VEContainer[winName].filePanel.deleteSingle(line(".")-1,a:bForce) + endif +endfunction + +"Rename file or dir +function! VE_Rename() + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + call s:VEContainer[winName].filePanel.rename(line(".")-1) + endif +endfunction + +"Toggle select a file in file panel. +function! VE_ToggleSelectFile(direction) + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + call s:VEContainer[winName].filePanel.toggleSelect(a:direction) + endif +endfunction + +"Clear selection. +function! VE_ClearSelectFile() + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + call s:VEContainer[winName].filePanel.clearSelect() + endif +endfunction + +"Toggle sort mode +function! VE_ToggleModes() + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + call s:VEContainer[winName].filePanel.toggleModes() + endif +endfunction + +"Mark via regexp +function! VE_MarkViaRegexp(regexp) + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + call s:VEContainer[winName].filePanel.markViaRegexp(a:regexp) + endif +endfunction + +"Mark executable files. +function! VE_MarkExecutable() + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + call s:VEContainer[winName].filePanel.markExecutable() + endif +endfunction + +"create file +function! VE_NewFile() + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + call s:VEContainer[winName].filePanel.newFile() + endif +endfunction + +"create directory +function! VE_NewDirectory() + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + call s:VEContainer[winName].filePanel.newDirectory() + endif +endfunction + +"delete selected files. +function! VE_DeleteSelectedFiles(bForce) + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + call s:VEContainer[winName].filePanel.deleteSelectedFiles(a:bForce) + endif +endfunction + +"delete selected files. +function! VE_YankSelectedFiles(mode) + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + let s:VEContainer.clipboard = s:VEContainer[winName].filePanel.selectedFiles + let s:VEContainer.yankMode = a:mode + endif + call s:VEContainer.showClipboard() +endfunction + +function! VE_YankSingle(mode) + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + call s:VEContainer[winName].filePanel.yankSingle(a:mode) + endif +endfunction + +function! VE_Paste() + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + call s:VEContainer[winName].filePanel.paste() + endif +endfunction + +function! VE_FileSearch() + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + call s:VEContainer[winName].filePanel.search() + endif +endfunction + + +"visual mode functions. +"visual select +function! VE_VisualSelect() range + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + call s:VEContainer[winName].filePanel.visualSelect(a:firstline-1,a:lastline-1) + endif +endfunction + +"visual delete +function! VE_VisualDelete(bForce) range + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + call s:VEContainer[winName].filePanel.visualDelete(a:firstline-1,a:lastline-1,a:bForce) + endif +endfunction + +"visual yank +function! VE_VisualYank(mode) range + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + call s:VEContainer[winName].filePanel.visualYank(a:firstline-1,a:lastline-1,a:mode) + endif +endfunction + +function! VE_ShowYankList() + if s:VEContainer.clipboard == [] + return + endif + for i in s:VEContainer.clipboard + echo i + endfor +endfunction + +"Common command handlers +"-------------------------- +"get file name for status line. +function! VE_GetStatusFileName() + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + return s:VEContainer[winName].filePanel.statusFileName() + else + return '' + endif +endfunction + +"mark palce +function! VE_MarkPlace(char) + let s:VEContainer.markPlaces[a:char] = g:VEPlatform.getcwd() +endfunction + +"goto marked place +function! VE_MarkSwitchTo(char) + call VE_GotoPath(s:VEContainer.markPlaces[a:char]) +endfunction + +function! VE_MarkList() + let list = [] + let letter = char2nr('a') + while letter <= char2nr('z') + if s:VEContainer.markPlaces[nr2char(letter)] != '' + echo nr2char(letter) . " " . s:VEContainer.markPlaces[nr2char(letter)] + endif + let letter = letter + 1 + endwhile +endfunction + +"Toggle tree panel. +function! VE_ToggleTreePanel() + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + if s:VEContainer[winName].treePanel.setFocus() + call s:VEContainer[winName].treePanel.hide() + else + call s:VEContainer[winName].treePanel.show() + endif + endif + exec "wincmd p" +endfunction + +"Toggle file panel. +function! VE_ToggleFilePanel() + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + if s:VEContainer[winName].filePanel.setFocus() + call s:VEContainer[winName].filePanel.hide() + else + call s:VEContainer[winName].filePanel.show() + endif + endif + call s:VEContainer[winName].treePanel.setFocus() + exec g:VEConf.treePanelWidth . " wincmd |" +endfunction + +function! VE_ClosePreviewPanel() + pclose +endfunction + + +"Go to upper directory. +function! VE_ToUpperDir() + let winNr = bufwinnr('%') + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + let path = s:VEContainer[winName].filePanel.path + " Assert filePanel.path == treePanel.path + let upperPath = g:VEPlatform.getUpperDir(path) + if upperPath == path + return + endif + call VE_GotoPath(upperPath) + let dir = split(path,'/') + call search(" " . dir[-1] . "/\t") + endif + exec winNr . "wincmd w" +endfunction + +"Path change event +function! VE_GotoPath(path) + if !isdirectory(a:path) + return + endif + call g:VEPlatform.cdToPath(a:path) + let path = g:VEPlatform.getcwd() + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + call s:VEContainer[winName].gotoPath(path) + endif +endfunction + +"Used in +function! VE_OpenPath() + echohl Special + let workPath = input("Change path to (directory): ",'',"file") + echohl None + if workPath == '' + return + endif + call g:VEPlatform.cdToPath(workPath) + let workPath = g:VEPlatform.getcwd() + call VE_GotoPath(workPath) +endfunction + +"Goto forward +function! VE_GotoForward() + let winNr = bufwinnr('%') + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + call s:VEContainer[winName].gotoForward() + endif + exec winNr . "wincmd w" +endfunction + +"Goto backward +function! VE_GotoBackward() + let winNr = bufwinnr('%') + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + call s:VEContainer[winName].gotoBackward() + endif + exec winNr . "wincmd w" +endfunction + +"Favorite +function! VE_GotoFavorite() + let fav_filename = g:VEPlatform.getHome() . g:VEConf.favorite + if findfile(fav_filename)=='' || !filereadable(fav_filename) + return + endif + let fav = readfile(fav_filename) + let result = g:VEPlatform.select(fav,"Favorite folder list:") + if result == -1 + return + endif + call VE_GotoPath(fav[result]) +endfunction + +function! VE_AddToFavorite(where) + let winNr = bufwinnr('%') + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + let cwd = s:VEContainer[winName].filePanel.path + else + return + endif + let pathUnderCursor = VE_getPathUnderCursor(a:where) + if pathUnderCursor != '' + " if no path name under cursor, use current working path + let cwd = pathUnderCursor + endif + let fav_filename = g:VEPlatform.getHome() . g:VEConf.favorite + let fav = [] + if findfile(fav_filename) != '' + if !filereadable(fav_filename) + echoerr "Can not read favorite folder list!" + return + endif + if !filewritable(fav_filename) + echoerr "Can not write favorite folder list to file!" + return + endif + let fav = readfile(fav_filename) + endif + if index(fav,cwd) != -1 + "echohl WarningMsg | echomsg "Current directory already in the favorite list." | echohl None + echohl WarningMsg | echomsg "[ ".cwd." ] already in the favorite!" | echohl None + return + endif + call add(fav,cwd) + if writefile(fav,fav_filename) == 0 + echohl Special | echomsg "[ ".cwd." ] added to favorite." | echohl None + else + echoerr "Can not write favorite folder list to file!" + endif +endfunction + +"forward and backward history +function! VE_BrowseHistory() + let winNr = bufwinnr('%') + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + let pathlist = s:VEContainer[winName].pathHistory + let result = g:VEPlatform.select(pathlist,"Browse history:") + if result == -1 + return + else + call s:VEContainer[winName].treePanel.pathChanged(pathlist[result]) + call s:VEContainer[winName].filePanel.pathChanged(pathlist[result]) + let s:VEContainer[winName].pathPosition = result + endif + endif +endfunction + +"sync directory +function! VE_SyncDir() + let winNr = bufwinnr('%') + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + let path = s:VEContainer[winName].filePanel.path + call g:VEPlatform.cdToPath(path) + endif +endfunction + +"diff 2 files +function! VE_Diff() + let winNr = bufwinnr('%') + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + let diffFiles = s:VEContainer[winName].filePanel.selectedFiles + if len(diffFiles) != 2 || isdirectory(diffFiles[0]) || isdirectory(diffFiles[1]) + echohl WarningMsg | echo "Please select 2 files to diff!" | echohl None + return + endif + exec "tabe " . g:VEPlatform.escape(diffFiles[0]) + exec "vertical diffsplit " . g:VEPlatform.escape(diffFiles[1]) + endif +endfunction + +"toggle show hidden files +function! VE_ToggleHidden() + let winNr = bufwinnr('%') + let winName = matchstr(bufname("%"),'_[^_]*$') + if has_key(s:VEContainer,winName) + let g:VEConf.showHiddenFiles = !g:VEConf.showHiddenFiles + call s:VEContainer[winName].treePanel.refresh() + call s:VEContainer[winName].filePanel.refresh() + endif +endfunction + +command! -nargs=? -complete=file VE call VENew('') +command! -nargs=0 -complete=file VEC call VEDestroy() + + +"==================================================================== +" +" Function: s:InstallDocumentation(full_name, revision) +" Install help documentation. +" Arguments: +" full_name: Full name of this vim plugin script, including path name. +" revision: Revision of the vim script. #version# mark in the document file +" will be replaced with this string with 'v' prefix. +" Return: +" 1 if new document installed, 0 otherwise. +" Note: Cleaned and generalized by guo-peng Wen. +" +" Note about authorship: this function was taken from the vimspell plugin +" which can be found at http://www.vim.org/scripts/script.php?script_id=465 +" +function! s:InstallDocumentation(full_name, revision) + " Name of the document path based on the system we use: + if has("vms") + " No chance that this script will work with + " VMS - to much pathname juggling here. + return 1 + elseif (has("unix")) + " On UNIX like system, using forward slash: + let l:slash_char = '/' + let l:mkdir_cmd = ':silent !mkdir -p ' + else + " On M$ system, use backslash. Also mkdir syntax is different. + " This should only work on W2K and up. + let l:slash_char = '\' + let l:mkdir_cmd = ':silent !mkdir ' + endif + + let l:doc_path = l:slash_char . 'doc' + let l:doc_home = l:slash_char . '.vim' . l:slash_char . 'doc' + + " Figure out document path based on full name of this script: + let l:vim_plugin_path = fnamemodify(a:full_name, ':h') + let l:vim_doc_path = fnamemodify(a:full_name, ':h:h') . l:doc_path + if (!(filewritable(l:vim_doc_path) == 2)) + "Doc path: " . l:vim_doc_path + echo "Doc path: " . l:vim_doc_path + execute l:mkdir_cmd . '"' . l:vim_doc_path . '"' + if (!(filewritable(l:vim_doc_path) == 2)) + " Try a default configuration in user home: + let l:vim_doc_path = expand("~") . l:doc_home + if (!(filewritable(l:vim_doc_path) == 2)) + execute l:mkdir_cmd . '"' . l:vim_doc_path . '"' + if (!(filewritable(l:vim_doc_path) == 2)) + " Put a warning: + echo "Unable to open documentation directory" + echo "type :help add-local-help for more information." + echo l:vim_doc_path + return 0 + endif + endif + endif + endif + + " Exit if we have problem to access the document directory: + if (!isdirectory(l:vim_plugin_path) || !isdirectory(l:vim_doc_path) || filewritable(l:vim_doc_path) != 2) + return 0 + endif + + " Full name of script and documentation file: + let l:script_name = fnamemodify(a:full_name, ':t') + let l:doc_name = fnamemodify(a:full_name, ':t:r') . '.txt' + let l:plugin_file = l:vim_plugin_path . l:slash_char . l:script_name + let l:doc_file = l:vim_doc_path . l:slash_char . l:doc_name + + " Bail out if document file is still up to date: + if (filereadable(l:doc_file) && getftime(l:plugin_file) < getftime(l:doc_file)) + return 0 + endif + + " Prepare window position restoring command: + if (strlen(@%)) + let l:go_back = 'b ' . bufnr("%") + else + let l:go_back = 'enew!' + endif + + " Create a new buffer & read in the plugin file (me): + setl nomodeline + exe 'enew!' + exe 'r ' . l:plugin_file + + setl modeline + let l:buf = bufnr("%") + setl noswapfile modifiable + + norm zR + norm gg + + " Delete from first line to a line starts with + " === START_DOC + 1,/^=\{3,}\s\+START_DOC\C/ d + + " Delete from a line starts with + " === END_DOC + " to the end of the documents: + /^=\{3,}\s\+END_DOC\C/,$ d + + " Add modeline for help doc: the modeline string is mangled intentionally + " to avoid it be recognized by VIM: + call append(line('$'), '') + call append(line('$'), ' v' . 'im:tw=78:ts=8:ft=help:norl:') + + " Replace revision: + "exe "normal :1s/#version#/ v" . a:revision . "/\" + exe "normal :%s/#version#/ v" . a:revision . "/\" + + " Save the help document: + exe 'w! ' . l:doc_file + exe l:go_back + exe 'bw ' . l:buf + + " Build help tags: + exe 'helptags ' . l:vim_doc_path + + return 1 +endfunction + +" Doc installation call {{{1 +silent call s:InstallDocumentation(expand(':p'),"0.99") +"============================================================ +finish + +"Manual {{{1 +=== START_DOC +*VimExplorer* A powerful file manager #version# + + + VimExplorer Reference Manual + by Ming Bai (mbbill AT gmail.com) + + +============================================================================== +CONTENTS *VimExplorer-contents* + +1. Intro.......................................|VimExplorer-start| +2. Functionality...............................|VimExplorer-functionality| + 2.1 Tree Panel Hotkeys.....................|VimExplorer-treehotkey| + 2.2 File Panel Hotkeys.....................|VimExplorer-filehotkey| + 2.3 Commands...............................|VimExplorer-commands| +3. Directory Browsing..........................|VimExplorer-browse| + 3.1 Tree Browsing..........................|VimExplorer-treebrowse| + 3.2 File Browsing..........................|VimExplorer-filebrowse| + 3.3 Forward and Backward...................|VimExplorer-forbackward| + 3.4 Favorites..............................|VimExplorer-favorite| + 3.5 Temp Marks.............................|VimExplorer-tempmark| +4. Marks.......................................|VimExplorer-mark| + 4.1 Single File Marks......................|VimExplorer-marksingle| + 4.2 Visual Marks...........................|VimExplorer-markvisual| + 4.3 Regexp Marks...........................|VimExplorer-markregexp| +5. File operations.............................|VimExplorer-fileoperation| + 5.1 Create.................................|VimExplorer-new| + 5.2 Move...................................|VimExplorer-move| + 5.3 Delete.................................|VimExplorer-delete| + 5.4 Diff...................................|VimExplorer-diff| + 5.5 Search.................................|VimExplorer-search| + 5.6 Other Operations.......................|VimExplorer-otherfileopt| +6. Other Functionalities.......................|VimExplorer-otherfuncs| +7. Customization...............................|VimExplorer-customize| + 7.1 Normal Options.........................|VimExplorer-custnormal| + 7.2 Hotkey Customization...................|VimExplorer-custhotkey| + 7.3 Command Customization..................|VimExplorer-custcommand| +8. The Author..................................|VimExplorer-author| +9. Problems and Fixes..........................|VimExplorer-problems| +10. Changelog...................................|VimExplorer-changelog| +11. TODO........................................|VimExplorer-todo| + + +============================================================================== +1. Intro *VimExplorer-start* + +What is VimExplorer ? +VimExplorer is a file manager, it can do a lot of file operations such as +copy, delete, move, preview, search and so on. Also it has a variety of other +capacities and customization abilities. + +You can start VimExplorer by the following command: +> + :VE +< +Then it will ask you for the starting directory, default is the current path. +> + VimExplorer (directory): /home/username/ +< +You can change it to some other directories or just push "Enter" to start it. + +The second approach to start VimExplorer: +> + :VE [directory] +< +Example: +> + :VE /usr/src/ +< +Now, VimExplorer will start using the path '/usr/src/'. When you are typing +the path, and will help you to complete the path automatically. +After all of these operations, you can see a new tab which has two panels +within it, one is the "Tree Panel" and the other is "File Panel". From now you +will have a happy journey using the powerful file manager. + + +============================================================================== +2. Functionality *VimExplorer-functionality* + +2.1 Tree Panel Hotkeys *VimExplorer-treehotkey* + +Member of |VEConf_treeHotkey|, refer to section 7.2 . + +Mapping Key Description~ +help ? Help. +toggleNode Open/Close/Switch to current node. +toggleNodeMouse <2-LeftMouse> Open/Close/Switch to current node. +refresh r Refresh the tree panel. +favorite f View favorite folder list. +addToFavorite F Add the folder under cursor to + favorite list. If no path under + cursor, use current working path. +browseHistory b View browse history. +toggleFilePanel t Toggle the file panel. +toUpperDir Go to upper directory. +switchPanel Switch to File Panel. +gotoPath Change to another path. +quitVE Q Quit VimExplorer. + +2.2 File Panel Hotkeys *VimExplorer-filehotkey* + +Member of |VEConf_fileHotkey|, refer to section 7.2 . + +Mapping Default Description~ +help ? Help. +itemClicked Enter the directory or open the file + by default association. +itemClickMouse <2-LeftMouse> Enter the directory or open the file + by default association. +refresh r Refresh. +toggleTreePanel t Toggle the Tree Panel. +toggleModes i Toggle file sort mode (type/data/file + extension). +newFile +f Create a new file. +newDirectory +d Create a new directory. +switchPanel Switch to the Tree Panel. +quitVE Q Quit VimExplorer. +toggleHidden H Toggle show hidden files.(files start + with '.') +search g/ Search. +markPlace m{a-z} Put current path to register(a-z). +gotoPlace '{a-z} Jump to path in register(a-z). +viewMarks J View path in register. +contextMenuN File panel context menu in normal mode. +toUpperDir Go to upper directory. +gotoForward Forward. +gotoBackward Backward. +favorite f View favorite folder list. +addToFavorite F Add the folder under cursor to + favorite list. If no path under + cursor, use current working path. +browseHistory b View browse history. +gotoPath Change to another path. +rename R Rename the file under cursor. +yankSingle yy Copy file under cursor. +cutSingle xx Cut file under cursor. +showYankList yl Show clipboard. +deleteSingle dd Delete file under cursor to recycle bin. +deleteSingle DD Force delete file under cursor. +openPreview u Preview. +closePreview U Close the preview panel. +toggleSelectUp Move the cursor up and mark/unmark the + file under cursor. +toggleSelectDown Mark/unmark the file under cursor and + move the cursor down. +toggleSelMouse Mark/unmark the file under cursor. +markViaRegexp Mr Mark via regular expression. +markVimFiles Mv Mark all vim files. +markDirectory Md Mark all directories. +markExecutable Me Mark all executable files. +clearSelect Mc Clear all marks. +deleteSelected sd Delete marked files to recycle bin. +deleteSelected sD Force delete marked files. +yankSelected sy Copy marked files. +cutSelected sx Cut marked files. +tabViewMulti se Edit every marked file in separate + tabs. +paste p Paste. +diff2files = Diff two files. +tabView e Edit file in new tab. +openRenamer ;r Open Renamer (Note 1) +startShell ;c Start a shell from current path. +startExplorer ;e Start another file + manager(nautilus,konquer,explorer.exe). + +Visual Mode Hotkeys~ +visualSelect Mark files. +visualDelete d Delete files to recycle bin. +visualDelete D Force delete files. +visualYank y Copy files. +visualCut x Cut files. +tabView e View files in new tabs. + +2.3 Commands *VimExplorer-commands* +> + VE +< +Start VimExplorer. + +> + VEC +< +Close VimExplorer, Hotkey |Q| has the same ability. + +============================================================================== +3. Directory Browsing *VimExplorer-browse* + +3.1 Tree Browsing *VimExplorer-treebrowse* + +Press "Enter" on one tree node will change the path and add the new path to +browse history. By default, if a directory has it's own child directories, |+| +will be displayed before it's name, and It will cause a little performance +lost. If you don't need this feature ,set the following variable to zero can +disable it. +> + let VEConf_showFolderStatus = 0 +< +There are some differences between win32 and other platforms. In win32, there +are several root nodes (such as C:\,D:\), but one root node (/) in other +platforms. + +3.2 File Browsing *VimExplorer-filebrowse* + +The file panel consist of two parts: the path in the top and the following +file list. Every line of the file list consist from the following regions: + +[*] {file-name} [file-size] {permission} {modify-time} + +The file panel can sort by type, file name and date. Hotkey |i| is used to +cycle between these modes. Default sort mode controlled by following variable: +> + VEConf_filePanelSortType + +< +See Customization section for more details. + +3.3 Forward and Backward *VimExplorer-forbackward* + +When using "Enter" switch to an new folder, the path will be add to browse +history. Then you can use || and || to go backward and forward. +Hotkey |b| is used to list all browse history, select by number or mouse can +take you directory to that path. + +By default, the depth of browse history is 100. Controled by this variable: +> + VEConf_browseHistory +< +VimExplorer can remember the cursor position every time leaving a directory, +so it can restore the cursor when return to it. If a directory is newly +entered, the cursor will be put in the middle of the screen. + +3.4 Favorites *VimExplorer-favorite* + +The favorite folder list is saved to the file $HOME/.ve_favorite . It will be +updated when new folder is added to favorite by hotkey |F|. The format of +".ve_favorite" is very simple: every line is a path, so edit it is quite +easy. + +3.5 Temp Marks *VimExplorer-tempmark* + +Just like the favorites, |ma| put current path into register 'a', and |'a| can +jump to the path. |J| is used to list every non empty register. All paths in +register will disappear after VimExplorer exists. + +============================================================================== +4. Marks *VimExplorer-mark* + +The simplest way is to press upon a file. There will be a '*' before +marked files and also be displayed in a different color. +There are three way to mark files: + +4.1 Single File Marks *VimExplorer-marksingle* + + Invert selection, move the cursor down. + Move the cursor up, then invert selection. +Just like most of vim commands, 5 will mark 5 files start from current +cursor. + +4.2 Visual Marks *VimExplorer-markvisual* + + in visual mode will invert selected these files. + +4.3 Regexp Marks *VimExplorer-markregexp* + +Hotkey: |Mr| +Only the file name is the target of regexp match. Example: +> + Mark file (regexp): ^abc.*\.vim$ +< +It will mark all vim scripts start with abc. The following functionalities is +derived from this feature: +|Mv| mark all vim scripts. +|Me| mark all executable files. +|Md| mark all directories. +and |Mc| to clear all marks. + +============================================================================== +5. File Operations *VimExplorer-fileoperation* + +5.1 Create *VimExplorer-new* + +|+f| and |+d| is used to create new files and directories. + +5.2 Move *VimExplorer-move* + +There are several hotkey used to copy/cut files: +|yy| and |sy| in normal mode ,|y| in visual mode is to copy file. +|xx| and |sx| in normal mode ,|x| in visual mode is to cut file. +|p| paste file. +Note that the clipboard is shared between all VimExplorers ,you can cut in one +VE tab and paste in another. +If you want to view the clipboard, |yl| can be help. + +5.3 Delete *VimExplorer-delete* + +|dd|,|sd| in normal mode and |d| in visual mode can delete file(s) to recycle bin. +Corresponding |DD|,|sD| and |D| are used to force delete file(s). + +5.4 Diff *VimExplorer-diff* + +|=| is used to diff 2 files, so make sure you have selected 2 files before +using this command. + +5.5 Search *VimExplorer-search* + +Just like / ,but the pattern here is not the regexp in vim, it will be +expended by shell. + +5.6 Other Operations *VimExplorer-otherfileopt* + +|e| |R| |u| and so on ... Refer to section 2.2 + +============================================================================== +6. Other Functionalities *VimExplorer-otherfuncs* + +|;r| |;c| |;e| and so on ...Rever to section 2.2 + +============================================================================== +7. Customization *VimExplorer-customize* + +7.1 Normal Options *VimExplorer-custnormal* + +Common Options~ + +|g:VEConf_systemEncoding| It controls the encoding of vim calling + function system(). If your system encoding + is different from '&encoding', set this + value to system encoding. Example: let + g:VEConf_systemEncoding = 'utf-8' + ,Default: '' (empty) + +|g:VEConf_win32Disks| The default value is all 26 volumes. Set this + value to fit your system can increase the + startup speed. If you are not using + Microsoft Windows, ignore it. Example: + let VEConf_win32Disks = + ["A:","B:","C:","D:"] + +|g:VEConf_browseHistory| Depth of browse history. Default: 100 + +|g:VEConf_previewSplitLocation| Split location of preview panel. Optional + parameters are: + "belowright","topleft","leftabove","botright". + Default: "belowright" + +|g:VEConf_showHiddenFiles| Show hidden files, 1: show,0: hide. Default: 1 + +|g:VEConf_externalExplorer| Name of the external file explorer. You can + set this value according to you system. + Default: "explorer.exe"(win32) "nautilus" + (gnome) + +|g:VEConf_sortCaseSensitive| 0: not case sensitive 1: case sensitive + Default: 1 + +|g:VEConf_favorite| Favorite folder file name. Always stored in + $HOME. Default: ".ve_favorite" + +|g:VEConf_overWriteExisting| Ask when over write existing files. + 0: ask 1: always over write 2: always + not over write Default: 0 + +|g:VEConf_usingKDE| If set to 1, use "kfmclient" +|g:VEConf_usingGnome| If set to 1, use "gnome-open" + +|g:VEConf_recyclePath| Recycle path. Example: + let g:VEConf_recyclePath = 'C:\VErecycle\' + +Tree Panel Options~ + +|g:VEConf_showFolderStatus| It controls whether show '+' before the + folders which have their own child + folders. If it is set to 1, every folder + will have a '+'. Default: 1 + +|g:VEConf_treePanelWidth| Width of tree panel. Default: 30 + +|g:VEConf_treePanelSplitMode| Split mode of tree panel. Default: "vertical" + +|g:VEConf_treePanelSplitLocation| Split location of tree panel, Optional + parameters: "belowright" , "topleft" , + "leftabove" , "botright", Default: + "leftabove" + +|g:VEConf_treeSortDirection| Sort direction. 1: A-Z 0: Z-A. Default: 1 + +File Panel Options~ + +|g:VEConf_fileGroupSortDirection| Sort direction. 1: A-Z 0: Z-A, Default: 1 + +|g:VEConf_fileDeleteConfirm| Confirm when deleting a file. 1: confirm 2: + no confirm. Default: 1 + +|g:VEConf_filePanelWidth| Width of file panel. Default: 40 + +|g:VEConf_filePanelSplitMode| Split mode of file panel. Default: "vertical" + +|g:VEConf_filePanelSplitLocation| Split location of file panel, Optional + parameters: "belowright" , "topleft" , + "leftabove" , "botright" ,Default: + "leftabove" + +|g:VEConf_filePanelSortType| File sort type. 1: sort by name 2: sort by + time 3: sort by type, Default: 3 + +|g:VEConf_showFileSizeInMKB| 1: Show file size in MKB format. 0: always + show file size in byte. + +|g:VEConf_filePanelFilter| Filter of the file panel, which will be + passed to glob() function. Example: + let g:VEConf_filePanelFilter = '*.txt' + +7.2 Hotkey Customization *VimExplorer-custhotkey* + +All user defined hotkeys are controlled by the two dicts: +|g:VEConf_treeHotkey| and |g:VEConf_fileHotkey| +Example: +> + let g:VEConf_treeHotkey = {} + let g:VEConf_treeHotkey.help = '??' + let g:VEConf_treeHotkey.quitVE = 'qq' + let g:VEConf_treeHotkey.switchPanel = '' +< +All definable hotkeys and their default bindings refer to section 2 . + +7.3. Command Customization *VimExplorer-custcommand* + +VimExplorer supports three types of command interface: +single file hotkeys and actions, multi file hotkeys and actions and normal +hotkeys and actions. +They are controlled by these variables: + + |g:VEConf_singleFileActions| |g:VEConf_singleFileHotKeys| + + |g:VEConf_multiFileActions| |g:VEConf_multiFileHotKeys| + + |g:VEConf_normalActions| |g:VEConf_normalHotKeys| + +All of them are dicts. Example: +> + let g:VEConf_normalActions = {} + let g:VEConf_normalHotKeys = {} + let g:VEConf_normalHotKeys['test1'] = 'T1' + function! VEConf_normalActions['test1']() + Renamer + endfunction +< +"test1" is the key. VimExplorer will bind the hotkey and corresponding actions +automatically. +> + let g:VEConf_singleFileActions = {} + let g:VEConf_singleFileHotKeys = {} + let g:VEConf_singleFileHotKeys['test2'] = 'T2' + function! VEConf_singleFileActions['test2'](path) + call g:VEPlatform.system("notepad.exe " . g:VEPlatform.escape(a:path)) + endfunction +< +Here, parameter "path" is the path of file under cursor. +> + let g:VEConf_multiFileActions = {} + let g:VEConf_multiFileHotKeys = {} + let g:VEConf_multiFileHotKeys['test3'] = 'T3' + function! VEConf_multiFileActions['test3'](fileList) + for i in a:fileList + call g:VEPlatform.start("nautilus " . i) + endfor + endfunction +< +Parameter "fileList" consists of all paths of marked files. +In addition, VimExplorer provides some platform independent functions: +> + g:VEPlatform.start(path) + g:VEPlatform.system(cmd) + g:VEPlatform.copyfile(filename,topath) + g:VEPlatform.search(filename,path) + g:VEPlatform.deleteSingle(path) +< +These functions can be used in user defined actions. + + + + +============================================================================== +8. The Author *VimExplorer-author* + +If you have find a bug, or have some suggestions , mail me. + +mail: mbbillgmailcom + +============================================================================== +9. Problems and Fixes *VimExplorer-problems* + + *VimExplorer-p1* +P1. Case sensitive in Win32. + At present, the path in win32 is case sensitive. Pay attention to this + when starting VE, editing the favorite list or using to change + path. A good suggestion is using or to complete path + automatically. + + *VimExplorer-p2* +P2. 'wildignre' option cause some files disappeared. + If 'wildignore' is not empty, glob() function will not return files + matching the file pattern listed in it, then you may find some files + disappeared in the file panel. + + + +============================================================================== +10. Changelog *VimExplorer-changelog* + +0.95 + - Initial release. + +0.96 + - BUG: VE_normalAction not found. + +0.97 + - NEW: Add options |g:VEConf_usingKDE| and |g:VEConf_usingGnome| for + starting program in *nix environment. + - NEW: Check if the script is already loaded, thanks to Dennis Hostetler. + - BUG: Escape ' %#' for path. + - BUG: Favorite selection out of range. + - CHG: Change the behaviour of hotkey 'F', now it adds the path under + cursor to favorite list. If no path under cursor, use current + working path instead.(Thanks to Vincent Wang) + - CHG: Change default g:VEConf_systemEncoding to '' (empty). +0.98 + - NEW: Add option VEConf_filePanelFilter. + - BUG: Escape in command 'e' 'se' 'u' and '='. + - BUG: 'Cut' and 'Paste' command causes file lost. + - CHG: Change the default hotkey 'M' and 'B' to 'm','J'. + - CHG: Change forward and backward hotkey to || and ||(). + - CHG: Change hotkey || to ||. + - CHG: Change hotkey |mr| |mv| |md| |me| |mc| to |Mr| |Mv| |Md| |Me| |Mc|. + - CHG: When GUI is running, use confirm() to pop a dialog instead of input(). +0.99 + - NEW: Add toggle selection hotkey . + - NEW: Add a context menu in file panel, right click on a file to popup it. + - NEW: Add "delete to recycle",hotkey |dd|,|sd| and |d| in visual mode + are used to delete file(s) to recycle bin.The curresponding + |DD|,|sD|,|D| hotkey are used to force delete files. + - NEW: Now VE can remember the cursor position when reenter a directory. + - BUG: All files are put to "Hidden Files" group in a hidden directory. + - BUG: 'sd' twice after selection will cause an error. + +============================================================================== +11. TODO *VimExplorer-todo* + - More clipboard. + - Diff files in different directories. + - Two panel mode, just like TotalCommand. + - Diff directories. + - Browse via e.g. FTP, SCP ... directorys on a server. + - Rename file when file exsits in copy operation. + - Compress file. + - Send to. + + +============================================================================== +Note 1: +Renamer is a good plugin, which is used to rename group of files. The author +is John Orr. It can be found here: +http://www.vim.org/scripts/script.php?script_id=1721 + + +=== END_DOC +" vim: set et fdm=marker sts=4 sw=4 tw=78: diff --git a/.vim/plugin/cscope_maps.vim b/.vim/plugin/cscope_maps.vim new file mode 100644 index 0000000..c577b45 --- /dev/null +++ b/.vim/plugin/cscope_maps.vim @@ -0,0 +1,165 @@ +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" CSCOPE settings for vim +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" +" This file contains some boilerplate settings for vim's cscope interface, +" plus some keyboard mappings that I've found useful. +" +" USAGE: +" -- vim 6: Stick this file in your ~/.vim/plugin directory (or in a +" 'plugin' directory in some other directory that is in your +" 'runtimepath'. +" +" -- vim 5: Stick this file somewhere and 'source cscope.vim' it from +" your ~/.vimrc file (or cut and paste it into your .vimrc). +" +" NOTE: +" These key maps use multiple keystrokes (2 or 3 keys). If you find that vim +" keeps timing you out before you can complete them, try changing your timeout +" settings, as explained below. +" +" Happy cscoping, +" +" Jason Duell jduell@alumni.princeton.edu 2002/3/7 +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + + +" This tests to see if vim was configured with the '--enable-cscope' option +" when it was compiled. If it wasn't, time to recompile vim... +if has("cscope") + + """"""""""""" Standard cscope/vim boilerplate + + " use both cscope and ctag for 'ctrl-]', ':ta', and 'vim -t' + set cscopetag + + " check cscope for definition of a symbol before checking ctags: set to 1 + " if you want the reverse search order. + set csto=0 + + " add any cscope database in current directory + if filereadable("cscope.out") + cs add cscope.out + " else add the database pointed to by environment variable + elseif $CSCOPE_DB != "" + cs add $CSCOPE_DB + endif + + " show msg when any other cscope db added + set cscopeverbose + + + """"""""""""" My cscope/vim key mappings + " + " The following maps all invoke one of the following cscope search types: + " + " 's' symbol: find all references to the token under cursor + " 'g' global: find global definition(s) of the token under cursor + " 'c' calls: find all calls to the function name under cursor + " 't' text: find all instances of the text under cursor + " 'e' egrep: egrep search for the word under cursor + " 'f' file: open the filename under cursor + " 'i' includes: find files that include the filename under cursor + " 'd' called: find functions that function under cursor calls + " + " Below are three sets of the maps: one set that just jumps to your + " search result, one that splits the existing vim window horizontally and + " diplays your search result in the new window, and one that does the same + " thing, but does a vertical split instead (vim 6 only). + " + " I've used CTRL-\ and CTRL-@ as the starting keys for these maps, as it's + " unlikely that you need their default mappings (CTRL-\'s default use is + " as part of CTRL-\ CTRL-N typemap, which basically just does the same + " thing as hitting 'escape': CTRL-@ doesn't seem to have any default use). + " If you don't like using 'CTRL-@' or CTRL-\, , you can change some or all + " of these maps to use other keys. One likely candidate is 'CTRL-_' + " (which also maps to CTRL-/, which is easier to type). By default it is + " used to switch between Hebrew and English keyboard mode. + " + " All of the maps involving the macro use '^$': this is so + " that searches over '#include " return only references to + " 'time.h', and not 'sys/time.h', etc. (by default cscope will return all + " files that contain 'time.h' as part of their name). + + + " To do the first type of search, hit 'CTRL-\', followed by one of the + " cscope search types above (s,g,c,t,e,f,i,d). The result of your cscope + " search will be displayed in the current window. You can use CTRL-T to + " go back to where you were before the search. + " + + nmap s :cs find s =expand("") + nmap g :cs find g =expand("") + nmap c :cs find c =expand("") + nmap t :cs find t =expand("") + nmap e :cs find e =expand("") + nmap f :cs find f =expand("") + nmap i :cs find i ^=expand("")$ + nmap d :cs find d =expand("") + + + " Using 'CTRL-spacebar' (intepreted as CTRL-@ by vim) then a search type + " makes the vim window split horizontally, with search result displayed in + " the new window. + " + " (Note: earlier versions of vim may not have the :scs command, but it + " can be simulated roughly via: + " nmap s :cs find s =expand("") + + nmap s :scs find s =expand("") + nmap g :scs find g =expand("") + nmap c :scs find c =expand("") + nmap t :scs find t =expand("") + nmap e :scs find e =expand("") + nmap f :scs find f =expand("") + nmap i :scs find i ^=expand("")$ + nmap d :scs find d =expand("") + + + " Hitting CTRL-space *twice* before the search type does a vertical + " split instead of a horizontal one (vim 6 and up only) + " + " (Note: you may wish to put a 'set splitright' in your .vimrc + " if you prefer the new window on the right instead of the left + + nmap s :vert scs find s =expand("") + nmap g :vert scs find g =expand("") + nmap c :vert scs find c =expand("") + nmap t :vert scs find t =expand("") + nmap e :vert scs find e =expand("") + nmap f :vert scs find f =expand("") + nmap i :vert scs find i ^=expand("")$ + nmap d :vert scs find d =expand("") + + + """"""""""""" key map timeouts + " + " By default Vim will only wait 1 second for each keystroke in a mapping. + " You may find that too short with the above typemaps. If so, you should + " either turn off mapping timeouts via 'notimeout'. + " + "set notimeout + " + " Or, you can keep timeouts, by uncommenting the timeoutlen line below, + " with your own personal favorite value (in milliseconds): + " + "set timeoutlen=4000 + " + " Either way, since mapping timeout settings by default also set the + " timeouts for multicharacter 'keys codes' (like ), you should also + " set ttimeout and ttimeoutlen: otherwise, you will experience strange + " delays as vim waits for a keystroke after you hit ESC (it will be + " waiting to see if the ESC is actually part of a key code like ). + " + "set ttimeout + " + " personally, I find a tenth of a second to work well for key code + " timeouts. If you experience problems and have a slow terminal or network + " connection, set it higher. If you don't set ttimeoutlen, the value for + " timeoutlent (default: 1000 = 1 second, which is sluggish) is used. + " + "set ttimeoutlen=100 + +endif + + diff --git a/.xinitrc b/.xinitrc new file mode 100644 index 0000000..1baa27a --- /dev/null +++ b/.xinitrc @@ -0,0 +1,21 @@ +DEFAULT_SESSION=urxvt + +case $1 in +fvwm-crystal) + exec fvwm-crystal + ;; +fvwm) exec fvwm + ;; +kde) + exec startkde + ;; +xfce4) + exec startxfce4 + ;; +fluxbox) + exec startfluxbox + ;; +*) + exec $DEFAULT_SESSION + ;; +esac diff --git a/.xprofile b/.xprofile new file mode 100644 index 0000000..796b05a --- /dev/null +++ b/.xprofile @@ -0,0 +1 @@ +[[ -f ~/.bashrc ]] && . ~/.bashrc \ No newline at end of file diff --git a/.xscreensaver b/.xscreensaver new file mode 100644 index 0000000..1aaa1a6 --- /dev/null +++ b/.xscreensaver @@ -0,0 +1,257 @@ +# XScreenSaver Preferences File +# Written by xscreensaver-demo 5.15 for kolan on Mon Feb 6 13:30:55 2012. +# http://www.jwz.org/xscreensaver/ + +timeout: 0:05:00 +cycle: 0:01:00 +lock: True +lockTimeout: 0:16:00 +passwdTimeout: 0:00:30 +visualID: default +installColormap: True +verbose: False +timestamp: True +splash: False +splashDuration: 0:00:05 +demoCommand: xscreensaver-demo +prefsCommand: xscreensaver-demo -prefs +nice: 10 +memoryLimit: 0 +fade: True +unfade: False +fadeSeconds: 0:00:03 +fadeTicks: 20 +captureStderr: True +ignoreUninstalledPrograms:False +font: *-medium-r-*-140-*-m-* +dpmsEnabled: True +dpmsQuickOff: True +dpmsStandby: 0:08:00 +dpmsSuspend: 0:08:00 +dpmsOff: 0:08:00 +grabDesktopImages: True +grabVideoFrames: False +chooseRandomImages: True +imageDirectory: /home/kolan/wallpapers + +mode: random +selected: 109 + +textMode: date +textLiteral: XScreenSaver +textFile: /etc/gentoo-release +textProgram: fortune +textURL: http://planet.gentoo.org/rss20.xml + +programs: \ + maze -root \n\ +- GL: superquadrics -root \n\ + attraction -root \n\ +- blitspin -root \n\ + greynetic -root \n\ + helix -root \n\ + hopalong -root \n\ +- imsmap -root \n\ +- noseguy -root \n\ + pyro -root \n\ + qix -root \n\ + rocks -root \n\ + rorschach -root \n\ + decayscreen -root \n\ + flame -root \n\ + halo -root \n\ +- slidescreen -root \n\ + pedal -root \n\ + bouboule -root \n\ +- braid -root \n\ + coral -root \n\ + deco -root \n\ +- drift -root \n\ + fadeplot -root \n\ + galaxy -root \n\ +- goop -root \n\ + grav -root \n\ + ifs -root \n\ +- GL: jigsaw -root \n\ + julia -root \n\ + kaleidescope -root \n\ +- GL: moebius -root \n\ + moire -root \n\ +- GL: morph3d -root \n\ + mountain -root \n\ + munch -root \n\ + penrose -root \n\ + GL: pipes -root \n\ + rd-bomb -root \n\ +- GL: rubik -root \n\ + sierpinski -root \n\ +- slip -root \n\ +- GL: sproingies -root \n\ + starfish -root \n\ + strange -root \n\ + swirl -root \n\ + triangle -root \n\ +- xjack -root \n\ +- xlyap -root \n\ +- GL: atlantis -root \n\ + bsod -root \n\ +- GL: bubble3d -root \n\ +- GL: cage -root \n\ + crystal -root \n\ + cynosure -root \n\ +- discrete -root \n\ +- distort -root \n\ + epicycle -root \n\ +- flow -root \n\ +- GL: glplanet -root \n\ +- interference -root \n\ +- kumppa -root \n\ +- GL: lament -root \n\ + moire2 -root \n\ + GL: sonar -root \n\ +- GL: stairs -root \n\ + truchet -root \n\ +- vidwhacker -root \n\ + blaster -root \n\ +- bumps -root \n\ + ccurve -root \n\ + compass -root \n\ +- deluxe -root \n\ + demon -root \n\ +- GL: extrusion -root \n\ + loop -root \n\ +- penetrate -root \n\ + petri -root \n\ +- phosphor -root \n\ + GL: pulsar -root \n\ +- ripples -root \n\ + shadebobs -root \n\ + GL: sierpinski3d -root \n\ +- spotlight -root \n\ + squiral -root \n\ + wander -root \n\ +- webcollage -root \n\ +- xflame -root \n\ + xmatrix -root \n\ +- GL: gflux -root \n\ + nerverot -root \n\ + xrayswarm -root \n\ + xspirograph -root \n\ +- GL: circuit -root \n\ + GL: dangerball -root \n\ +- GL: dnalogo -root \n\ +- GL: engine -root \n\ +- GL: flipscreen3d -root \n\ +- GL: gltext -root \n\ + GL: menger -root \n\ +- GL: molecule -root \n\ +- rotzoomer -root \n\ +- speedmine -root \n\ + GL: starwars -root \n\ + GL: stonerview -root \n\ + vermiculate -root \n\ +- whirlwindwarp -root \n\ +- zoom -root \n\ + anemone -root \n\ + apollonian -root \n\ +- GL: boxed -root \n\ +- GL: cubenetic -root \n\ +- GL: endgame -root \n\ +- euler2d -root \n\ +- fluidballs -root \n\ +- GL: flurry -root \n\ +- GL: glblur -root \n\ + GL: glsnake -root \n\ +- halftone -root \n\ +- GL: juggler3d -root \n\ +- GL: lavalite -root \n\ + polyominoes -root \n\ +- GL: queens -root \n\ +- GL: sballs -root \n\ +- GL: spheremonics -root \n\ + thornbird -root \n\ +- twang -root \n\ +- GL: antspotlight -root \n\ +- apple2 -root \n\ +- GL: atunnel -root \n\ + barcode -root \n\ +- GL: blinkbox -root \n\ +- GL: blocktube -root \n\ +- GL: bouncingcow -root \n\ + cloudlife -root \n\ + GL: cubestorm -root \n\ +- eruption -root \n\ +- GL: flipflop -root \n\ +- GL: flyingtoasters -root \n\ +- fontglide -root \n\ + GL: gleidescope -root \n\ +- GL: glknots -root \n\ + GL: glmatrix -root \n\ +- GL: glslideshow -root \n\ +- GL: hypertorus -root \n\ +- GL: jigglypuff -root \n\ +- metaballs -root \n\ +- GL: mirrorblob -root \n\ +- piecewise -root \n\ + GL: polytopes -root \n\ +- pong -root \n\ + popsquares -root \n\ + GL: surfaces -root \n\ +- xanalogtv -root \n\ + abstractile -root \n\ + anemotaxis -root \n\ +- GL: antinspect -root \n\ +- fireworkx -root \n\ +- fuzzyflakes -root \n\ +- interaggregate -root \n\ + intermomentary -root \n\ + memscroller -root \n\ +- GL: noof -root \n\ + pacman -root \n\ +- GL: pinion -root \n\ +- GL: polyhedra -root \n\ +- GL: providence -root \n\ + substrate -root \n\ +- wormhole -root \n\ +- GL: antmaze -root \n\ +- GL: boing -root \n\ + boxfit -root \n\ +- GL: carousel -root \n\ + celtic -root \n\ +- GL: crackberg -root \n\ + GL: cube21 -root \n\ +- fiberlamp -root \n\ +- GL: fliptext -root \n\ +- GL: glhanoi -root \n\ + GL: tangram -root \n\ +- GL: timetunnel -root \n\ +- GL: glschool -root \n\ +- GL: topblock -root \n\ + GL: cubicgrid -root \n\ + cwaves -root \n\ +- GL: gears -root \n\ + GL: glcells -root \n\ + GL: lockward -root \n\ +- m6502 -root \n\ +- GL: moebiusgears -root \n\ + GL: voronoi -root \n\ +- GL: hypnowheel -root \n\ +- GL: klein -root \n\ + lcdscrub -root \n\ +- GL: photopile -root \n\ +- GL: skytentacles -root \n\ +- GL: rubikblocks -root \n\ +- GL: companioncube -root \n\ +- GL: hilbert -root \n\ + GL: tronbit -root \n\ + + +pointerPollTime: 0:00:05 +pointerHysteresis: 10 +windowCreationTimeout:0:00:30 +initialDelay: 0:00:00 +GetViewPortIsFullOfLies:False +procInterrupts: True +xinputExtensionDev: False +overlayStderr: True +