feat: wrap long lines

pull/546/head
Thomas Alcala Schneider 2 years ago
parent a0e014716a
commit ee8adbde74
No known key found for this signature in database
GPG Key ID: 24BE5CF48622091B

@ -1,74 +1,74 @@
-- Case insensitive searching UNLESS /C or capital in search
vim.o.ignorecase = true
vim.o.smartcase = true
vim.o.wrap = true
-- Copy to clipboard
local has_unnamedplus = vim.fn.has("unnamedplus")
local has_unnamedplus = vim.fn.has 'unnamedplus'
if has_unnamedplus then
vim.o.clipboard = "unnamedplus"
vim.o.clipboard = 'unnamedplus'
end
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 })
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
-- vim.filetype('json')
vim.api.nvim_buf_set_option(0, 'filetype', 'json')
end
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.api.nvim_buf_set_option(0, 'filetype', 'json')
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()
vim.lsp.buf.format(nil, 100)
vim.lsp.buf.format(nil, 100)
end
vim.api.nvim_create_autocmd({ "BufWritePre" }, { pattern = { "*" }, callback = Format })
vim.api.nvim_create_autocmd({ 'BufWritePre' }, { pattern = { '*' }, callback = Format })
function Macos()
return vim.fn.has("mac") == 1
return vim.fn.has 'mac' == 1
end
function Linux()
if package.os == 'Linux' then
return true
end
if vim.fn.has('unix') and not vim.fn.has('macunix') and not vim.fn.has('win32unix')
and not vim.fn.has('win64unix') then
return true
end
return false
if package.os == 'Linux' then
return true
end
if vim.fn.has 'unix' and not vim.fn.has 'macunix' and not vim.fn.has 'win32unix' and not vim.fn.has 'win64unix' then
return true
end
return false
end
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
function OpenBuffer()
if Macos() then
vim.cmd('silent !open ' .. vim.fn.expand('%:p'))
-- vim.cmd('silent !open -a "Google Chrome" ' .. vim.fn.expand('%:p'))
elseif Linux() then
vim.cmd('silent !xdg-open ' .. vim.fn.expand('%:p'))
elseif Windows() then
vim.cmd('silent !start ' .. vim.fn.expand('%:p'))
end
if Macos() then
vim.cmd('silent !open ' .. vim.fn.expand '%:p')
-- vim.cmd('silent !open -a "Google Chrome" ' .. vim.fn.expand('%:p'))
elseif Linux() then
vim.cmd('silent !xdg-open ' .. vim.fn.expand '%:p')
elseif Windows() then
vim.cmd('silent !start ' .. vim.fn.expand '%:p')
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 })
--
local function prettify_json()
vim.api.nvim_command('%!jq .')
vim.api.nvim_command '%!jq .'
end
local function uglify_json()
vim.api.nvim_command("%!jq -c .")
vim.api.nvim_command '%!jq -c .'
end
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>jq', prettify_json, { noremap = true })
vim.keymap.set('n', '<leader>ujq', uglify_json, { noremap = true })
return {}

@ -1,40 +1,40 @@
-- Taken from https://www.lazyvim.org/configuration/general
vim.g.mapleader = " "
vim.g.maplocalleader = " "
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
local opt = vim.opt
opt.autowrite = true -- Enable auto write
opt.clipboard = "unnamedplus" -- Sync with system clipboard
opt.completeopt = "menu,menuone,noselect"
opt.clipboard = 'unnamedplus' -- Sync with system clipboard
opt.completeopt = 'menu,menuone,noselect'
opt.conceallevel = 3 -- Hide * markup for bold and italic
opt.confirm = true -- Confirm to save changes before exiting modified buffer
opt.cursorline = true -- Enable highlighting of the current line
opt.expandtab = true -- Use spaces instead of tabs
opt.formatoptions = "jcroqlnt" -- tcqj
opt.grepformat = "%f:%l:%c:%m"
opt.grepprg = "rg --vimgrep"
opt.formatoptions = 'jcroqlnt' -- tcqj
opt.grepformat = '%f:%l:%c:%m'
opt.grepprg = 'rg --vimgrep'
opt.ignorecase = true -- Ignore case
opt.inccommand = "nosplit" -- preview incremental substitute
opt.inccommand = 'nosplit' -- preview incremental substitute
opt.laststatus = 0
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.pumblend = 10 -- Popup blend
opt.pumheight = 10 -- Maximum number of entries in a popup
opt.relativenumber = true -- Relative line numbers
opt.scrolloff = 4 -- Lines of context
opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" }
opt.sessionoptions = { 'buffers', 'curdir', 'tabpages', 'winsize' }
opt.shiftround = true -- Round indent
opt.shiftwidth = 2 -- Size of an indent
opt.shortmess:append { W = true, I = true, c = true }
opt.showmode = false -- Dont show mode since we have a statusline
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.smartindent = true -- Insert indents automatically
opt.spelllang = { "en" }
opt.spelllang = { 'en' }
opt.splitbelow = true -- Put new windows below current
opt.splitright = true -- Put new windows right of current
opt.tabstop = 2 -- Number of spaces tabs count for
@ -43,13 +43,13 @@ opt.timeoutlen = 300
opt.undofile = true
opt.undolevels = 10000
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.wrap = false -- Disable line wrap
-- opt.wrap = false -- Disable line wrap
if vim.fn.has("nvim-0.9.0") == 1 then
opt.splitkeep = "screen"
opt.shortmess:append { C = true }
if vim.fn.has 'nvim-0.9.0' == 1 then
opt.splitkeep = 'screen'
opt.shortmess:append { C = true }
end
-- Fix markdown indentation settings

Loading…
Cancel
Save