9/16/2023 0 Comments Elixir vimr![]() Set tabstop = 2 set softtabstop = 2 set shiftwidth = 2 set textwidth = 80 set expandtab set autoindent set fileformat =unixĮndfunction au BufNewFile, BufRead *.ex,*.exs,*.eex call LoadElixirSettings() I actually end up writing custom viml functions for overriding configuration, which might be set elsewhere.Īs an example, I've included a minimal copy of my elixir.vim file below: Language configuration is likewise simple but a little different. They're literally just plain viml that is sourced by my top-level init.vim or. Since the plugins can be set to be lazily loaded, I don't bother with any further tinkering with these files. autocmd BufEnter * if bufname( '# ') =~# "^NERD_tree_ " & winnr( '$ ') > 1 | b# | endif " Selecting a file closes NERDTREE let g:NERDTreeQuitOnOpen = 1 " Style let NERDTreeMinimalUI = 1 let NERDTreeDirArrows = 1 isTabTree()) | q | endif " Show hidden files by default let NERDTreeShowHidden = 1 " If more than one window and previous buffer was NERDTree, go back to it. " NERDTREE toggle (normal mode) nnoremap :NERDTreeToggle " Close VIM if NERDTREE is only thing open autocmd bufenter * if ( winnr( "$ ") = 1 & exists( "b:NERDTree ") & b:NERDTree. One thing I'm abusing is the idea of automatically sourcing files from elsewhere, essentially breaking out my logically separated comments into real, logical modules. The cool thing is that viml is a Turing complete programming language, able to do pretty much anything a normal programming language can do. Since all my related commands were already in logical blocks, I further broke them out into their own files so that I wouldn't need to have the informational overhead in my brain whenever I wanted to change a trivial setting. Now that everything is super well organised, I did a second refactoring pass over my configuration. The only requirement to use vim-plug is to install it as per its installation instructions, followed by adding the following block to the top of your Vim configuration:Ĭall plug#begin( 'MY_CONFIG_PATH/bundle ') Some of the reasons I use vim-plug include features such as the minimal amount of boilerplate needed to get plugins working, as well as hooks for lazy loading: we'll get to this later. I personally use vim-plug for managing my Vim plugins. ![]() ![]() After doing this, my Vim configuration was actually larger, but at least it was easier to read □ Dealing with Plugins These "modules" would be blocks of configuration concerning both related settings and configuration for certain plugins. This let me tell at a glance what essential "modules" I was dealing with. " Cache undos in a file, disable other backup settings set noswapfile set nobackup set undofile " Better searching functionality set showmatch set incsearch set hlsearch set ignorecase set smartcase " Search related settings set showmatch set incsearch set hlsearch set ignorecase set smartcase tabbing: tabstop, softtabstop, expandtab) into contiguous blocks like the following: I started this by moving all the configuration related to specific ideas (i.e. The first thing I did when breaking apart my 2000 line configuration file was to untangle the organisational mess I've made. When ranting to a colleague of mine about my configuration woes, he showed me his, and I was struck by inspiration □ A means of micromanaging- architecting-Vim configuration to make it saner, compositional, and more optimal too.Ī few key ideas I've used in my configuration are outlined below: hopefully, they'll help anyone else also looking to tame their Vim configuration. During my refactor of my configuration, one key goal was also to clean this up. Organisation was a huge mess: related commands strewn around all over the place due to years of ad-hoc editing. My configuration file was also around 2000 lines in length. I took this as an opportunity to remove all the old cruft and start my configuration file again from scratch, taking only what I absolutely needed. Recently, when trying to figure out why certain things weren't working the way I expected, I realised that there was much in my config I either didn't need or just blatantly did not understand. It is something that has organically grown as my editing habits and needs change over time. As a long-time Vim user, I've put a lot of time into my Vim configuration over the years.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |