feat: wrap long lines
This commit is contained in:
parent
a0e014716a
commit
ee8adbde74
|
@ -1,11 +1,12 @@
|
||||||
-- 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 })
|
||||||
|
@ -18,57 +19,56 @@ local function set_json_filetype()
|
||||||
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 {}
|
||||||
|
|
|
@ -1,40 +1,40 @@
|
||||||
-- Taken from https://www.lazyvim.org/configuration/general
|
-- Taken from https://www.lazyvim.org/configuration/general
|
||||||
|
|
||||||
vim.g.mapleader = " "
|
vim.g.mapleader = ' '
|
||||||
vim.g.maplocalleader = " "
|
vim.g.maplocalleader = ' '
|
||||||
|
|
||||||
local opt = vim.opt
|
local opt = vim.opt
|
||||||
|
|
||||||
opt.autowrite = true -- Enable auto write
|
opt.autowrite = true -- Enable auto write
|
||||||
opt.clipboard = "unnamedplus" -- Sync with system clipboard
|
opt.clipboard = 'unnamedplus' -- Sync with system clipboard
|
||||||
opt.completeopt = "menu,menuone,noselect"
|
opt.completeopt = 'menu,menuone,noselect'
|
||||||
opt.conceallevel = 3 -- Hide * markup for bold and italic
|
opt.conceallevel = 3 -- Hide * markup for bold and italic
|
||||||
opt.confirm = true -- Confirm to save changes before exiting modified buffer
|
opt.confirm = true -- Confirm to save changes before exiting modified buffer
|
||||||
opt.cursorline = true -- Enable highlighting of the current line
|
opt.cursorline = true -- Enable highlighting of the current line
|
||||||
opt.expandtab = true -- Use spaces instead of tabs
|
opt.expandtab = true -- Use spaces instead of tabs
|
||||||
opt.formatoptions = "jcroqlnt" -- tcqj
|
opt.formatoptions = 'jcroqlnt' -- tcqj
|
||||||
opt.grepformat = "%f:%l:%c:%m"
|
opt.grepformat = '%f:%l:%c:%m'
|
||||||
opt.grepprg = "rg --vimgrep"
|
opt.grepprg = 'rg --vimgrep'
|
||||||
opt.ignorecase = true -- Ignore case
|
opt.ignorecase = true -- Ignore case
|
||||||
opt.inccommand = "nosplit" -- preview incremental substitute
|
opt.inccommand = 'nosplit' -- preview incremental substitute
|
||||||
opt.laststatus = 0
|
opt.laststatus = 0
|
||||||
opt.list = true -- Show some invisible characters (tabs...
|
opt.list = true -- Show some invisible characters (tabs...
|
||||||
opt.mouse = "a" -- Enable mouse mode
|
opt.mouse = 'a' -- Enable mouse mode
|
||||||
opt.number = true -- Print line number
|
opt.number = true -- Print line number
|
||||||
opt.pumblend = 10 -- Popup blend
|
opt.pumblend = 10 -- Popup blend
|
||||||
opt.pumheight = 10 -- Maximum number of entries in a popup
|
opt.pumheight = 10 -- Maximum number of entries in a popup
|
||||||
opt.relativenumber = true -- Relative line numbers
|
opt.relativenumber = true -- Relative line numbers
|
||||||
opt.scrolloff = 4 -- Lines of context
|
opt.scrolloff = 4 -- Lines of context
|
||||||
opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" }
|
opt.sessionoptions = { 'buffers', 'curdir', 'tabpages', 'winsize' }
|
||||||
opt.shiftround = true -- Round indent
|
opt.shiftround = true -- Round indent
|
||||||
opt.shiftwidth = 2 -- Size of an indent
|
opt.shiftwidth = 2 -- Size of an indent
|
||||||
opt.shortmess:append { W = true, I = true, c = true }
|
opt.shortmess:append { W = true, I = true, c = true }
|
||||||
opt.showmode = false -- Dont show mode since we have a statusline
|
opt.showmode = false -- Dont show mode since we have a statusline
|
||||||
opt.sidescrolloff = 8 -- Columns of context
|
opt.sidescrolloff = 8 -- Columns of context
|
||||||
opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time
|
opt.signcolumn = 'yes' -- Always show the signcolumn, otherwise it would shift the text each time
|
||||||
opt.smartcase = true -- Don't ignore case with capitals
|
opt.smartcase = true -- Don't ignore case with capitals
|
||||||
opt.smartindent = true -- Insert indents automatically
|
opt.smartindent = true -- Insert indents automatically
|
||||||
opt.spelllang = { "en" }
|
opt.spelllang = { 'en' }
|
||||||
opt.splitbelow = true -- Put new windows below current
|
opt.splitbelow = true -- Put new windows below current
|
||||||
opt.splitright = true -- Put new windows right of current
|
opt.splitright = true -- Put new windows right of current
|
||||||
opt.tabstop = 2 -- Number of spaces tabs count for
|
opt.tabstop = 2 -- Number of spaces tabs count for
|
||||||
|
@ -43,12 +43,12 @@ opt.timeoutlen = 300
|
||||||
opt.undofile = true
|
opt.undofile = true
|
||||||
opt.undolevels = 10000
|
opt.undolevels = 10000
|
||||||
opt.updatetime = 200 -- Save swap file and trigger CursorHold
|
opt.updatetime = 200 -- Save swap file and trigger CursorHold
|
||||||
opt.wildmode = "longest:full,full" -- Command-line completion mode
|
opt.wildmode = 'longest:full,full' -- Command-line completion mode
|
||||||
opt.winminwidth = 5 -- Minimum window width
|
opt.winminwidth = 5 -- Minimum window width
|
||||||
opt.wrap = false -- Disable line wrap
|
-- opt.wrap = false -- Disable line wrap
|
||||||
|
|
||||||
if vim.fn.has("nvim-0.9.0") == 1 then
|
if vim.fn.has 'nvim-0.9.0' == 1 then
|
||||||
opt.splitkeep = "screen"
|
opt.splitkeep = 'screen'
|
||||||
opt.shortmess:append { C = true }
|
opt.shortmess:append { C = true }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue