Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fzf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
fzf
Commits
669a6fee
Commit
669a6fee
authored
7 years ago
by
Jan Edmund Lazo
Committed by
Junegunn Choi
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[vim] Use utf-8 for cmd.exe (#929)
parent
8aab0fc1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugin/fzf.vim
+14
-2
14 additions, 2 deletions
plugin/fzf.vim
with
14 additions
and
2 deletions
plugin/fzf.vim
+
14
−
2
View file @
669a6fee
...
...
@@ -44,10 +44,22 @@ if s:is_win
let
&
shellslash
=
shellslash
endtry
endfunction
" Use utf-8 for fzf.vim commands
" Return array of shell commands for cmd.exe
function
!
s:wrap_cmds
(
cmds
)
return
[
'@echo off'
,
'for /f "tokens=4" %%a in (''chcp'') do set origchcp=%%a'
,
'chcp 65001 > nul'
]
+
\
(
type
(
a:cmds
)
==
type
([])
?
a:cmds
:
[
a:cmds
])
+
\
[
'chcp %origchcp% > nul'
]
endfunction
else
function
!
s:fzf_call
(
fn
,
...)
return
call
(
a:fn
,
a:000
)
endfunction
function
!
s:wrap_cmds
(
cmds
)
return
a:cmds
endfunction
endif
function
!
s:shellesc_cmd
(
arg
)
...
...
@@ -352,7 +364,7 @@ try
if
!
has_key
(
dict
,
'source'
)
&&
!
empty
(
$FZF_DEFAULT_COMMAND
)
let
temps
.
source
=
s:fzf_tempname
().(
s:is_win
?
'.bat'
:
''
)
call
writefile
(
(
s:
is_win
?
[
'@echo off'
]
:
[])
+
split
(
$FZF_DEFAULT_COMMAND
,
"\n"
),
temps
.
source
)
call
writefile
(
s:
wrap_cmds
(
split
(
$FZF_DEFAULT_COMMAND
,
"\n"
)
)
,
temps
.
source
)
let
dict
.
source
=
(
empty
(
$SHELL
)
? &
shell
:
$SHELL
)
.
(
s:is_win
?
' /c '
:
' '
)
.
fzf#
shellescape
(
temps
.
source
)
endif
...
...
@@ -510,7 +522,7 @@ function! s:execute(dict, command, use_height, temps) abort
endif
if
s:is_win
let
batchfile
=
s:fzf_tempname
().
'.bat'
call
writefile
(
[
'@echo off'
,
command
]
,
batchfile
)
call
writefile
(
s:wrap_cmds
(
command
)
,
batchfile
)
let
command
=
batchfile
if
has
(
'nvim'
)
let
s:dict
=
a:dict
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment