Finally get autocompletion up and running, update everything and correct mistakes. Switch to nvim_create_autocommand
This commit is contained in:
parent
424a3a58af
commit
535aa5c2c7
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')
|
||||
|
|
|
@ -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
|
||||
-- ===
|
||||
|
|
219
lua/plugins.lua
219
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
|
||||
|
@ -169,35 +168,199 @@ 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,
|
||||
}
|
||||
lspconfig.rust_analyzer.setup {}
|
||||
end
|
||||
},
|
||||
}
|
||||
|
||||
use {
|
||||
{
|
||||
'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,
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
'hrsh7th/nvim-cmp',
|
||||
after = {
|
||||
'cmp-nvim-lsp',
|
||||
'cmp-buffer',
|
||||
'cmp-path',
|
||||
'cmp-cmdline',
|
||||
'cmp-git',
|
||||
'cmp_luasnip',
|
||||
},
|
||||
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 = 'buffer' },
|
||||
})
|
||||
}
|
||||
|
||||
-- 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' },
|
||||
})
|
||||
})
|
||||
|
||||
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' }
|
||||
}
|
||||
})
|
||||
|
||||
-- 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' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
})
|
||||
})
|
||||
|
||||
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
|
||||
-- ===
|
||||
|
@ -272,7 +435,9 @@ 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
|
||||
-- ===
|
||||
|
||||
|
|
|
@ -1,50 +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')
|
||||
-- Themer takes care of this
|
||||
-- ===
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
if string.match(vim.opt.shell["_value"], 'fish$') then
|
||||
if vim.fn.executable('zsh') then
|
||||
vim.opt.shell = "zsh"
|
||||
elseif vim.fn.executable('bash') then
|
||||
vim.opt.shell = "bash"
|
||||
else
|
||||
vim.opt.shell = "sh"
|
||||
end
|
||||
end
|
||||
|
||||
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 init.lua, in the platform dir.
|
||||
-- ===
|
||||
|
@ -34,13 +37,19 @@ if vim.g.platform == "linux" then
|
|||
else
|
||||
vim.opt.termguicolors = false
|
||||
|
||||
vim.cmd('autocmd ColorScheme themer_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 themer_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
|
||||
|
@ -51,10 +60,22 @@ vim.env.NVIM_TUI_ENABLE_TRUE_COLOR = 1
|
|||
-- ===
|
||||
-- Deacivate termguicolors on entering the terminal to display the colors correctly
|
||||
-- ===
|
||||
vim.cmd([[
|
||||
autocmd TermEnter * set notermguicolors
|
||||
autocmd TermLeave * set termguicolors
|
||||
]])
|
||||
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,
|
||||
})
|
||||
-- ===
|
||||
|
||||
-- ===
|
||||
|
@ -84,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
|
||||
|
@ -209,20 +231,30 @@ end
|
|||
-- ===
|
||||
-- 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")
|
||||
|
|
|
@ -154,3 +154,18 @@ vim.cmd([[
|
|||
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