Compare commits
2 Commits
b0cfb31645
...
e78c8fc07f
Author | SHA1 | Date | |
---|---|---|---|
e78c8fc07f | |||
0602390a2d |
3
after/ftplugin/c.lua
Normal file
3
after/ftplugin/c.lua
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
local opts = { buffer = true, remap = false, silent = true }
|
||||||
|
vim.keymap.set('n', '0', ':PreProcIfWrap<CR>', opts)
|
||||||
|
vim.keymap.set('v', '0', ':PreProcIfWrap<CR>', opts)
|
@ -1,2 +1,6 @@
|
|||||||
vim.opt.commentstring = '//%s'
|
vim.opt.commentstring = '//%s'
|
||||||
vim.opt.matchpairs:append('<:>')
|
vim.opt.matchpairs:append('<:>')
|
||||||
|
|
||||||
|
local opts = { buffer = true, remap = false, silent = true }
|
||||||
|
vim.keymap.set('n', '0', ':PreProcIfWrap<CR>', opts)
|
||||||
|
vim.keymap.set('v', '0', ':PreProcIfWrap<CR>', opts)
|
||||||
|
@ -5,6 +5,7 @@ return {
|
|||||||
'nvim-telescope/telescope-fzy-native.nvim',
|
'nvim-telescope/telescope-fzy-native.nvim',
|
||||||
'nvim-tree/nvim-web-devicons',
|
'nvim-tree/nvim-web-devicons',
|
||||||
'axkirillov/easypick.nvim',
|
'axkirillov/easypick.nvim',
|
||||||
|
'benfowler/telescope-luasnip.nvim',
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
local telescope = require('telescope')
|
local telescope = require('telescope')
|
||||||
@ -28,6 +29,7 @@ return {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
telescope.load_extension('fzy_native')
|
telescope.load_extension('fzy_native')
|
||||||
|
telescope.load_extension('luasnip')
|
||||||
|
|
||||||
local builtin = require('telescope.builtin')
|
local builtin = require('telescope.builtin')
|
||||||
local opts = { noremap = true }
|
local opts = { noremap = true }
|
||||||
|
@ -126,3 +126,13 @@ vim.api.nvim_create_user_command('Rg', function(opts)
|
|||||||
end
|
end
|
||||||
require('telescope.builtin').grep_string(grep_opts)
|
require('telescope.builtin').grep_string(grep_opts)
|
||||||
end, { bang = true, nargs = '*' })
|
end, { bang = true, nargs = '*' })
|
||||||
|
|
||||||
|
vim.api.nvim_create_user_command('PreProcIfWrap', function(opts)
|
||||||
|
local buffer = vim.api.nvim_get_current_buf()
|
||||||
|
vim.api.nvim_buf_set_lines(
|
||||||
|
buffer, opts.line2, opts.line2, true, { '#endif' })
|
||||||
|
vim.api.nvim_buf_set_lines(
|
||||||
|
buffer, opts.line1 - 1, opts.line1 - 1, true, { '#if 0' })
|
||||||
|
local window = vim.api.nvim_get_current_win()
|
||||||
|
vim.api.nvim_win_set_cursor(window, {opts.line1, 5})
|
||||||
|
end, { range = true })
|
||||||
|
Loading…
x
Reference in New Issue
Block a user