I have delimitMate installed for brace completion in Vim but it is running for all files, not just .h and .cpp files. DelimitMate has an option for disabling itself in the buffer so I need to add something to my .vimrc that says "disable delimitMate in the buffer of all files except for .h and .cpp files" though I have no idea how to do that.
Enabling certain plugins and options for .h and .cpp files only in Vim
544 views Asked by Brady Dean At
2
There are 2 answers
0
EvergreenTree
On
I think what you are looking for is autocommands. Autocommands can run pieces of vimscript whenever a certain event happens. You can see a list of all possible events by doing :help autocmd-events
So according to your needs, first you should disable delimitMate in your vimrc. Then, you can put something like this in your vimrc (after you disable delimitMate):
autocmd FileType cpp (insert command to disable delimitMate here)
That way, vim will disable delimitMate by default, but it will enable it if the fieltype is cpp. (this includes header files)
Of course, more information is available on the autocmd command by doing :help :autocmd
Related Questions in C++
- How to immediately apply DISPLAYCONFIG_SCALING display scaling mode with SetDisplayConfig and DISPLAYCONFIG_PATH_TARGET_INFO
- Why can't I use templates members in its specialization?
- How to fix "Access violation executing location" when using GLFW and GLAD
- Dynamic array of structures in C++/ cannot fill a dynamic array of doubles in structure from dynamic array of structures
- How do I apply the interface concept with the base-class in design?
- File refuses to compile std::erase() even if using -std=g++23
- How can I do a successful map when the number of elements to be mapped is not consistent in Thrust C++
- Can std::bit_cast be applied to an empty object?
- Unexpected inter-thread happens-before relationships from relaxed memory ordering
- How i can move element of dynamic vector in argument of function push_back for dynamic vector
- Brick Breaker Ball Bounce
- Thread-safe lock-free min where both operands can change c++
- Watchdog Timer Reset on ESP32 using Webservers
- How to solve compiler error: no matching function for call to 'dmhFS::dmhFS()' in my case?
- Conda CMAKE CXX Compiler error while compiling Pytorch
Related Questions in VIM
- vim python omnifunc not working some modules
- Alias does not take effect when I use Vim to execute external commands
- Executing just multiple python lines in VIM
- Is there a Vim-eqsue way to sequentially copy numbers?
- How do I run a Python program in the Vim editor without closing it?
- Vim 8 - How do I re-number my list after reordering the list - manually or automatically?
- vim: indent next line more than the current
- Unicode character ſ is matched as itself and as 's.'
- Nvim with prose: how to set up proper `autoformat` line-wrapping
- Syntax highlighting of nested braces in vim
- Is there a way to flip the bit under your cursor in (n)vim?
- Vimscript function for replacing the visually selected buffer in nvim
- no console after using :wq in vim
- Convert entire (Python) file from 2-space indent to 4-space indent
- Prepend text to a different file from within Vim
Related Questions in AUTOCOMPLETE
- OS-wide text autocomplete service with popup
- Autocomplete not working for apache spark in java vscode
- How to enable Kotlin REPL autocomplete
- How to bold matched letters when typing in search box using javascript?
- VSC Autocomplete imported styles for JSX files
- Autocomplete does not work correctly in WebStorm (TypeScript)
- Typahead Search - why is my React State one step behind?
- Auto-complete doesn't work on Chrome or Edge
- chakra ui custom theme doesnt give autocomplete for custom varients
- How to combine ontotext GraphDB autocomplete and SPARQL to refine searching?
- Autocomplete search filter not working for dynamically added input fields in angular
- Trying to display autocomplete results - ASP.NET Core MVC
- How do i disable Node's/npm Intellisense on VSCode for certain workspaces?
- Type 'ReactI18NextChildren | Iterable<ReactI18NextChildren>' is not assignable to type 'ReactNode'
- Mobile autocomplete submitting form without clicking sign in button
Related Questions in FILE-TYPE
- How to use file-type in Vue 3?
- Wordpress enable php filedownload for users
- nodejs 'file-type' and 'mime': require() of ES Module is not supported; change index.js to a dynamic import() which is available in CommonJS modules
- Micro services with Minio implementation
- How to automatically set Brotli encoding in Azure Blob storage?
- R proFIA "No MS1 data found in file" error using MSConvert-ed files
- MS-DOS D-Fend Reloaded file encoding "application/octet-stream; charset=binary" to ASCII in ubuntu
- Assign filetype to a software by script
- How can I upload .rvt (revit) files to Wordpress?
- .eml files not getting uploaded while sending it from email to databse
- How To Get Only Certain Object Types Back From Git LS-Files
- linux shell CLI file get mime-type from a string variable
- How do I solve the "is not a path to a .klc file" error in Windows PowerShell when running a klc to tfl file converter script?
- macOS document based app - save all documents as one
- What are the .rxxxxk .rxxxxl file extensions?
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Reading the DelimitMate documentation at
:h 'b:delimitMate_autoclose'. Add the following to your~/.vimrc:The idea is to turn off autoclose globally (
g:) and turn it back on for specific buffers (b:).Instead of the
:autocmdand:augroupcommands you can setb:loaded_delimitMateinside the appropriate ftplugin file. Example add the following to~/.vim/after/ftplugin/cpp.vim:This method might be prefered if you want to keep your
~/.vimrcfile clean or you already have many filetype specific commands, settings, or mappings.Note: I do not use DelimitMate so I have not tested any of these settings.
For more help see: