Skip to content

Commit

Permalink
make temporary file in current directory for relative including
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed Jan 20, 2014
1 parent b335f54 commit 93ec73e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions autoload/textobj/clang.vim
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
function! s:prepare_temp_file()
let temp_name = expand('%:p:h') . substitute(tempname(), '\W', '_', 'g') . '.cpp'
let temp_name = tempname() . (&filetype ==# 'c' ? '.c' : '.cpp')

if g:textobj_clang_include_headers
let temp_name = expand('%:p:h') . substitute(tempname(), '\W', '_', 'g') . (&filetype ==# 'c' ? '.c' : '.cpp')
call writefile(getline(1, '$'), temp_name)
else
let temp_name = tempname() . (&filetype ==# 'c' ? '.c' : '.cpp')
call writefile(map(getline(1, '$'), 'v:val =~# "^\\s*#include\\s*\\(<[^>]\\+>\\|\"[^\"]\\+\"\\)" ? "" : v:val'), temp_name)
endif

Expand Down

0 comments on commit 93ec73e

Please sign in to comment.