Mercurial > dotfiles
comparison .chezmoitemplates/init.lua @ 613:c79b392e7919
Use indexed vim.cmd
author | zegervdv <zegervdv@me.com> |
---|---|
date | Mon, 25 Jul 2022 13:56:58 +0200 |
parents | f6e88e1bfe13 |
children | ad5e870cd4b2 |
comparison
equal
deleted
inserted
replaced
612:f6e88e1bfe13 | 613:c79b392e7919 |
---|---|
14 if fn.empty(fn.glob(install_path)) > 0 then | 14 if fn.empty(fn.glob(install_path)) > 0 then |
15 execute('!git clone https://github.com/wbthomason/packer.nvim ' .. install_path) | 15 execute('!git clone https://github.com/wbthomason/packer.nvim ' .. install_path) |
16 end | 16 end |
17 | 17 |
18 -- Packer configuration is compiled and only needs to be loaded on changes | 18 -- Packer configuration is compiled and only needs to be loaded on changes |
19 vim.cmd 'packadd packer.nvim' | 19 vim.cmd.packadd 'packer.nvim' |
20 | 20 |
21 require('packer').startup(function() | 21 require('packer').startup(function() |
22 use { 'wbthomason/packer.nvim', opt = true } | 22 use { 'wbthomason/packer.nvim', opt = true } |
23 | 23 |
24 -- General plugins | 24 -- General plugins |
510 }, | 510 }, |
511 hl = { fg = 'diag_warn' }, | 511 hl = { fg = 'diag_warn' }, |
512 on_click = { | 512 on_click = { |
513 callback = function() | 513 callback = function() |
514 vim.diagnostic.setqflist { severity = vim.diagnostic.severity.WARN } | 514 vim.diagnostic.setqflist { severity = vim.diagnostic.severity.WARN } |
515 vim.cmd [[ botright copen ]] | 515 vim.cmd.copen { mods = { split = 'botright' } } |
516 end, | 516 end, |
517 name = 'heirline_diagnostics', | 517 name = 'heirline_diagnostics', |
518 }, | 518 }, |
519 } | 519 } |
520 | 520 |
602 } | 602 } |
603 end, | 603 end, |
604 } | 604 } |
605 end) | 605 end) |
606 | 606 |
607 vim.cmd [[ packadd dirbuf.nvim ]] | 607 vim.cmd.packadd 'dirbuf.nvim' |
608 | 608 |
609 -- Configuration | 609 -- Configuration |
610 local opt = vim.opt | 610 local opt = vim.opt |
611 | 611 |
612 opt.backspace = { 'indent', 'eol', 'start' } -- Backspace everything | 612 opt.backspace = { 'indent', 'eol', 'start' } -- Backspace everything |
804 map('n', "'", '`') | 804 map('n', "'", '`') |
805 | 805 |
806 -- Do not move on * | 806 -- Do not move on * |
807 map('n', '*', function() | 807 map('n', '*', function() |
808 local view = vim.fn.winsaveview() | 808 local view = vim.fn.winsaveview() |
809 vim.cmd [[ normal! * ]] | 809 vim.cmd.normal { '*', bang = true } |
810 vim.fn.winrestview(view) | 810 vim.fn.winrestview(view) |
811 end, { | 811 end, { |
812 silent = true, | 812 silent = true, |
813 desc = 'Search word under cursor without moving to first results', | 813 desc = 'Search word under cursor without moving to first results', |
814 }) | 814 }) |
837 }, | 837 }, |
838 }) | 838 }) |
839 | 839 |
840 -- Save files on focus lost | 840 -- Save files on focus lost |
841 au.FocusLost = function() | 841 au.FocusLost = function() |
842 if not vim.o.readonly and vim.api.nvim_buf_get_name(0) ~= '' then vim.cmd [[ wa ]] end | 842 if not vim.o.readonly and vim.api.nvim_buf_get_name(0) ~= '' then vim.cmd.wa() end |
843 end | 843 end |
844 | 844 |
845 -- Equalize splits after resizing | 845 -- Equalize splits after resizing |
846 au.VimResized = [[ exe "normal! \<c-w>=" ]] | 846 au.VimResized = [[ exe "normal! \<c-w>=" ]] |
847 | 847 |
848 -- Reload diffs after editing | 848 -- Reload diffs after editing |
849 au.BufWritePost = function() | 849 au.BufWritePost = function() |
850 if vim.o.diff then vim.cmd [[ diffupdate ]] end | 850 if vim.o.diff then vim.cmd.diffupdate() end |
851 end | 851 end |
852 | 852 |
853 -- Snippets | 853 -- Snippets |
854 local ls = require 'luasnip' | 854 local ls = require 'luasnip' |
855 -- Expand snippet or jump to next placeholder | 855 -- Expand snippet or jump to next placeholder |
962 local grepprg = vim.opt.grepprg | 962 local grepprg = vim.opt.grepprg |
963 local grepformat = vim.opt.grepformat | 963 local grepformat = vim.opt.grepformat |
964 | 964 |
965 vim.opt.grepprg = 'fd' | 965 vim.opt.grepprg = 'fd' |
966 vim.opt.grepformat = '%f' | 966 vim.opt.grepformat = '%f' |
967 vim.cmd('execute' .. '"silent! grep! ' .. args.args .. '"') | 967 vim.cmd.execute('"silent! grep! ' .. args.args .. '"') |
968 vim.cmd 'copen' | 968 vim.cmd.copen() |
969 | 969 |
970 vim.opt.grepprg = grepprg | 970 vim.opt.grepprg = grepprg |
971 vim.opt.grepformat = grepformat | 971 vim.opt.grepformat = grepformat |
972 end | 972 end |
973 vim.api.nvim_create_user_command('Cfd', fd_quickfix, { nargs = '+', complete = 'file' }) | 973 vim.api.nvim_create_user_command('Cfd', fd_quickfix, { nargs = '+', complete = 'file' }) |