Compare commits
3 Commits
f34eee4399
...
2168ae0c71
Author | SHA1 | Date |
---|---|---|
David Holland | 2168ae0c71 | |
David Holland | 535aa5c2c7 | |
David Holland | 424a3a58af |
1
init.lua
1
init.lua
|
@ -1,6 +1,7 @@
|
|||
require('platform')
|
||||
require('custom')
|
||||
require('settings')
|
||||
require('pre_plugins')
|
||||
require('plugins')
|
||||
require('post_plugins')
|
||||
require('plugin_options')
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
vim.keymap.set('n', '<leader>cd', ':cd %:p:h<CR>', { noremap = true, silent = true })
|
||||
vim.keymap.set('n', '<leader>lcd', ':lcd %:p:h<CR>', { noremap = true, silent = true })
|
||||
|
||||
vim.keymap.set('t', '<Esc>', '<C-\\><C-n>', { noremap = true })
|
||||
vim.keymap.set('t', '<C-w><Esc>', '<C-\\><C-n>', { noremap = true })
|
||||
|
||||
vim.keymap.set('n', '<leader>+', '<C-W>+', { noremap = true })
|
||||
vim.keymap.set('n', '<leader>-', '<C-W>-', { noremap = true })
|
||||
|
|
|
@ -73,7 +73,7 @@ if vim.g.use_clang_format == true then
|
|||
autocmd FileType c,cpp,objc vnoremap <buffer><Leader>cf :ClangFormat<CR>
|
||||
]])
|
||||
|
||||
vim.keymap.set('n', '<leader>ct', ':ClangFormatAutoToggle<cr>')
|
||||
vim.keymap.set('n', '<leader>ct', ':ClangFormatAutoToggle<cr>', { noremap = true })
|
||||
end
|
||||
-- ===
|
||||
|
||||
|
@ -363,7 +363,7 @@ end
|
|||
-- Setup Nerdtree
|
||||
-- ===
|
||||
if vim.g.use_nerdtree == true then
|
||||
vim.keymap.set({ 'n', 'v', 'o' }, 'map <leader>n', ':NERDTreeToggle<CR>')
|
||||
vim.keymap.set({ 'n', 'v', 'o' }, '<leader>n', ':NERDTreeToggle<CR>', { noremap = true })
|
||||
end
|
||||
-- ===
|
||||
|
||||
|
@ -604,15 +604,15 @@ if vim.g.use_pandoc == true then
|
|||
endfunction
|
||||
]])
|
||||
|
||||
vim.keymap.set('n', '<leader>pm :call', 'ConvertPandoc("md-to-pdf")<CR><CR>')
|
||||
vim.keymap.set('n', '<leader>pM :call', 'ConvertPandoc("md-html-to-pdf")<CR><CR>')
|
||||
vim.keymap.set('n', '<leader>ph :call', 'ConvertPandoc("md-to-html")<CR><CR>')
|
||||
vim.keymap.set('n', '<leader>pl :call', 'ConvertPandocPdfLatex()<CR><CR>')
|
||||
vim.keymap.set('n', '<leader>pd :call', 'ConvertPandocPdfLatexDebug()<CR>')
|
||||
vim.keymap.set('n', '<leader>pp :AsyncStop<CR>:call', 'OpenPdf()<CR>')
|
||||
vim.keymap.set('n', '<leader>po', ':AsyncStop<CR>:AsyncRun<Space>sumatrapdf<Space>')
|
||||
vim.keymap.set('n', '<leader>pm :call', 'ConvertPandoc("md-to-pdf")<CR><CR>', { noremap = true })
|
||||
vim.keymap.set('n', '<leader>pM :call', 'ConvertPandoc("md-html-to-pdf")<CR><CR>', { noremap = true })
|
||||
vim.keymap.set('n', '<leader>ph :call', 'ConvertPandoc("md-to-html")<CR><CR>', { noremap = true })
|
||||
vim.keymap.set('n', '<leader>pl :call', 'ConvertPandocPdfLatex()<CR><CR>', { noremap = true })
|
||||
vim.keymap.set('n', '<leader>pd :call', 'ConvertPandocPdfLatexDebug()<CR>', { noremap = true })
|
||||
vim.keymap.set('n', '<leader>pp :AsyncStop<CR>:call', 'OpenPdf()<CR>', { noremap = true })
|
||||
vim.keymap.set('n', '<leader>po', ':AsyncStop<CR>:AsyncRun<Space>sumatrapdf<Space>', { noremap = true })
|
||||
|
||||
vim.keymap.set('n', '<leader>pc :call', 'ToggleCompileOnSave()<CR>')
|
||||
vim.keymap.set('n', '<leader>pc :call', 'ToggleCompileOnSave()<CR>', { noremap = true })
|
||||
|
||||
--vim.cmd('autocmd FileType pandoc autocmd BufWritePost <buffer> call ConvertPandoc(g:pandoc_default) | execute("normal \<CR>")')
|
||||
vim.cmd('autocmd FileType pandoc silent autocmd BufWritePost <buffer> silent! call ConvertPandocOnSave(g:pandoc_default')
|
||||
|
@ -715,11 +715,11 @@ if vim.g.use_asciidoctor == true then
|
|||
endfunction
|
||||
]])
|
||||
|
||||
vim.keymap.set('n', '<leader>aa :call', 'AsciidoctorConvert()<CR>')
|
||||
vim.keymap.set('n', '<leader>ap :call', 'AsciidoctorPdfConvert()<CR>')
|
||||
vim.keymap.set('n', '<leader>ae :call', 'AsciidoctorEpubConvert()<CR>')
|
||||
vim.keymap.set('n', '<leader>aa :call', 'AsciidoctorConvert()<CR>', { noremap = true })
|
||||
vim.keymap.set('n', '<leader>ap :call', 'AsciidoctorPdfConvert()<CR>', { noremap = true })
|
||||
vim.keymap.set('n', '<leader>ae :call', 'AsciidoctorEpubConvert()<CR>', { noremap = true })
|
||||
|
||||
vim.keymap.set('n', '<leader>ant', 'i[.lightbox, cols="^2,^2", {LIGHTBOX}]<CR>\\|===<CR>\\|===<CR><ESC>kk')
|
||||
vim.keymap.set('n', '<leader>ani', 'aimage:./images/picture.jpg[picture, {POPUP}]<ESC>')
|
||||
vim.keymap.set('n', '<leader>ant', 'i[.lightbox, cols="^2,^2", {LIGHTBOX}]<CR>\\|===<CR>\\|===<CR><ESC>kk', { noremap = true })
|
||||
vim.keymap.set('n', '<leader>ani', 'aimage:./images/picture.jpg[picture, {POPUP}]<ESC>', { noremap = true })
|
||||
end
|
||||
-- ===
|
||||
|
|
253
lua/plugins.lua
253
lua/plugins.lua
|
@ -1,9 +1,8 @@
|
|||
-- vim.cmd([[
|
||||
-- augroup packer_user_config
|
||||
-- autocmd!
|
||||
-- autocmd BufWritePost plugins.lua source <afile> | PackerCompile
|
||||
-- augroup end
|
||||
-- ]])
|
||||
vim.api.nvim_create_autocmd('BufWritePost', {
|
||||
group = vim.api.nvim_create_augroup('packer_user_config', { clear = true }),
|
||||
pattern = 'plugins.lua',
|
||||
command = 'source <afile> | PackerCompile',
|
||||
})
|
||||
|
||||
return require('packer').startup(function(use)
|
||||
-- Packer can manage itself
|
||||
|
@ -135,6 +134,10 @@ return require('packer').startup(function(use)
|
|||
use 'ARM9/arm-syntax-vim'
|
||||
end
|
||||
|
||||
if vim.g.use_gas == true then
|
||||
use 'Shirk/vim-gas'
|
||||
end
|
||||
|
||||
if vim.g.use_asm_indent == true then
|
||||
use 'philj56/vim-asm-indent'
|
||||
end
|
||||
|
@ -165,34 +168,201 @@ return require('packer').startup(function(use)
|
|||
-- ===
|
||||
if vim.g.use_lsp == true then
|
||||
use {
|
||||
'williamboman/nvim-lsp-installer',
|
||||
'neovim/nvim-lspconfig',
|
||||
{
|
||||
'neovim/nvim-lspconfig',
|
||||
'williamboman/mason.nvim',
|
||||
after = 'nvim-lspconfig',
|
||||
config = function()
|
||||
require("nvim-lsp-installer").setup {}
|
||||
local lspconfig = require("lspconfig")
|
||||
lspconfig.sumneko_lua.setup {
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { 'vim' }
|
||||
},
|
||||
runtime = {
|
||||
version = "LuaJIT",
|
||||
path = vim.split(package.path, ";")
|
||||
},
|
||||
workspace = {
|
||||
library = {
|
||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||
[vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true
|
||||
require("mason").setup()
|
||||
end
|
||||
},
|
||||
{
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
requires = 'simrat39/rust-tools.nvim',
|
||||
after = {
|
||||
'mason.nvim',
|
||||
'nvim-cmp',
|
||||
},
|
||||
config = function()
|
||||
require("mason-lspconfig").setup {
|
||||
ensure_installed = {
|
||||
"sumneko_lua",
|
||||
"rust_analyzer"
|
||||
}
|
||||
}
|
||||
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
-- Use an on_attach function to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
-- on_attach := function(client, bufnr)
|
||||
local on_attach = function(_, bufnr)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
||||
end
|
||||
|
||||
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
|
||||
require("mason-lspconfig").setup_handlers {
|
||||
function (server_name)
|
||||
require("lspconfig")[server_name].setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
end,
|
||||
|
||||
["sumneko_lua"] = function()
|
||||
require("lspconfig").sumneko_lua.setup {
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { 'vim' }
|
||||
},
|
||||
runtime = {
|
||||
version = "LuaJIT",
|
||||
path = vim.split(package.path, ";")
|
||||
},
|
||||
workspace = {
|
||||
library = {
|
||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||
[vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
end,
|
||||
|
||||
["rust_analyzer"] = function ()
|
||||
require("rust-tools").setup {}
|
||||
end,
|
||||
}
|
||||
end
|
||||
},
|
||||
}
|
||||
|
||||
use {
|
||||
'hrsh7th/nvim-cmp',
|
||||
requires = {
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'hrsh7th/cmp-buffer',
|
||||
'hrsh7th/cmp-path',
|
||||
'hrsh7th/cmp-cmdline',
|
||||
{ 'petertriho/cmp-git', requires = 'nvim-lua/plenary.nvim' },
|
||||
{ 'saadparwaiz1/cmp_luasnip', requires = 'L3MON4D3/LuaSnip' },
|
||||
{ 'mtoohey31/cmp-fish', ft = 'fish' },
|
||||
{
|
||||
'saecki/crates.nvim',
|
||||
event = { "BufRead Cargo.toml" },
|
||||
requires = { { 'nvim-lua/plenary.nvim' } },
|
||||
config = function()
|
||||
require('crates').setup()
|
||||
end,
|
||||
},
|
||||
--'dmitmel/cmp-cmdline-history',
|
||||
'kdheepak/cmp-latex-symbols',
|
||||
'hrsh7th/cmp-nvim-lsp-signature-help',
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
}),
|
||||
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'nvim_lsp_signature_help' },
|
||||
{ name = 'latex_symbols' },
|
||||
}, {
|
||||
{ name = 'buffer', keyword_length = 3 },
|
||||
})
|
||||
}
|
||||
|
||||
-- Set configuration for specific filetype.
|
||||
cmp.setup.filetype('gitcommit', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
|
||||
}, {
|
||||
{ name = 'buffer', keyword_length = 3 },
|
||||
})
|
||||
})
|
||||
|
||||
cmp.setup.filetype('fish', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'fish' }, -- You can specify the `cmp_git` source if you were installed it.
|
||||
})
|
||||
})
|
||||
|
||||
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline('/', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = 'buffer', keyword_length = 3 }
|
||||
}
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(':', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path', keyword_length = 3 }
|
||||
}, {
|
||||
{ name = 'cmdline', keyword_length = 3 }
|
||||
})
|
||||
})
|
||||
|
||||
-- for _, cmd_type in ipairs({':', '/', '?', '@'}) do
|
||||
-- cmp.setup.cmdline(cmd_type, {
|
||||
-- sources = {
|
||||
-- { name = 'cmdline_history', keyword_length = 3 },
|
||||
-- },
|
||||
-- })
|
||||
-- end
|
||||
|
||||
vim.api.nvim_create_autocmd("BufRead", {
|
||||
group = vim.api.nvim_create_augroup("CmpSourceCargo", { clear = true }),
|
||||
pattern = "Cargo.toml",
|
||||
callback = function()
|
||||
cmp.setup.buffer({ sources = { { name = "crates" } } })
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
||||
use 'tami5/lspsaga.nvim'
|
||||
end
|
||||
-- ===
|
||||
|
@ -267,10 +437,19 @@ return require('packer').startup(function(use)
|
|||
-- Rust
|
||||
-- ===
|
||||
if vim.g.use_rust == true then
|
||||
use 'rust-lang/rust.vim'
|
||||
use {
|
||||
'rust-lang/rust.vim',
|
||||
}
|
||||
end
|
||||
-- ===
|
||||
|
||||
-- ===
|
||||
-- Fish
|
||||
-- ===
|
||||
if vim.g.use_fish == true then
|
||||
use 'nickeb96/fish.vim'
|
||||
end
|
||||
|
||||
-- ===
|
||||
-- Special functionality
|
||||
-- ===
|
||||
|
@ -294,10 +473,28 @@ return require('packer').startup(function(use)
|
|||
-- ===
|
||||
-- Colorscheme
|
||||
-- ===
|
||||
use {'dracula/vim', as = 'dracula'}
|
||||
use {'catppuccin/nvim', as = 'catppuccin'}
|
||||
use {
|
||||
"themercorp/themer.lua",
|
||||
opt = false,
|
||||
config = function()
|
||||
require("themer").setup({
|
||||
colorscheme = "dracula",
|
||||
styles = {
|
||||
["function"] = { style = 'italic' },
|
||||
functionbuiltin = { style = 'italic' },
|
||||
variable = { style = 'italic' },
|
||||
variableBuiltIn = { style = 'italic' },
|
||||
parameter = { style = 'italic' },
|
||||
},
|
||||
})
|
||||
end
|
||||
}
|
||||
|
||||
if vim.g.use_alt_colorschemes == true then
|
||||
--use {'dracula/vim', as = 'dracula.vim'}
|
||||
--use {'Mofiqul/dracula.nvim', as = 'dracula.nvim'}
|
||||
use {'catppuccin/nvim', as = 'catppuccin.nvim'}
|
||||
|
||||
use 'ajmwagar/vim-deus'
|
||||
use 'chriskempson/base16-vim'
|
||||
end
|
||||
|
|
|
@ -1,49 +1,6 @@
|
|||
-- ===
|
||||
-- Configure the on_attach function that defines keymaps
|
||||
-- ===
|
||||
local lspconfig = require('lspconfig')
|
||||
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
vim.api.nvim_set_keymap('n', '<space>e', '<cmd>lua vim.diagnostic.open_float()<CR>', opts)
|
||||
vim.api.nvim_set_keymap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts)
|
||||
vim.api.nvim_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
|
||||
vim.api.nvim_set_keymap('n', '<space>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts)
|
||||
|
||||
-- Use an on_attach function to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
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')
|
||||
|
||||
-- Mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
||||
end
|
||||
|
||||
-- Use a loop to conveniently call 'setup' on multiple servers and
|
||||
-- map buffer local keybindings when the language server attaches
|
||||
local servers = { 'sumneko_lua', 'rust_analyzer' }
|
||||
for _, lsp in pairs(servers) do
|
||||
lspconfig[lsp].setup {
|
||||
on_attach = on_attach
|
||||
}
|
||||
end
|
||||
-- ===
|
||||
|
||||
-- ===
|
||||
-- Colorscheme
|
||||
-- ===
|
||||
vim.cmd('colorscheme dracula')
|
||||
-- ===
|
||||
|
|
106
lua/settings.lua
106
lua/settings.lua
|
@ -2,8 +2,21 @@ HOME = os.getenv("HOME")
|
|||
|
||||
vim.opt.compatible = false
|
||||
|
||||
if string.match(vim.opt.shell["_value"], 'fish$') then
|
||||
if vim.fn.executable('zsh') then
|
||||
vim.opt.shell = "zsh"
|
||||
vim.g.replacement_shell = "zsh"
|
||||
elseif vim.fn.executable('bash') then
|
||||
vim.opt.shell = "bash"
|
||||
vim.g.replacement_shell = "bash"
|
||||
else
|
||||
vim.opt.shell = "sh"
|
||||
vim.g.replacement_shell = "sh"
|
||||
end
|
||||
end
|
||||
|
||||
-- ===
|
||||
-- Platform specific settings. Configure your platform in iniinitlua, in the platform dir.
|
||||
-- Platform specific settings. Configure your platform in init.lua, in the platform dir.
|
||||
-- ===
|
||||
if vim.g.platform == "linux" then
|
||||
-- vim.cmd('autocmd VimLeave * set guicursor=a:ver35-blinkon0')
|
||||
|
@ -24,13 +37,19 @@ if vim.g.platform == "linux" then
|
|||
else
|
||||
vim.opt.termguicolors = false
|
||||
|
||||
vim.cmd('autocmd ColorScheme dracula hi Visual cterm=reverse')
|
||||
--vim.api.nvim_create_autocmd('ColorScheme', {
|
||||
--pattern = 'themer_dracula',
|
||||
--command = 'hi Visual cterm=reverse',
|
||||
--})
|
||||
end
|
||||
elseif vim.g.platform == "xterm" then
|
||||
vim.opt.termguicolors = false
|
||||
vim.opt.guicursor = ""
|
||||
vim.opt.t_Co = ""
|
||||
vim.cmd('autocmd ColorScheme dracula hi Visual cterm=reverse')
|
||||
--vim.api.nvim_create_autocmd('ColorScheme', {
|
||||
--pattern = 'themer_dracula',
|
||||
--command = 'hi Visual cterm=reverse',
|
||||
--})
|
||||
else
|
||||
vim.opt.termguicolors = true
|
||||
end
|
||||
|
@ -38,6 +57,27 @@ end
|
|||
vim.env.NVIM_TUI_ENABLE_TRUE_COLOR = 1
|
||||
-- ===
|
||||
|
||||
-- ===
|
||||
-- Deacivate termguicolors on entering the terminal to display the colors correctly
|
||||
-- ===
|
||||
vim.api.nvim_create_autocmd('TermEnter', {
|
||||
pattern = '*',
|
||||
callback = function()
|
||||
vim.opt.termguicolors = false
|
||||
end,
|
||||
})
|
||||
vim.api.nvim_create_autocmd('TermLeave', {
|
||||
pattern = '*',
|
||||
callback = function()
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
if vim.g.replacement_shell ~= nil and vim.fn.executable(vim.g.replacement_shell) then
|
||||
vim.opt.shell = vim.g.replacement_shell
|
||||
end
|
||||
end,
|
||||
})
|
||||
-- ===
|
||||
|
||||
-- ===
|
||||
-- Choose the mapleaders, in my case the spacebar.
|
||||
-- ===
|
||||
|
@ -65,6 +105,7 @@ vim.opt.backspace = { "indent", "eol", "start" }
|
|||
vim.opt.breakindent = true
|
||||
vim.opt.breakindentopt = "shift:4"
|
||||
vim.opt.clipboard = "unnamedplus"
|
||||
vim.opt.completeopt = { "menu", "menuone", "noselect" }
|
||||
vim.opt.confirm = true
|
||||
vim.opt.diffopt = { "filler", "vertical" }
|
||||
vim.opt.expandtab = true
|
||||
|
@ -102,7 +143,7 @@ local config = {
|
|||
|
||||
use_airline = false,
|
||||
use_alt_colorschemes = true,
|
||||
use_arm_syntax = false,
|
||||
use_arm_syntax = true,
|
||||
use_asciidoctor = true,
|
||||
use_asm_indent = true,
|
||||
use_async = true,
|
||||
|
@ -113,9 +154,11 @@ local config = {
|
|||
use_coc = false,
|
||||
use_comfortable_motion = false,
|
||||
use_cpp = true,
|
||||
use_fish = true,
|
||||
use_font = false,
|
||||
use_fswitch = true,
|
||||
use_fugitive = true,
|
||||
use_gas = true,
|
||||
use_indentguides = false,
|
||||
use_javacomplete = false,
|
||||
use_latexmk = false,
|
||||
|
@ -141,7 +184,7 @@ local config = {
|
|||
}
|
||||
|
||||
for key, value in pairs(config) do
|
||||
if not vim.g[key] then
|
||||
if vim.g[key] == nil then
|
||||
vim.g[key] = value
|
||||
end
|
||||
end
|
||||
|
@ -167,32 +210,51 @@ end
|
|||
-- ===
|
||||
-- arm-assembly
|
||||
-- ===
|
||||
vim.cmd([[
|
||||
function! SetupArm()
|
||||
execute('set filetype=arm')
|
||||
endfunction
|
||||
|
||||
au BufNewFile,BufRead *.s,*.S call SetupArm() " arm = armv6/7
|
||||
]])
|
||||
-- vim.cmd([[
|
||||
-- function! SetupArm()
|
||||
-- execute('set filetype=arm')
|
||||
-- endfunction
|
||||
--
|
||||
-- au BufNewFile,BufRead *.s,*.S call SetupArm() " arm = armv6/7
|
||||
-- ]])
|
||||
--
|
||||
-- Use
|
||||
-- @ vim:ft=armv5 at top/bottom of assembly file instead
|
||||
-- ===
|
||||
-- GNU assembly, use
|
||||
-- /* vim: ft=gas :
|
||||
-- */
|
||||
--
|
||||
-- at end of file
|
||||
-- ===
|
||||
|
||||
-- ===
|
||||
-- When to use 'normal' tabs
|
||||
-- ===
|
||||
vim.cmd([[
|
||||
autocmd FileType make setlocal noexpandtab
|
||||
autocmd FileType Makefile setlocal noexpandtab
|
||||
]])
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = { 'make', 'Makefile' },
|
||||
callback = function()
|
||||
vim.opt_local.expandtab = false
|
||||
end,
|
||||
})
|
||||
-- ===
|
||||
|
||||
-- ===
|
||||
-- Don't schow relative numbers in insert mode, but show them in normal mode
|
||||
-- ===
|
||||
vim.cmd([[
|
||||
autocmd BufWinEnter,BufEnter,FocusGained,InsertLeave * set relativenumber
|
||||
autocmd BufWinLeave,BufLeave,FocusLost,InsertEnter * set norelativenumber
|
||||
]])
|
||||
vim.api.nvim_create_autocmd({'BufWinEnter', 'BufEnter', 'FocusGained', 'InsertLeave' }, {
|
||||
pattern = '*',
|
||||
callback = function()
|
||||
vim.opt.relativenumber = true
|
||||
end,
|
||||
})
|
||||
vim.api.nvim_create_autocmd({'BufWinLeave', 'BufLeave', 'FocusLost', 'InsertEnter' }, {
|
||||
pattern = '*',
|
||||
callback = function()
|
||||
vim.opt.relativenumber = false
|
||||
end,
|
||||
})
|
||||
-- ===
|
||||
|
||||
--vim.cmd("hi LineNr guifg=#B0BEC5")
|
||||
--vim.cmd("hi CursorLineNr guifg=#64FFDA")
|
||||
-- vim.cmd("hi LineNr guifg=#B0BEC5")
|
||||
-- vim.cmd("hi CursorLineNr guifg=#64FFDA")
|
||||
|
|
|
@ -130,3 +130,42 @@ if vim.g.use_cpp == true then
|
|||
]])
|
||||
end
|
||||
-- ===
|
||||
|
||||
-- ===
|
||||
-- Function to show current syntax highlight groups
|
||||
-- ===
|
||||
vim.cmd([[
|
||||
function! SynGroup()
|
||||
let l:s = synID(line('.'), col('.'), 1)
|
||||
|
||||
echo synIDattr(l:s, 'name') . ' -> ' . synIDattr(synIDtrans(l:s), 'name')
|
||||
endfunction
|
||||
|
||||
command! SynGroup :call SynGroup()
|
||||
|
||||
function! SynStack()
|
||||
if !exists("*synstack")
|
||||
return
|
||||
endif
|
||||
|
||||
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
|
||||
endfunction
|
||||
|
||||
command! SynStack :call SynStack()
|
||||
]])
|
||||
-- ===
|
||||
|
||||
-- ===
|
||||
-- Switch to fish shell in :term
|
||||
-- ===
|
||||
vim.cmd([[
|
||||
function! FishTerm()
|
||||
if exists("g:replacement_shell")
|
||||
let &shell = "fish"
|
||||
execute "term"
|
||||
let &shell = g:replacement_shell
|
||||
endif
|
||||
endfunction
|
||||
|
||||
command! FishTerm :call FishTerm()
|
||||
]])
|
||||
|
|
Loading…
Reference in New Issue