{"id":211,"date":"2021-01-28T11:37:44","date_gmt":"2021-01-28T02:37:44","guid":{"rendered":"https:\/\/derrylab.com\/?p=211"},"modified":"2021-01-28T11:37:44","modified_gmt":"2021-01-28T02:37:44","slug":"my-quick-ways-to-auto-format-code-in-vscode","status":"publish","type":"post","link":"https:\/\/blog.derrylab.com\/index.php\/2021\/01\/28\/my-quick-ways-to-auto-format-code-in-vscode\/","title":{"rendered":"My Quick Ways to Auto Format Code in VSCode"},"content":{"rendered":"\n<p>I don&#8217;t have much time to format my code to looks neat in VSCode (<code>Ctrl + Shift + I<\/code>), but the default formatting from Visual Code is not efficient for me. It makes the first bracket on function placed alone in one line. This makes my code longer!<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>If you&#8217;re used to using jump\/goto line number it may not a problem. But for me, I need to take a screenshot of my codes for my report and this bracket is eating up the screenshot space. I tried googling around and finally found that this formatting can be changed.<\/p>\n\n\n\n<p>Press <code>ctrl + comma<\/code> to open settings. Then search for &#8220;<code>fallback<\/code>&#8220;, you will find <code>C_Cpp.clang_format_fallbackStyle<\/code> like the picture below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"878\" height=\"443\" src=\"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2021\/01\/image.png?resize=878%2C443&#038;ssl=1\" alt=\"\" class=\"wp-image-216\" srcset=\"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2021\/01\/image.png?w=878&amp;ssl=1 878w, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2021\/01\/image.png?resize=300%2C151&amp;ssl=1 300w, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2021\/01\/image.png?resize=768%2C387&amp;ssl=1 768w\" sizes=\"auto, (max-width: 878px) 100vw, 878px\" \/><figcaption>Visual Studio Formatting Settings<\/figcaption><\/figure>\n\n\n\n<p>Change it from <code>\"Visual Studio\"<\/code> to <code>{ BasedOnStyle: Google, IndentWidth: 4 }<\/code><\/p>\n\n\n\n<p>You can also add the <code>ColumnLimit<\/code> option to prevent your code break to the next line because of the Google-style column limit. For example:<br><code>{ BasedOnStyle: Google, IndentWidth: 4, ColumnLimit: 0 }<\/code><\/p>\n\n\n\n<p>So now, each time you have done so many edits in your code and you need to auto-format it, just press <code>Ctrl + Shift + I<\/code> to make it neat! \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I don&#8217;t have much time to format my code to looks neat in VSCode (Ctrl + Shift + I), but the default formatting from Visual Code is not efficient for me. It makes the first bracket on function placed alone in one line. This makes my code longer!<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4,5],"tags":[90,93,91,36,89,94,64,88,70],"class_list":["post-211","post","type-post","status-publish","format-standard","hentry","category-linux","category-programming","tag-auto-format","tag-coding-style","tag-google","tag-linux","tag-settings","tag-tips","tag-tutorial","tag-visual-studio-code","tag-vscode"],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":40,"url":"https:\/\/blog.derrylab.com\/index.php\/2020\/04\/01\/how-to-view-pointer-as-array-in-visual-studio-code\/","url_meta":{"origin":211,"position":0},"title":"How to View Pointer as Array in Visual Studio Code","author":"derry","date":"April 1, 2020","format":false,"excerpt":"It is irritating when you have to write and memorize this syntax in the middle of debugging, but let me just put it in here for future use: *mypointer@10 Replace mypointer with your pointer name, and replace 10 with how much array you want to view. The ,h at the\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/blog.derrylab.com\/index.php\/category\/programming\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2242,"url":"https:\/\/blog.derrylab.com\/index.php\/2022\/10\/18\/how-to-do-buffer-overflow-attack-on-64bit-machine\/","url_meta":{"origin":211,"position":1},"title":"How to Do Buffer Overflow Attack on 64bit Machine","author":"derry","date":"October 18, 2022","format":false,"excerpt":"Professor's course material was out of date. He made an example of a buffer overflow attack several years ago. Then here I am, asked to fix the code to work on a modern machine, 64bit Kali Linux. There should be no difference with other Linux; you can practice this on\u2026","rel":"","context":"In &quot;linux&quot;","block_context":{"text":"linux","link":"https:\/\/blog.derrylab.com\/index.php\/category\/linux\/"},"img":{"alt_text":"giant tsunami wave","src":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/10\/pexels-photo-9156792.jpeg?fit=1200%2C737&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/10\/pexels-photo-9156792.jpeg?fit=1200%2C737&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/10\/pexels-photo-9156792.jpeg?fit=1200%2C737&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/10\/pexels-photo-9156792.jpeg?fit=1200%2C737&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/10\/pexels-photo-9156792.jpeg?fit=1200%2C737&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":4135,"url":"https:\/\/blog.derrylab.com\/index.php\/2024\/12\/09\/how-to-understand-javascript-basics-in-10-minutes\/","url_meta":{"origin":211,"position":2},"title":"How to Understand JavaScript Basics in 10 Minutes","author":"derry","date":"December 9, 2024","format":false,"excerpt":"This is the basics of JavaScript, the secret sauce that makes your web pages more interactive. We're going to cover the key topics so you won't end up in a coding coma\u2014because who has the time for an exhausting lecture when there's so much internet to explore? 1. What is\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/blog.derrylab.com\/index.php\/category\/programming\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2024\/12\/create-a-detailed-and-high-resolution-image-focusing-on-the-main.png?fit=1024%2C768&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2024\/12\/create-a-detailed-and-high-resolution-image-focusing-on-the-main.png?fit=1024%2C768&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2024\/12\/create-a-detailed-and-high-resolution-image-focusing-on-the-main.png?fit=1024%2C768&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2024\/12\/create-a-detailed-and-high-resolution-image-focusing-on-the-main.png?fit=1024%2C768&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":2780,"url":"https:\/\/blog.derrylab.com\/index.php\/2023\/04\/25\/how-to-replace-string-in-files-without-text-editor-in-linux\/","url_meta":{"origin":211,"position":3},"title":"How to Replace String in Files without Text Editor in Linux","author":"derry","date":"April 25, 2023","format":false,"excerpt":"As a Linux user, it's important to know how to modify text files through the command line. One common scenario is changing a single line in a text file, such as enabling or disabling a feature. But what if the OS doesn't have any text editor installed at all? In\u2026","rel":"","context":"In &quot;linux&quot;","block_context":{"text":"linux","link":"https:\/\/blog.derrylab.com\/index.php\/category\/linux\/"},"img":{"alt_text":"pencil shavings","src":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2023\/04\/pexels-photo-1237647.jpeg?fit=1200%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2023\/04\/pexels-photo-1237647.jpeg?fit=1200%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2023\/04\/pexels-photo-1237647.jpeg?fit=1200%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2023\/04\/pexels-photo-1237647.jpeg?fit=1200%2C800&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2023\/04\/pexels-photo-1237647.jpeg?fit=1200%2C800&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":1282,"url":"https:\/\/blog.derrylab.com\/index.php\/2022\/08\/01\/problem-when-building-old-openssl-version-on-the-new-system\/","url_meta":{"origin":211,"position":4},"title":"Problem When Building Old OpenSSL Version on The New System","author":"derry","date":"August 1, 2022","format":false,"excerpt":"The old OpenSSL seems to have a problem when built using a newer system. I got this problem when compiling OpenSSL 1.1.0f on my Ubuntu 22.04. derry@G14:~\/openssl-1.1.0f$ .\/config -d shared no-asm no-hw Operating system: x86_64-whatever-linux2 \"glob\" is not exported by the File::Glob module Can't continue after import errors at .\/Configure\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/blog.derrylab.com\/index.php\/category\/programming\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/08\/pexels-anamul-rezwan-1145434-scaled.jpg?fit=1200%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/08\/pexels-anamul-rezwan-1145434-scaled.jpg?fit=1200%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/08\/pexels-anamul-rezwan-1145434-scaled.jpg?fit=1200%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/08\/pexels-anamul-rezwan-1145434-scaled.jpg?fit=1200%2C800&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2022\/08\/pexels-anamul-rezwan-1145434-scaled.jpg?fit=1200%2C800&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":4090,"url":"https:\/\/blog.derrylab.com\/index.php\/2024\/11\/22\/how-to-easily-deploy-pixtral-large-using-docker-vllm-for-self-hosting-with-one-liner-command\/","url_meta":{"origin":211,"position":5},"title":"How To Easily Deploy Pixtral Large Using Docker VLLM For Self Hosting With One Liner Command","author":"derry","date":"November 22, 2024","format":false,"excerpt":"Recently, Mistral has released a powerful multimodal model with 123B parameters. In this blog post, we will first understand what Pixtral is. Then, we will quickly get into the process of deploying Pixtral Large using VLLM. Understanding Pixtral Pixtral is an innovative AI model designed to handle complex tasks with\u2026","rel":"","context":"In &quot;Artificial Intelligence&quot;","block_context":{"text":"Artificial Intelligence","link":"https:\/\/blog.derrylab.com\/index.php\/category\/artificial-intelligence\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2024\/11\/image.png?fit=1024%2C768&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2024\/11\/image.png?fit=1024%2C768&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2024\/11\/image.png?fit=1024%2C768&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/blog.derrylab.com\/wp-content\/uploads\/2024\/11\/image.png?fit=1024%2C768&ssl=1&resize=700%2C400 2x"},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/posts\/211","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/comments?post=211"}],"version-history":[{"count":5,"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/posts\/211\/revisions"}],"predecessor-version":[{"id":218,"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/posts\/211\/revisions\/218"}],"wp:attachment":[{"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/media?parent=211"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/categories?post=211"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.derrylab.com\/index.php\/wp-json\/wp\/v2\/tags?post=211"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}