Track lunarvim config

This commit is contained in:
Asocia
2022-01-25 20:19:51 +03:00
parent c37a30b9f8
commit 44ee0f6985
11 changed files with 560 additions and 0 deletions

View File

@ -0,0 +1,62 @@
-- keymappings [view all the defaults by pressing <leader>Lk]
lvim.leader = 'space'
-- add your own keymapping
lvim.keys.normal_mode['<C-s>'] = ':w<cr>'
-- unmap a default keymapping
-- lvim.keys.normal_mode["<C-Up>"] = ""
-- edit a default keymapping
-- lvim.keys.normal_mode["<C-q>"] = ":q<cr>"
-- Change Telescope navigation to use j and k for navigation and n and p for history in both input and normal mode.
-- we use protected-mode (pcall) just in case the plugin wasn't loaded yet.
-- local _, actions = pcall(require, "telescope.actions")
-- lvim.builtin.telescope.defaults.mappings = {
-- -- for input mode
-- i = {
-- ["<C-j>"] = actions.move_selection_next,
-- ["<C-k>"] = actions.move_selection_previous,
-- ["<C-n>"] = actions.cycle_history_next,
-- ["<C-p>"] = actions.cycle_history_prev,
-- },
-- -- for normal mode
-- n = {
-- ["<C-j>"] = actions.move_selection_next,
-- ["<C-k>"] = actions.move_selection_previous,
-- },
-- }
-- use the default vim behavior for H and L
lvim.keys.normal_mode['<S-l>'] = nil
lvim.keys.normal_mode['<S-h>'] = nil
-- When text is wrapped, move by terminal rows, not lines, unless a count is provided
vim.api.nvim_set_keymap('n', 'j', '(v:count == 0 ? "gj" : "j")',
{noremap = true, expr = true, silent = true})
vim.api.nvim_set_keymap('n', 'k', '(v:count == 0 ? "gk" : "k")',
{noremap = true, expr = true, silent = true})
-- move around *visually*
-- make Y consistent with other capitals
lvim.keys.normal_mode['Y'] = 'y$'
-- easy align
lvim.keys.normal_mode['ga'] = ':EasyAlign<CR>'
lvim.keys.visual_mode['ga'] = ':EasyAlign<CR>'
-- Maintain the cursor position when yanking a visual selection
-- http://ddrscott.github.io/blog/2016/yank-without-jank/
lvim.keys.visual_mode['y'] = 'myy`y'
lvim.keys.visual_mode['Y'] = ' myY`y'
-- make . to work with visually selected lines
lvim.keys.visual_mode['.'] = ':normal . <CR>'
-- insert mode mappings
lvim.keys.insert_mode['<C-a>'] = '<C-o>^'
lvim.keys.insert_mode['<C-e>'] = '<C-o>$'
lvim.keys.insert_mode['<C-f>'] = '<C-o>w'
lvim.keys.insert_mode['<C-b>'] = '<C-o>b'
lvim.keys.insert_mode['<C-k>'] = '<C-o>d$'
lvim.keys.insert_mode['<C-u>'] = '<C-o>d^'
lvim.keys.insert_mode['<C-s>'] = '<c-g>u<Esc>[s1z=`]a<c-g>u'

View File

@ -0,0 +1,9 @@
require('autosave').setup({
enabled = vim.g.auto_save,
-- execution_message = 'autosaved at : ' .. vim.fn.strftime('%H:%M:%S'),
-- events = {'InsertLeave', 'TextChanged'},
-- conditions = {exists = true, filetype_is_not = {}, modifiable = true},
write_all_buffers = true,
on_off_commands = true,
clean_command_line_interval = 2500
})

View File

@ -0,0 +1,14 @@
lvim.builtin.dashboard.active = true
-- lvim.builtin.dashboard.custom_header = {
-- ' _______ _____ ',
-- ' ___ |__Welcome back, _________(_)______ _ ',
-- ' __ /| |__ ___/_ __ \\_ ___/__ / _ __ `/ ',
-- ' _ ___ |_(__ ) / /_/ // /__ _ / / /_/ / ',
-- ' /_/ |_|/____/ \\____/ \\___/ /_/ \\__,_/ '
-- }
lvim.builtin.dashboard.custom_header = {}
vim.g.dashboard_preview_command = 'cat'
vim.g.dashboard_preview_pipeline = 'lolcat -F 0.2'
vim.g.dashboard_preview_file = '~/.config/Asocia/splash'
vim.g.dashboard_preview_file_height = 10
vim.g.dashboard_preview_file_width = 45

View File

@ -0,0 +1,40 @@
local dial = require 'dial'
vim.cmd [[
nmap <C-a> <Plug>(dial-increment)
nmap <C-x> <Plug>(dial-decrement)
vmap <C-a> <Plug>(dial-increment)
vmap <C-x> <Plug>(dial-decrement)
vmap g<C-a> <Plug>(dial-increment-additional)
vmap g<C-x> <Plug>(dial-decrement-additional)
]]
dial.augends['custom#boolean'] = dial.common.enum_cyclic {
name = 'boolean',
strlist = {'true', 'false'}
}
table.insert(dial.config.searchlist.normal, 'custom#boolean')
-- For Languages which prefer True/False, e.g. python.
dial.augends['custom#Boolean'] = dial.common.enum_cyclic {
name = 'Boolean',
strlist = {'True', 'False'}
}
table.insert(dial.config.searchlist.normal, 'custom#Boolean')
dial.augends['custom#directions'] = dial.common.enum_cyclic {
name = 'directions',
strlist = {'left', 'right', 'top', 'bottom'}
}
table.insert(dial.config.searchlist.normal, 'custom#directions')
dial.augends['custom#yesno'] = dial.common.enum_cyclic {
name = 'yesno',
strlist = {'yes', 'no'}
}
table.insert(dial.config.searchlist.normal, 'custom#yesno')
dial.augends['custom#YesNo'] = dial.common.enum_cyclic {
name = 'YesNo',
strlist = {'Yes', 'No'}
}
table.insert(dial.config.searchlist.normal, 'custom#YesNo')

View File

@ -0,0 +1,8 @@
require('indent_blankline').setup {
indent_blankline_char = '',
indent_blankline_filetype_exclude = {'help', 'terminal', 'dashboard'},
indent_blankline_buftype_exclude = {'terminal'},
indent_blankline_show_trailing_blankline_indent = false,
indent_blankline_show_first_indent_level = false
}

View File

@ -0,0 +1,65 @@
lvim.builtin.which_key.mappings['<tab>'] = {'<C-^>', 'alternate file'}
lvim.builtin.which_key.mappings['\\'] = {':vnew<CR>', 'vsplit'}
lvim.builtin.which_key.mappings['-'] = {':new<CR>', 'hsplit'}
-- hop mappings
lvim.builtin.which_key.mappings['w'] = {':HopWord<CR>', 'Hop word'}
lvim.builtin.which_key.mappings['j'] = {':HopLineStartAC<CR>', 'Hop line'}
lvim.builtin.which_key.mappings['k'] = {':HopLineStartBC<CR>', 'Hop line'}
lvim.builtin.which_key.mappings['r'] = {
':set invrelativenumber<CR>', 'Toggle relative number'
}
lvim.builtin.which_key.mappings['i'] = {':SymbolsOutline<CR>', 'Index view'}
lvim.builtin.which_key.mappings['P'] = {
'<cmd>Telescope projects<CR>', 'Projects'
}
lvim.builtin.which_key.mappings['S'] = {
name = 'Session',
c = {
'<cmd>lua require(\'persistence\').load()<cr>',
'Restore last session for current dir'
},
l = {
'<cmd>lua require(\'persistence\').load({ last = true })<cr>',
'Restore last session'
},
Q = {
'<cmd>lua require(\'persistence\').stop()<cr>',
'Quit without saving session'
}
}
lvim.builtin.which_key.mappings['d'] = {
-- " Available Debug Adapters:
-- " https://microsoft.github.io/debug-adapter-protocol/implementors/adapters/
-- " Adapter configuration and installation instructions:
-- " https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation
-- " Debug Adapter protocol:
-- " https://microsoft.github.io/debug-adapter-protocol/
-- " Debugging
name = 'Debug',
e = {':call vimspector#Reset()<cr>', 'exit debug mode'},
l = {':call vimspector#StepInto()<cr>', 'step into'},
j = {':call vimspector#StepOver()<cr>', 'step over'},
h = {':call vimspector#StepOut()<cr>', 'step out'},
k = {':call vimspector#Restart()<cr>', 'restart debugging'},
c = {':call vimspector#Continue()<cr>', 'continue'},
r = {':call vimspector#RunToCursor()<cr>', 'run to cursor'},
d = {':call vimspector#Launch()<cr>', 'Launch'},
b = {':call vimspector#ToggleBreakpoint()<cr>', 'toggle breakpoint'},
B = {'<Plug>VimspectorToggleConditionalBreakpoint', 'toggle breakpoint'},
C = {':call vimspector#ClearBreakpoints()<cr>', 'clear breakpoints'},
i = {'<Plug>VimspectorBalloonEval', 'inspect'}
}
-- lvim.builtin.which_key.mappings['t'] = {
-- name = '+Trouble',
-- r = {'<cmd>Trouble lsp_references<cr>', 'References'},
-- f = {'<cmd>Trouble lsp_definitions<cr>', 'Definitions'},
-- d = {'<cmd>Trouble lsp_document_diagnostics<cr>', 'Diagnostics'},
-- q = {'<cmd>Trouble quickfix<cr>', 'QuickFix'},
-- l = {'<cmd>Trouble loclist<cr>', 'LocationList'},
-- w = {'<cmd>Trouble lsp_workspace_diagnostics<cr>', 'Diagnostics'}
-- }

View File

@ -0,0 +1,45 @@
vim.g.markdown_fenced_languages = {'html', 'python', 'ruby', 'vim', 'bash'}
vim.opt.relativenumber = true
vim.opt.backup = true -- creates a backup file
vim.opt.backupdir = os.getenv('HOME') .. '/.cache/nvim/backup'
vim.opt.hlsearch = false -- highlight all matches on previous search pattern
vim.opt.wrap = true -- display lines as one long line
vim.opt.conceallevel = 1 -- so that `` is visible in markdown files
vim.opt.scrolloff = 8 -- how many lines should be visible while scrolling (for context)
vim.opt.spelllang = 'en,tr'
-- vim.opt.spell = false
-- vim.opt.clipboard = "unnamedplus" -- allows neovim to access the system clipboard
-- vim.opt.cmdheight = 2 -- more space in the neovim command line for displaying messages
-- vim.opt.colorcolumn = "99999" -- fixes indentline for now
-- vim.opt.completeopt = { "menuone", "noselect" }
-- vim.opt.fileencoding = "utf-8" -- the encoding written to a file
-- vim.opt.foldmethod = "manual" -- folding set to "expr" for treesitter based folding
-- vim.opt.foldexpr = "" -- set to "nvim_treesitter#foldexpr()" for treesitter based folding
-- vim.opt.guifont = "monospace:h17" -- the font used in graphical neovim applications
-- vim.opt.hidden = true -- required to keep multiple buffers and open multiple buffers
-- vim.opt.ignorecase = true -- ignore case in search patterns
-- vim.opt.mouse = "a" -- allow the mouse to be used in neovim
-- vim.opt.pumheight = 10 -- pop up menu height
-- vim.opt.showmode = false -- we don't need to see things like -- INSERT -- anymore
vim.opt.showtabline = 2 -- always show tabs
-- vim.opt.smartcase = true -- smart case
-- vim.opt.smartindent = true -- make indenting smarter again
-- vim.opt.splitbelow = true -- force all horizontal splits to go below current window
-- vim.opt.splitright = true -- force all vertical splits to go to the right of current window
-- vim.opt.swapfile = false -- creates a swapfile
-- vim.opt.termguicolors = true -- set term gui colors (most terminals support this)
-- vim.opt.timeoutlen = 100 -- time to wait for a mapped sequence to complete (in milliseconds)
-- vim.opt.title = true -- set the title of window to the value of the titlestring
-- opt.titlestring = "%<%F%=%l/%L - nvim" -- what the title of the window will be set to
-- vim.opt.undodir = utils.join_paths(get_cache_dir() "undo") -- set an undo directory
-- vim.opt.undofile = true -- enable persistent undo
-- vim.opt.updatetime = 300 -- faster completion
vim.opt.writebackup = false -- if a file is being edited by another program (or was written to file while editing with another program) it is not allowed to be edited
-- vim.opt.expandtab = true -- convert tabs to spaces
-- vim.opt.shiftwidth = 2 -- the number of spaces inserted for each indentation
-- vim.opt.tabstop = 2 -- insert 2 spaces for a tab
-- vim.opt.cursorline = true -- highlight the current line
-- vim.opt.number = true -- set numbered lines
-- vim.opt.numberwidth = 4 -- set number column width to 2 {default 4}
-- vim.opt.signcolumn = "yes" -- always show the sign column otherwise it would shift the text each time
vim.opt.sidescrolloff = 8