added tab support for split line
This commit is contained in:
@@ -2,10 +2,12 @@ local keymap = {
|
|||||||
leader_key = ';',
|
leader_key = ';',
|
||||||
|
|
||||||
-- Normal mode --------------------------------------------------------------------------------------
|
-- Normal mode --------------------------------------------------------------------------------------
|
||||||
telescope_search_for_files_in_working_directory = '<Space>d',
|
telescope_search_for_files_in_working_directory = '<space>d',
|
||||||
telescope_search_for_previously_opened_files = '<Space><Space>',
|
telescope_search_for_previously_opened_files = '<space><space>',
|
||||||
telescope_live_grep = '<Space>g',
|
telescope_live_grep = '<space>g',
|
||||||
telescope_search_help_pages = '<Space>h',
|
telescope_search_help_pages = '<space>h',
|
||||||
|
telescope_search_current_buffer = '<space>j',
|
||||||
|
telescope_search_buffers = '<space>o',
|
||||||
|
|
||||||
lsp_rename_symbol = '<leader>rn',
|
lsp_rename_symbol = '<leader>rn',
|
||||||
lsp_code_action = '<leader>ca',
|
lsp_code_action = '<leader>ca',
|
||||||
@@ -50,12 +52,12 @@ local keymap = {
|
|||||||
|
|
||||||
}
|
}
|
||||||
local TAB_WIDTH = 4
|
local TAB_WIDTH = 4
|
||||||
|
local EXPAND_TAB = false
|
||||||
|
|
||||||
---@type installed_themes
|
---@type installed_themes
|
||||||
local colorscheme = 'slate'
|
--local colorscheme = 'slate'
|
||||||
|
local colorscheme = 'gruvbox'
|
||||||
|
|
||||||
vim.o.termguicolors = true
|
|
||||||
vim.cmd('colorscheme ' .. colorscheme)
|
|
||||||
|
|
||||||
vim.cmd [[ autocmd VimEnter * NoMatchParen ]]
|
vim.cmd [[ autocmd VimEnter * NoMatchParen ]]
|
||||||
vim.g.mapleader = keymap.leader_key
|
vim.g.mapleader = keymap.leader_key
|
||||||
@@ -66,7 +68,7 @@ vim.opt.rnu = true -- Shows relative line numbers
|
|||||||
vim.opt.nu = true-- Shows current line number
|
vim.opt.nu = true-- Shows current line number
|
||||||
vim.opt.wrap = false-- Don't wrap the line. Let it go offscreen.
|
vim.opt.wrap = false-- Don't wrap the line. Let it go offscreen.
|
||||||
vim.opt.shiftround = true
|
vim.opt.shiftround = true
|
||||||
vim.opt.expandtab = true
|
vim.opt.expandtab = EXPAND_TAB
|
||||||
vim.opt.hlsearch = false-- Don't highlight searches
|
vim.opt.hlsearch = false-- Don't highlight searches
|
||||||
vim.opt.incsearch = true-- Highlight matching patterns as the you are typing it.
|
vim.opt.incsearch = true-- Highlight matching patterns as the you are typing it.
|
||||||
vim.opt.scrolloff = 8-- Always keep 8 lines of code between the cursor and the top/bottom of the screen.
|
vim.opt.scrolloff = 8-- Always keep 8 lines of code between the cursor and the top/bottom of the screen.
|
||||||
@@ -146,10 +148,15 @@ local function packer_startup(use)
|
|||||||
use 'mfussenegger/nvim-dap-python' -- follow instructions or start venv before starting nvim.
|
use 'mfussenegger/nvim-dap-python' -- follow instructions or start venv before starting nvim.
|
||||||
use 'theHamsta/nvim-dap-virtual-text'
|
use 'theHamsta/nvim-dap-virtual-text'
|
||||||
|
|
||||||
|
use "ellisonleao/gruvbox.nvim"
|
||||||
|
|
||||||
if packer_bootstrap then --Comes after packages
|
if packer_bootstrap then --Comes after packages
|
||||||
require('packer').sync()
|
require('packer').sync()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- set colors after packer, because colorscheme might be installed
|
||||||
|
vim.o.termguicolors = true
|
||||||
|
vim.cmd('colorscheme ' .. colorscheme)
|
||||||
|
|
||||||
vim.g.loaded_netrw = 1-- Disables some built in plugin
|
vim.g.loaded_netrw = 1-- Disables some built in plugin
|
||||||
vim.g.loaded_netrwPlugin = 1--Disables some built in plugin
|
vim.g.loaded_netrwPlugin = 1--Disables some built in plugin
|
||||||
@@ -218,7 +225,6 @@ local function packer_startup(use)
|
|||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
'clangd',
|
'clangd',
|
||||||
'kotlin_language_server',
|
'kotlin_language_server',
|
||||||
'csharp_ls',
|
|
||||||
'ltex',
|
'ltex',
|
||||||
'lua_ls',
|
'lua_ls',
|
||||||
'marksman',
|
'marksman',
|
||||||
@@ -234,20 +240,27 @@ local function packer_startup(use)
|
|||||||
capabilities = capabilities
|
capabilities = capabilities
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
--Lua.workspace.checkThirdParty
|
|
||||||
lua_ls = function()
|
lua_ls = function()
|
||||||
require("neodev").setup{} -- load the neovim api
|
require("neodev").setup{} -- load the neovim api
|
||||||
require("lspconfig").lua_ls.setup {
|
require("lspconfig").lua_ls.setup {
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
runtime = { version = 'LuaJIT' },
|
runtime = {
|
||||||
workspace = { checkThirdParty = true },
|
version = 'LuaJIT',
|
||||||
|
},
|
||||||
|
workspace = {
|
||||||
|
checkThirdParty = true,
|
||||||
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
-- * `Lua.runtime.special`: set the property `love.filesystem.load` to `"loadfile"`;
|
||||||
|
-- * `Lua.workspace.library`: add element `"${3rd}/love2d/library"` ;
|
||||||
|
|
||||||
require("lspconfig").gdscript.setup{
|
require("lspconfig").gdscript.setup{
|
||||||
capabilities = capabilities
|
capabilities = capabilities
|
||||||
}
|
}
|
||||||
@@ -268,6 +281,8 @@ local function packer_startup(use)
|
|||||||
vim.keymap.set('n', keymap.telescope_search_for_previously_opened_files, builtin.oldfiles, {})
|
vim.keymap.set('n', keymap.telescope_search_for_previously_opened_files, builtin.oldfiles, {})
|
||||||
vim.keymap.set('n', keymap.telescope_live_grep, builtin.live_grep, {})
|
vim.keymap.set('n', keymap.telescope_live_grep, builtin.live_grep, {})
|
||||||
vim.keymap.set('n', keymap.telescope_search_help_pages, builtin.help_tags, {})
|
vim.keymap.set('n', keymap.telescope_search_help_pages, builtin.help_tags, {})
|
||||||
|
vim.keymap.set('n', keymap.telescope_search_current_buffer, builtin.current_buffer_fuzzy_find, {})
|
||||||
|
vim.keymap.set('n', keymap.telescope_search_buffers, builtin.buffers, {})
|
||||||
|
|
||||||
|
|
||||||
local dap = require'dap'
|
local dap = require'dap'
|
||||||
@@ -413,15 +428,19 @@ end
|
|||||||
---Then formats all comma separated items within that bracket scope, and splits the line into multiple.
|
---Then formats all comma separated items within that bracket scope, and splits the line into multiple.
|
||||||
---The function is aware for strings starting with ' or ", and keeps track of how deeply nested it is
|
---The function is aware for strings starting with ' or ", and keeps track of how deeply nested it is
|
||||||
---in the brackets.
|
---in the brackets.
|
||||||
---The function will properly indent all the lines, but only uses spaces to do so.
|
---The function will properly indent all the lines, taking into consideration the TAB_WHITESPACE and EXPAND_TAB constants.
|
||||||
---It is currently tied to this init.lua file by a couple of variables. Might become a separate package at some point.
|
---It is currently tied to this init.lua file by a couple of variables. Might become a separate package at some point.
|
||||||
---@type function
|
---@type function
|
||||||
local split_line
|
local split_line
|
||||||
do
|
do
|
||||||
local TAB_WHITESPACE = ' '
|
local TAB_WHITESPACE = ' '
|
||||||
|
if EXPAND_TAB then
|
||||||
|
print("expandtab is ACTIVE")
|
||||||
|
TAB_WHITESPACE = ''
|
||||||
for _ = 1, TAB_WIDTH do
|
for _ = 1, TAB_WIDTH do
|
||||||
TAB_WHITESPACE = TAB_WHITESPACE .. ' '
|
TAB_WHITESPACE = TAB_WHITESPACE .. ' '
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local get_closing_bracket = function(char)
|
local get_closing_bracket = function(char)
|
||||||
if char == '(' then return ')' end
|
if char == '(' then return ')' end
|
||||||
@@ -582,3 +601,4 @@ return require('packer').startup(packer_startup)
|
|||||||
---| 'slate'
|
---| 'slate'
|
||||||
---| 'torte'
|
---| 'torte'
|
||||||
---| 'zellner'
|
---| 'zellner'
|
||||||
|
---| 'gruvbox'
|
||||||
|
|||||||
Reference in New Issue
Block a user