diff options
| -rw-r--r-- | .config/nvim/init.lua | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 1ed9117..7ac24e8 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -352,8 +352,6 @@ paq({ -- Python: autopep8 'tell-k/vim-autopep8', -- QoL {{{2 - -- If a directory is missing, make it automatically. - 'mopp/autodirmake.vim', -- Capture the output of a command. 'tyru/capture.vim', -- Write git commit message. @@ -410,6 +408,22 @@ vimrc.autocmd('BufRead', '*', function() end) +-- Port this to Lua: https://github.com/mopp/autodirmake.vim +-- License: NYSL +vimrc.autocmd('BufWritePre', '*', function() + local dir = F.expand('<afile>:p:h') + if F.isdirectory(dir) ~= 0 then + return + end + vimrc.echo(('"%s" does not exist. Create? [y/N] '):format(dir), 'Question') + local answer = vimrc.getchar() + if answer ~= 'y' and answer ~= 'Y' then + return + end + F.mkdir(dir, 'p') +end) + + vimrc.register_filetype_autocmds_for_indentation() @@ -1301,12 +1315,6 @@ xmap <expr> g# My_asterisk('<Plug>(asterisk-gz*)', 1) --- autodirmake {{{2 - -G['autodirmake#msg_highlight'] = 'Question' - - - -- autopep8 {{{2 G.autopep8_on_save = true |
