Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.clang-format or _clang-format not found in ancestry #256

Open
pinpox opened this issue Oct 30, 2018 · 3 comments
Open

.clang-format or _clang-format not found in ancestry #256

pinpox opened this issue Oct 30, 2018 · 3 comments

Comments

@pinpox
Copy link

pinpox commented Oct 30, 2018

Hi,
I use Neovim on linux arch. Everything up-to-date.
When I run :Autoformat my .clang-format is only detected if it is in the same directory as the c file.
If it is in a parent directory (like my /home) it is not recognized.

Do I have to set something to make it read it or is this a bug?

@chtenb
Copy link
Member

chtenb commented Oct 30, 2018

The logic used can be found here: https://github.com/Chiel92/vim-autoformat/blob/db17ccbacb55beea82fdaa9a1cde82f6a928d16d/plugin/defaults.vim#L80-L89

Perhaps there are mounted volumes or symlinks involved? There are outstanding issues for that
#169
#127

@hungpham3112
Copy link

hungpham3112 commented Jul 30, 2021

Any ways to put 1 .clang-format file in any folder and use in many project as we expect ?
i mean put _clang-format in ~/.vim or in $HOME but still use format for C-project
We don't have to put .clang-format in any project because it seems repeat and tedious
We so appreciate if vim-autoformat have this feature, It make UX better and easy for use. Thanks

@kkzi
Copy link

kkzi commented Apr 12, 2023

Any ways to put 1 .clang-format file in any folder and use in many project as we expect ? i mean put _clang-format in ~/.vim or in $HOME but still use format for C-project We don't have to put .clang-format in any project because it seems repeat and tedious We so appreciate if vim-autoformat have this feature, It make UX better and easy for use. Thanks

You can try this in vimrc file

let g:formatdef_clangformat = "'clang-format -lines='.a:firstline.':'.a:lastline.' --assume-filename=\"'.expand('%:p').'\" --style=file:/path_to_file/.clang-format'" 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants