feat: wrap long lines
parent
a0e014716a
commit
ee8adbde74
@ -1,74 +1,74 @@
|
|||||||
-- Case insensitive searching UNLESS /C or capital in search
|
-- Case insensitive searching UNLESS /C or capital in search
|
||||||
vim.o.ignorecase = true
|
vim.o.ignorecase = true
|
||||||
vim.o.smartcase = true
|
vim.o.smartcase = true
|
||||||
|
vim.o.wrap = true
|
||||||
|
|
||||||
-- Copy to clipboard
|
-- Copy to clipboard
|
||||||
local has_unnamedplus = vim.fn.has("unnamedplus")
|
local has_unnamedplus = vim.fn.has 'unnamedplus'
|
||||||
if has_unnamedplus then
|
if has_unnamedplus then
|
||||||
vim.o.clipboard = "unnamedplus"
|
vim.o.clipboard = 'unnamedplus'
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.api.nvim_buf_set_keymap(0, 'n', 'y', '"+y', { noremap = true, silent = true })
|
vim.api.nvim_buf_set_keymap(0, 'n', 'y', '"+y', { noremap = true, silent = true })
|
||||||
vim.api.nvim_buf_set_keymap(0, 'n', 'p', '"+p', { noremap = true, silent = true })
|
vim.api.nvim_buf_set_keymap(0, 'n', 'p', '"+p', { noremap = true, silent = true })
|
||||||
|
|
||||||
local function set_json_filetype()
|
local function set_json_filetype()
|
||||||
if string.match(vim.api.nvim_buf_get_name(0), '%.geojson$') or string.match(vim.api.nvim_buf_get_name(0), '%.json$') then
|
if string.match(vim.api.nvim_buf_get_name(0), '%.geojson$') or string.match(vim.api.nvim_buf_get_name(0), '%.json$') then
|
||||||
-- vim.filetype('json')
|
-- vim.filetype('json')
|
||||||
vim.api.nvim_buf_set_option(0, 'filetype', 'json')
|
vim.api.nvim_buf_set_option(0, 'filetype', 'json')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ "BufReadPost" }, { pattern = { "*.geojson", "*.bson" }, callback = set_json_filetype })
|
vim.api.nvim_create_autocmd({ 'BufReadPost' }, { pattern = { '*.geojson', '*.bson' }, callback = set_json_filetype })
|
||||||
|
|
||||||
function Format()
|
function Format()
|
||||||
vim.lsp.buf.format(nil, 100)
|
vim.lsp.buf.format(nil, 100)
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ "BufWritePre" }, { pattern = { "*" }, callback = Format })
|
vim.api.nvim_create_autocmd({ 'BufWritePre' }, { pattern = { '*' }, callback = Format })
|
||||||
|
|
||||||
function Macos()
|
function Macos()
|
||||||
return vim.fn.has("mac") == 1
|
return vim.fn.has 'mac' == 1
|
||||||
end
|
end
|
||||||
|
|
||||||
function Linux()
|
function Linux()
|
||||||
if package.os == 'Linux' then
|
if package.os == 'Linux' then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
if vim.fn.has('unix') and not vim.fn.has('macunix') and not vim.fn.has('win32unix')
|
if vim.fn.has 'unix' and not vim.fn.has 'macunix' and not vim.fn.has 'win32unix' and not vim.fn.has 'win64unix' then
|
||||||
and not vim.fn.has('win64unix') then
|
return true
|
||||||
return true
|
end
|
||||||
end
|
return false
|
||||||
return false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Windows()
|
function Windows()
|
||||||
return vim.fn.has("win32") == 1 or vim.fn.has("win64") == 1
|
return vim.fn.has 'win32' == 1 or vim.fn.has 'win64' == 1
|
||||||
end
|
end
|
||||||
|
|
||||||
function OpenBuffer()
|
function OpenBuffer()
|
||||||
if Macos() then
|
if Macos() then
|
||||||
vim.cmd('silent !open ' .. vim.fn.expand('%:p'))
|
vim.cmd('silent !open ' .. vim.fn.expand '%:p')
|
||||||
-- vim.cmd('silent !open -a "Google Chrome" ' .. vim.fn.expand('%:p'))
|
-- vim.cmd('silent !open -a "Google Chrome" ' .. vim.fn.expand('%:p'))
|
||||||
elseif Linux() then
|
elseif Linux() then
|
||||||
vim.cmd('silent !xdg-open ' .. vim.fn.expand('%:p'))
|
vim.cmd('silent !xdg-open ' .. vim.fn.expand '%:p')
|
||||||
elseif Windows() then
|
elseif Windows() then
|
||||||
vim.cmd('silent !start ' .. vim.fn.expand('%:p'))
|
vim.cmd('silent !start ' .. vim.fn.expand '%:p')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>vob", OpenBuffer, { noremap = true })
|
vim.keymap.set('n', '<leader>vob', OpenBuffer, { noremap = true })
|
||||||
|
|
||||||
-- vim.keymap.set("n", "<leader>e", vim.lsp.diagnostic.show_line_diagnostics, { noremap = true, silent = true })
|
-- vim.keymap.set("n", "<leader>e", vim.lsp.diagnostic.show_line_diagnostics, { noremap = true, silent = true })
|
||||||
--
|
--
|
||||||
local function prettify_json()
|
local function prettify_json()
|
||||||
vim.api.nvim_command('%!jq .')
|
vim.api.nvim_command '%!jq .'
|
||||||
end
|
end
|
||||||
|
|
||||||
local function uglify_json()
|
local function uglify_json()
|
||||||
vim.api.nvim_command("%!jq -c .")
|
vim.api.nvim_command '%!jq -c .'
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>jq", prettify_json, { noremap = true })
|
vim.keymap.set('n', '<leader>jq', prettify_json, { noremap = true })
|
||||||
vim.keymap.set("n", "<leader>ujq", uglify_json, { noremap = true })
|
vim.keymap.set('n', '<leader>ujq', uglify_json, { noremap = true })
|
||||||
|
|
||||||
return {}
|
return {}
|
||||||
|
Loading…
Reference in New Issue