Mercurial > vim
comparison src/ex_docmd.c @ 29853:31c598083364 v9.0.0265
patch 9.0.0265: no good reason why the "gf" command isn't in the tiny version
Commit: https://github.com/vim/vim/commit/f80f40a55ccff0a4331c5fbd1ac446511f622ed0
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Aug 25 16:02:23 2022 +0100
patch 9.0.0265: no good reason why the "gf" command isn't in the tiny version
Problem: No good reason why the "gf" command is not in the tiny version.
Solution: Graduate the file_in_path feature.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 25 Aug 2022 17:15:03 +0200 |
parents | 6c7eddcce52c |
children | 935717599faa |
comparison
equal
deleted
inserted
replaced
29852:8568b72caa9a | 29853:31c598083364 |
---|---|
6676 */ | 6676 */ |
6677 void | 6677 void |
6678 ex_splitview(exarg_T *eap) | 6678 ex_splitview(exarg_T *eap) |
6679 { | 6679 { |
6680 win_T *old_curwin = curwin; | 6680 win_T *old_curwin = curwin; |
6681 #if defined(FEAT_SEARCHPATH) || defined(FEAT_BROWSE) | |
6682 char_u *fname = NULL; | 6681 char_u *fname = NULL; |
6683 #endif | |
6684 #ifdef FEAT_BROWSE | 6682 #ifdef FEAT_BROWSE |
6685 char_u dot_path[] = "."; | 6683 char_u dot_path[] = "."; |
6686 int save_cmod_flags = cmdmod.cmod_flags; | 6684 int save_cmod_flags = cmdmod.cmod_flags; |
6687 #endif | 6685 #endif |
6688 int use_tab = eap->cmdidx == CMD_tabedit | 6686 int use_tab = eap->cmdidx == CMD_tabedit |
6706 if (eap->cmdidx == CMD_vsplit) | 6704 if (eap->cmdidx == CMD_vsplit) |
6707 eap->cmdidx = CMD_vnew; | 6705 eap->cmdidx = CMD_vnew; |
6708 } | 6706 } |
6709 #endif | 6707 #endif |
6710 | 6708 |
6711 #ifdef FEAT_SEARCHPATH | |
6712 if (eap->cmdidx == CMD_sfind || eap->cmdidx == CMD_tabfind) | 6709 if (eap->cmdidx == CMD_sfind || eap->cmdidx == CMD_tabfind) |
6713 { | 6710 { |
6714 fname = find_file_in_path(eap->arg, (int)STRLEN(eap->arg), | 6711 fname = find_file_in_path(eap->arg, (int)STRLEN(eap->arg), |
6715 FNAME_MESS, TRUE, curbuf->b_ffname); | 6712 FNAME_MESS, TRUE, curbuf->b_ffname); |
6716 if (fname == NULL) | 6713 if (fname == NULL) |
6717 goto theend; | 6714 goto theend; |
6718 eap->arg = fname; | 6715 eap->arg = fname; |
6719 } | 6716 } |
6720 # ifdef FEAT_BROWSE | 6717 # ifdef FEAT_BROWSE |
6721 else | 6718 else if ((cmdmod.cmod_flags & CMOD_BROWSE) |
6722 # endif | |
6723 #endif | |
6724 #ifdef FEAT_BROWSE | |
6725 if ((cmdmod.cmod_flags & CMOD_BROWSE) | |
6726 && eap->cmdidx != CMD_vnew | 6719 && eap->cmdidx != CMD_vnew |
6727 && eap->cmdidx != CMD_new) | 6720 && eap->cmdidx != CMD_new) |
6728 { | 6721 { |
6729 if ( | 6722 if ( |
6730 # ifdef FEAT_GUI | 6723 # ifdef FEAT_GUI |
6784 | 6777 |
6785 # ifdef FEAT_BROWSE | 6778 # ifdef FEAT_BROWSE |
6786 cmdmod.cmod_flags = save_cmod_flags; | 6779 cmdmod.cmod_flags = save_cmod_flags; |
6787 # endif | 6780 # endif |
6788 | 6781 |
6789 # if defined(FEAT_SEARCHPATH) || defined(FEAT_BROWSE) | |
6790 theend: | 6782 theend: |
6791 vim_free(fname); | 6783 vim_free(fname); |
6792 # endif | |
6793 } | 6784 } |
6794 | 6785 |
6795 /* | 6786 /* |
6796 * Open a new tab page. | 6787 * Open a new tab page. |
6797 */ | 6788 */ |
6978 * ":find [+command] <file>" command. | 6969 * ":find [+command] <file>" command. |
6979 */ | 6970 */ |
6980 static void | 6971 static void |
6981 ex_find(exarg_T *eap) | 6972 ex_find(exarg_T *eap) |
6982 { | 6973 { |
6983 #ifdef FEAT_SEARCHPATH | |
6984 char_u *fname; | 6974 char_u *fname; |
6985 int count; | 6975 int count; |
6986 | 6976 |
6987 fname = find_file_in_path(eap->arg, (int)STRLEN(eap->arg), FNAME_MESS, | 6977 fname = find_file_in_path(eap->arg, (int)STRLEN(eap->arg), FNAME_MESS, |
6988 TRUE, curbuf->b_ffname); | 6978 TRUE, curbuf->b_ffname); |
7000 } | 6990 } |
7001 | 6991 |
7002 if (fname != NULL) | 6992 if (fname != NULL) |
7003 { | 6993 { |
7004 eap->arg = fname; | 6994 eap->arg = fname; |
7005 #endif | |
7006 do_exedit(eap, NULL); | 6995 do_exedit(eap, NULL); |
7007 #ifdef FEAT_SEARCHPATH | |
7008 vim_free(fname); | 6996 vim_free(fname); |
7009 } | 6997 } |
7010 #endif | |
7011 } | 6998 } |
7012 | 6999 |
7013 /* | 7000 /* |
7014 * ":open" simulation: for now just work like ":visual". | 7001 * ":open" simulation: for now just work like ":visual". |
7015 */ | 7002 */ |
9271 tilde_file = STRCMP(result, "~") == 0; | 9258 tilde_file = STRCMP(result, "~") == 0; |
9272 } | 9259 } |
9273 } | 9260 } |
9274 break; | 9261 break; |
9275 | 9262 |
9276 #ifdef FEAT_SEARCHPATH | |
9277 case SPEC_CFILE: // file name under cursor | 9263 case SPEC_CFILE: // file name under cursor |
9278 result = file_name_at_cursor(FNAME_MESS|FNAME_HYP, 1L, NULL); | 9264 result = file_name_at_cursor(FNAME_MESS|FNAME_HYP, 1L, NULL); |
9279 if (result == NULL) | 9265 if (result == NULL) |
9280 { | 9266 { |
9281 *errormsg = ""; | 9267 *errormsg = ""; |
9282 return NULL; | 9268 return NULL; |
9283 } | 9269 } |
9284 resultbuf = result; // remember allocated string | 9270 resultbuf = result; // remember allocated string |
9285 break; | 9271 break; |
9286 #endif | |
9287 | 9272 |
9288 case SPEC_AFILE: // file name for autocommand | 9273 case SPEC_AFILE: // file name for autocommand |
9289 result = autocmd_fname; | 9274 result = autocmd_fname; |
9290 if (result != NULL && !autocmd_fname_full) | 9275 if (result != NULL && !autocmd_fname_full) |
9291 { | 9276 { |