Skip to content

Commit

Permalink
vim: Use double quotes instead of single quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
Granddave committed Jan 6, 2023
1 parent 48a9912 commit 589aef6
Show file tree
Hide file tree
Showing 13 changed files with 150 additions and 145 deletions.
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[*.lua]
indent_style = space
indent_size = 2
tab_width = 2
quote_style = double
14 changes: 7 additions & 7 deletions vim/.config/nvim/after/plugin/goyo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ vim.keymap.set("n", "<Leader>go", "<Cmd>Goyo<CR>", { noremap = true, silent = tr
local cached_opts = {}

local backup_opts = function()
cached_opts.limelight = vim.fn.exists('#limelight')
cached_opts.limelight = vim.fn.exists("#limelight")
cached_opts.whitespace = vim.api.nvim_buf_get_var(0, "better_whitespace_enabled")
cached_opts.cursorline = vim.opt.cursorline:get()
cached_opts.showmode = vim.opt.showmode:get()
Expand Down Expand Up @@ -31,10 +31,10 @@ vim.api.nvim_create_autocmd("User", {
pattern = "GoyoEnter",
callback = function()
backup_opts()
if vim.fn.executable('tmux') == 1 and os.getenv('TMUX') then
io.popen('tmux set status off')
if vim.fn.executable("tmux") == 1 and os.getenv("TMUX") then
io.popen("tmux set status off")
end
require('lualine').hide({})
require("lualine").hide({})
vim.cmd("Limelight")
vim.cmd("DisableWhitespace")
vim.opt.cursorline = false
Expand All @@ -48,11 +48,11 @@ vim.api.nvim_create_autocmd("User", {
vim.api.nvim_create_autocmd("User", {
pattern = "GoyoLeave",
callback = function()
if vim.fn.executable('tmux') == 1 and os.getenv('TMUX') then
io.popen('tmux set status on')
if vim.fn.executable("tmux") == 1 and os.getenv("TMUX") then
io.popen("tmux set status on")
end
restore_opts()
require('lualine').hide({ unhide = true })
require("lualine").hide({ unhide = true })
require("bufferline").setup() -- TODO: save previous state
end,
group = goyo_group,
Expand Down
22 changes: 11 additions & 11 deletions vim/.config/nvim/after/plugin/lualine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@ end
require("lualine").setup({
options = {
icons_enabled = true,
theme = 'auto',
component_separators = { left = '|', right = '|' },
section_separators = { left = '', right = '' },
theme = "auto",
component_separators = { left = "|", right = "|" },
section_separators = { left = "", right = "" },
disabled_filetypes = {},
always_divide_middle = true,
globalstatus = false,
},
sections = {
lualine_a = { 'mode' },
lualine_b = { 'branch', 'diff', 'diagnostics' },
lualine_a = { "mode" },
lualine_b = { "branch", "diff", "diagnostics" },
lualine_c = {
{
'filename',
"filename",
path = 1 -- Relative filepath
}
},
lualine_x = { 'encoding', 'fileformat', 'filetype' },
lualine_y = { 'progress' },
lualine_z = { 'location' }
lualine_x = { "encoding", "fileformat", "filetype" },
lualine_y = { "progress" },
lualine_z = { "location" }
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { 'filename' },
lualine_x = { 'location' },
lualine_c = { "filename" },
lualine_x = { "location" },
lualine_y = {},
lualine_z = {}
},
Expand Down
6 changes: 3 additions & 3 deletions vim/.config/nvim/after/plugin/nvim-autopairs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ end
autopairs.setup({
})

require('cmp').event:on(
'confirm_done',
require('nvim-autopairs.completion.cmp').on_confirm_done()
require("cmp").event:on(
"confirm_done",
require("nvim-autopairs.completion.cmp").on_confirm_done()
)
46 changes: 23 additions & 23 deletions vim/.config/nvim/after/plugin/nvim-cmp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,59 +8,59 @@ vim.opt.completeopt = "menu,menuone,noinsert"
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
['<C-n>'] = function()
["<C-n>"] = function()
if cmp.visible() then
cmp.select_next_item()
else
cmp.complete()
end
end,
['<C-p>'] = function()
["<C-p>"] = function()
if cmp.visible() then
cmp.select_prev_item()
else
cmp.complete()
end
end,
['<C-Space>'] = cmp.mapping.complete({}),
['<C-e>'] = cmp.mapping.abort(),
['<C-j>'] = cmp.mapping.confirm({ select = true }),
['<C-d>'] = function(fallback)
["<C-Space>"] = cmp.mapping.complete({}),
["<C-e>"] = cmp.mapping.abort(),
["<C-j>"] = cmp.mapping.confirm({ select = true }),
["<C-d>"] = function(fallback)
if cmp.visible() then
cmp.select_next_item({ count = 5 })
else
fallback()
end
end,
['<C-u>'] = function(fallback)
["<C-u>"] = function(fallback)
if cmp.visible() then
cmp.select_prev_item({ count = 5 })
else
fallback()
end
end,
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'nvim_lua' },
{ name = 'luasnip' },
{ name = 'path' },
{ name = 'buffer', keyword_length = 4 },
{ name = "nvim_lsp" },
{ name = "nvim_lua" },
{ name = "luasnip" },
{ name = "path" },
{ name = "buffer", keyword_length = 4 },
}),
experimental = {
ghost_text = true
},
formatting = {
format = require('lspkind').cmp_format({
mode = 'symbol_text',
format = require("lspkind").cmp_format({
mode = "symbol_text",
maxwidth = 50,
ellipsis_char = '...',
ellipsis_char = "...",
menu = {
buffer = "[buf]",
nvim_lsp = "[LSP]",
Expand All @@ -73,18 +73,18 @@ cmp.setup({
},
})

cmp.setup.cmdline('/', {
cmp.setup.cmdline("/", {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' }
{ name = "buffer" }
}
})

cmp.setup.cmdline(':', {
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
{ name = "path" }
}, {
{ name = 'cmdline', keyword_length = 2 }
{ name = "cmdline", keyword_length = 2 }
})
})
38 changes: 19 additions & 19 deletions vim/.config/nvim/after/plugin/nvim-dap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@ if not ok then
return
end

require('dapui').setup()
require("dapui").setup()

local opts = { noremap = true, silent = true }
vim.keymap.set('n', '<F5>', function() dap.continue() end, opts)
vim.keymap.set('n', '<F10>', function() dap.step_over() end, opts)
vim.keymap.set('n', '<F11>', function() dap.step_into() end, opts)
vim.keymap.set('n', '<F12>', function() dap.step_out() end, opts)
vim.keymap.set('n', '<Leader>b', function() dap.toggle_breakpoint() end, opts)
vim.keymap.set('n', '<Leader>B', function() dap.set_breakpoint(vim.fn.input('Breakpoint condition: ')) end, opts)
vim.keymap.set("n", "<F5>", function() dap.continue() end, opts)
vim.keymap.set("n", "<F10>", function() dap.step_over() end, opts)
vim.keymap.set("n", "<F11>", function() dap.step_into() end, opts)
vim.keymap.set("n", "<F12>", function() dap.step_out() end, opts)
vim.keymap.set("n", "<Leader>b", function() dap.toggle_breakpoint() end, opts)
vim.keymap.set("n", "<Leader>B", function() dap.set_breakpoint(vim.fn.input("Breakpoint condition: ")) end, opts)
--vim.keymap.set('n', '<Leader>lp', function() dap.set_breakpoint(nil, nil, vim.fn.input('Log point message: ')) end, opts)
vim.keymap.set('n', '<Leader>dr', function() dap.repl.open() end, opts)
vim.keymap.set('n', '<Leader>dl', function() dap.run_last() end, opts)
vim.keymap.set("n", "<Leader>dr", function() dap.repl.open() end, opts)
vim.keymap.set("n", "<Leader>dl", function() dap.run_last() end, opts)

dap.adapters.python = {
type = 'executable',
command = '/usr/bin/python3', --'path/to/virtualenvs/debugpy/bin/python'
args = { '-m', 'debugpy.adapter' },
type = "executable",
command = "/usr/bin/python3", --'path/to/virtualenvs/debugpy/bin/python'
args = { "-m", "debugpy.adapter" },
}
dap.configurations.python = {
{
type = 'python',
request = 'launch',
type = "python",
request = "launch",
name = "Launch file",

-- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options
Expand All @@ -34,12 +34,12 @@ dap.configurations.python = {
-- The code below looks for a `venv` or `.venv` folder in the current directly and uses the python within.
-- You could adapt this - to for example use the `VIRTUAL_ENV` environment variable.
local cwd = vim.fn.getcwd()
if vim.fn.executable(cwd .. '/venv/bin/python3') == 1 then
return cwd .. '/venv/bin/python3'
elseif vim.fn.executable(cwd .. '/.venv/bin/python3') == 1 then
return cwd .. '/.venv/bin/python3'
if vim.fn.executable(cwd .. "/venv/bin/python3") == 1 then
return cwd .. "/venv/bin/python3"
elseif vim.fn.executable(cwd .. "/.venv/bin/python3") == 1 then
return cwd .. "/.venv/bin/python3"
else
return '/usr/bin/python3'
return "/usr/bin/python3"
end
end,
},
Expand Down
44 changes: 22 additions & 22 deletions vim/.config/nvim/after/plugin/nvim-lspconfig.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ local servers = {
settings = {
Lua = {
runtime = {
version = 'LuaJIT',
version = "LuaJIT",
},
diagnostics = {
globals = {
'vim',
'use',
'print',
'require',
"vim",
"use",
"print",
"require",
},
},
workspace = {
Expand All @@ -48,11 +48,11 @@ require("mason-lspconfig").setup({

local on_attach = function(client, bufnr)
-- Enable completion triggered by <c-x><c-o>
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")

local telescope = require('telescope.builtin')
local telescope = require("telescope.builtin")
local telescope_opts = {
sorting_strategy = 'ascending',
sorting_strategy = "ascending",
fname_width = 60,
path_display = { "smart" },
layout_strategy = "vertical",
Expand All @@ -62,25 +62,25 @@ local on_attach = function(client, bufnr)
}
-- See `:help vim.lsp.*` for documentation on any of the below functions
local bufopts = { noremap = true, silent = true, buffer = bufnr }
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
vim.keymap.set('n', 'gd', function() telescope.lsp_definitions(telescope_opts) end, bufopts)
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, bufopts)
vim.keymap.set("n", "gd", function() telescope.lsp_definitions(telescope_opts) end, bufopts)
vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts)
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, bufopts)
--vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
--vim.keymap.set('n', '<Leader>wa', vim.lsp.buf.add_workspace_folder, bufopts)
--vim.keymap.set('n', '<Leader>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
--vim.keymap.set('n', '<Leader>lw',
-- function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end,
-- bufopts
--)
vim.keymap.set('n', '<Leader>D', vim.lsp.buf.type_definition, bufopts)
vim.keymap.set('n', '<Leader>rn', vim.lsp.buf.rename, bufopts)
vim.keymap.set('n', '<Leader>ca', vim.lsp.buf.code_action, bufopts)
vim.keymap.set("n", "<Leader>D", vim.lsp.buf.type_definition, bufopts)
vim.keymap.set("n", "<Leader>rn", vim.lsp.buf.rename, bufopts)
vim.keymap.set("n", "<Leader>ca", vim.lsp.buf.code_action, bufopts)
vim.keymap.set("n", "<Leader>gr",
function() telescope.lsp_references(telescope_opts) end,
bufopts
)
vim.keymap.set('n', '<Leader>fo',
vim.keymap.set("n", "<Leader>fo",
function() vim.lsp.buf.format({ async = true }) end,
bufopts
)
Expand Down Expand Up @@ -111,13 +111,13 @@ local on_attach = function(client, bufnr)
})
end

vim.keymap.set('n', '<Leader>dp', function() vim.diagnostic.goto_prev({ float = false }) end, bufopts)
vim.keymap.set('n', '<Leader>dn', function() vim.diagnostic.goto_next({ float = false }) end, bufopts)
vim.keymap.set('n', '<Leader>dl', vim.diagnostic.setloclist, bufopts)
vim.keymap.set("n", "<Leader>dp", function() vim.diagnostic.goto_prev({ float = false }) end, bufopts)
vim.keymap.set("n", "<Leader>dn", function() vim.diagnostic.goto_next({ float = false }) end, bufopts)
vim.keymap.set("n", "<Leader>dl", vim.diagnostic.setloclist, bufopts)
end

local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)

local lsp_opts = {
on_attach = on_attach,
Expand All @@ -128,7 +128,7 @@ local lsp_opts = {
}
for server_name, user_opts in pairs(servers) do
lsp_opts = vim.tbl_deep_extend("force", lsp_opts, user_opts)
require('lspconfig')[server_name].setup(lsp_opts)
require("lspconfig")[server_name].setup(lsp_opts)
end

-- Attach to a remote Clangd server run by:
Expand All @@ -138,7 +138,7 @@ vim.keymap.set("n", "<Leader>cpp",
lsp_opts = vim.tbl_deep_extend("force", lsp_opts, {
cmd = { "nc", "127.0.0.1", "4444" },
})
require('lspconfig')['clangd'].setup(lsp_opts)
require("lspconfig")["clangd"].setup(lsp_opts)
end,
{ noremap = true, silent = true }
)
Expand Down
2 changes: 1 addition & 1 deletion vim/.config/nvim/after/plugin/nvim-scrollbar.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if not HAS('scrollbar') then
if not HAS("scrollbar") then
return
end

Expand Down
10 changes: 5 additions & 5 deletions vim/.config/nvim/after/plugin/telescope.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ telescope.setup({
},
})

telescope.load_extension('fzf')
telescope.load_extension('harpoon')
telescope.load_extension("fzf")
telescope.load_extension("harpoon")

local map = vim.keymap.set
local opts = { noremap = true, silent = true }
local builtin = require('telescope.builtin')
local themes = require('telescope.themes')
local actions = require('telescope.actions')
local builtin = require("telescope.builtin")
local themes = require("telescope.themes")
local actions = require("telescope.actions")

map("n", "<Leader>ff", function() builtin.find_files() end, opts)
map("n", "<Leader>fdf", function()
Expand Down
Loading

0 comments on commit 589aef6

Please sign in to comment.