Skip to content

Commit

Permalink
backup vima
Browse files Browse the repository at this point in the history
  • Loading branch information
aminfara committed Oct 9, 2024
1 parent 077053e commit cc4f9a5
Show file tree
Hide file tree
Showing 28 changed files with 338 additions and 1,175 deletions.
8 changes: 0 additions & 8 deletions vima-old/README.md

This file was deleted.

5 changes: 5 additions & 0 deletions vima-old/init.lua
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
local present, _ = pcall(require, 'impatient')
if not present then
require('vima.utils').notify_missing('impatient')
end

require('vima.core')
require('vima.plugins')
17 changes: 0 additions & 17 deletions vima-old/lua/vima/Languages/init.lua

This file was deleted.

60 changes: 0 additions & 60 deletions vima-old/lua/vima/Languages/lua.lua

This file was deleted.

83 changes: 45 additions & 38 deletions vima-old/lua/vima/core.lua
Original file line number Diff line number Diff line change
@@ -1,63 +1,70 @@
-- Core configuration
--------------------------------------------------------------------------------

local opt = vim.opt
local map = vim.keymap.set

opt.autowriteall = true
opt.backup = false
opt.clipboard = 'unnamedplus'
opt.cmdheight = 2
opt.colorcolumn = '120'
opt.completeopt = { 'menuone', 'preview' }
opt.cursorline = true
opt.expandtab = true
opt.fileencoding = 'utf-8'
opt.fillchars = { eob = ' ' }
opt.foldenable = false
opt.foldmethod = 'syntax'
opt.hidden = true
opt.hlsearch = true
opt.ignorecase = true
opt.iskeyword:append('-')
opt.list = true
opt.listchars = 'tab:⇥ ,trail:·'
opt.mouse = 'a'
opt.number = true
opt.pumheight = 15
opt.relativenumber = true
opt.scrolloff = 5
opt.shiftround = true
opt.shiftwidth = 2
opt.shortmess:append('cI')
opt.showmode = false
opt.showtabline = 2
opt.sidescrolloff = 10
opt.signcolumn = 'yes'
opt.smartcase = true
opt.smartindent = true
opt.splitbelow = true
opt.splitright = true
opt.swapfile = false
opt.switchbuf = 'useopen,usetab,newtab'
opt.tabstop = 2
opt.termguicolors = true
opt.timeoutlen = 300
opt.title = true
opt.tabstop = 4
opt.timeout = true
opt.timeoutlen = 1000
opt.undofile = true
opt.undolevels = 2000
opt.updatetime = 300
opt.visualbell = true
opt.whichwrap:append('<>[]hl')
opt.wildignore = 'build,.svn,CVS,.git,.hg,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif,*.pyc'
opt.wildmode = 'longest,full'
opt.wrap = false
opt.writebackup = false

-- Core mappings
--------------------------------------------------------------------------------
if not vim.g.vscode then
opt.cmdheight = 2
opt.colorcolumn = '120'
opt.completeopt = { 'menuone', 'noselect' }
opt.conceallevel = 0
opt.cursorline = true
opt.fillchars = { eob = ' ' }
opt.foldenable = false
opt.foldmethod = 'syntax'
opt.list = true
opt.listchars = 'tab:⇥ ,trail:·'
opt.mouse = 'a'
opt.number = true
opt.numberwidth = 3
opt.pumheight = 10
opt.relativenumber = true
opt.ruler = true
opt.scrolloff = 5
opt.shortmess:append('cI')
opt.showmode = false
opt.showtabline = 2
opt.sidescrolloff = 10
opt.signcolumn = 'yes'
opt.switchbuf = 'useopen,usetab,newtab'
opt.termguicolors = true
opt.title = true
opt.wildignore = 'build,.svn,CVS,.git,.hg,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif,*.pyc'
opt.wildmode = 'longest,full'
end

-- disable bundled plugins
vim.g.loaded_matchit = 1

local map = require('vima.utils').map
map("i", "jj", "<Esc>")
map("i", "jk", "<Esc>")

-- Space as leader key
vim.g.mapleader = ' '
map('', '<Space>', '<NOP>')
map("v", "<", "<gv")
map("v", ">", ">gv")

-- Insert mode mappings
map('i', 'jk', '<Esc>')
map({ 'n', 'v' }, "c", '"_c')
map({ 'n', 'v' }, "d", '"_d')
25 changes: 0 additions & 25 deletions vima-old/lua/vima/plugins/autopairs.lua

This file was deleted.

24 changes: 19 additions & 5 deletions vima-old/lua/vima/plugins/colorscheme.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
if vim.g.vscode then
return
end

vim.g.base16colorspace = 256

local status_ok, _ = pcall(vim.cmd, 'source $HOME/.vimrc_background')
if status_ok then
return
end
local base16_theme = 'base16-' .. (vim.env.BASE16_THEME or 'default-dark')

status_ok, _ = pcall(vim.cmd, 'colorscheme base16-default-dark')
status_ok, _ = pcall(vim.cmd, 'colorscheme ' .. base16_theme)
if not status_ok then
vim.notify('Failed to load base16 colorscheme.')
return
end

-- https://github.com/RRethy/nvim-base16/issues/32 fix telescope borders
vim.cmd([[highlight! link TelescopeSelection Visual]])
vim.cmd([[highlight! link TelescopeNormal Normal]])
vim.cmd([[highlight! link TelescopePromptNormal TelescopeNormal]])
vim.cmd([[highlight! link TelescopeBorder TelescopeNormal]])
vim.cmd([[highlight! link TelescopePromptBorder TelescopeBorder]])
vim.cmd([[highlight! link TelescopeTitle TelescopeBorder]])
vim.cmd([[highlight! link TelescopePromptTitle TelescopeTitle]])
vim.cmd([[highlight! link TelescopeResultsTitle TelescopeTitle]])
vim.cmd([[highlight! link TelescopePreviewTitle TelescopeTitle]])
vim.cmd([[highlight! link TelescopePromptPrefix Identifier]])
51 changes: 16 additions & 35 deletions vima-old/lua/vima/plugins/comment.lua
Original file line number Diff line number Diff line change
@@ -1,40 +1,21 @@
local status_ok, comment = pcall(require, 'Comment')
if not status_ok then
vim.notify('Failed to load Comment.nvim.')
return
local present, comment = pcall(require, 'Comment')
if not present then
require('vima.utils').notify_missing('Comment.nvim')
return
end

local status_ok, ts_context_commentstring = pcall(require, 'ts_context_commentstring')
if not status_ok then
vim.notify('Failed to load tree sitter comment string.')
return
local present, ts_context_commentstring = pcall(require, 'ts_context_commentstring')
if not present then
require('vima.utils').notify_missing('nvim_ts_context_commentstring')
return
end

-- TODO: fix whichkey
-- TODO: Consider using ts_context_commentstring for all languages?

comment.setup({
---@param ctx Ctx
pre_hook = function(ctx)
-- Only calculate commentstring for tsx filetypes
if vim.bo.filetype == 'typescriptreact' then
local U = require('Comment.utils')

-- Detemine whether to use linewise or blockwise commentstring
local type = ctx.ctype == U.ctype.line and '__default' or '__multiline'

-- Determine the location where to calculate commentstring from
local location = nil
if ctx.ctype == U.ctype.block then
location = require('ts_context_commentstring.utils').get_cursor_location()
elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then
location = require('ts_context_commentstring.utils').get_visual_start_location()
end

return require('ts_context_commentstring.internal').calculate_commentstring({
key = type,
location = location,
})
end
end,
require('Comment').setup({
mappings = {
---Operator-pending mapping; `gcc` `gbc` `gc[count]{motion}` `gb[count]{motion}`
basic = true,
---Extra mapping; `gco`, `gcO`, `gcA`
extra = true,
},
pre_hook = require('ts_context_commentstring.integrations.comment_nvim').create_pre_hook(),
})
Loading

0 comments on commit cc4f9a5

Please sign in to comment.