init
This commit is contained in:
commit
b3dba4542f
44 changed files with 1596 additions and 0 deletions
4
home/.config/nvim/init.lua
Normal file
4
home/.config/nvim/init.lua
Normal file
|
@ -0,0 +1,4 @@
|
|||
require("plugins")
|
||||
require("options")
|
||||
require("keymaps")
|
||||
require("lsp")
|
63
home/.config/nvim/lua/keymaps.lua
Normal file
63
home/.config/nvim/lua/keymaps.lua
Normal file
|
@ -0,0 +1,63 @@
|
|||
local map = vim.keymap.set
|
||||
|
||||
map('n', '<leader>ff', require('telescope.builtin').find_files, { desc = "Find files" })
|
||||
map('n', '<leader>fg', require('telescope.builtin').live_grep, { desc = "Live grep" })
|
||||
map('n', '<leader>fb', require('telescope.builtin').buffers, { desc = "Buffers" })
|
||||
map('n', '<leader>fh', require('telescope.builtin').help_tags, { desc = "Help tags" })
|
||||
|
||||
-- Project-specific ignored dirs for Telescope
|
||||
local function load_local_ignore()
|
||||
local cwd = vim.fn.getcwd()
|
||||
local config_path = cwd .. "/.nvim.lua"
|
||||
if vim.fn.filereadable(config_path) == 1 then
|
||||
local ok, config = pcall(dofile, config_path)
|
||||
if ok and config.fzf_ignore_dirs then
|
||||
return config.fzf_ignore_dirs
|
||||
end
|
||||
end
|
||||
return {}
|
||||
end
|
||||
|
||||
local ignored = load_local_ignore()
|
||||
local ignore_patterns = vim.tbl_map(function(d) return "**/" .. d .. "/*" end, ignored)
|
||||
|
||||
require('telescope').setup {
|
||||
defaults = {
|
||||
file_ignore_patterns = ignore_patterns,
|
||||
}
|
||||
}
|
||||
|
||||
-- za: Telescope open in current tab
|
||||
vim.keymap.set('n', 'za', function()
|
||||
require("telescope.builtin").find_files()
|
||||
end, { desc = "Telescope: open file in current tab" })
|
||||
|
||||
-- zt: Telescope open in new tab
|
||||
vim.keymap.set('n', 'zt', function()
|
||||
require("telescope.builtin").find_files({
|
||||
attach_mappings = function(_, map)
|
||||
map("i", "<CR>", function(prompt_bufnr)
|
||||
local actions = require("telescope.actions")
|
||||
local action_state = require("telescope.actions.state")
|
||||
local entry = action_state.get_selected_entry()
|
||||
actions.close(prompt_bufnr)
|
||||
vim.cmd("tabedit " .. entry.value)
|
||||
end)
|
||||
return true
|
||||
end,
|
||||
})
|
||||
end, { desc = "Telescope: open file in new tab" })
|
||||
|
||||
-- FZF
|
||||
|
||||
vim.keymap.set('n', 'zs', ':FZF<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_create_user_command('FZFInTab', function()
|
||||
vim.fn['fzf#run'](vim.fn['fzf#wrap']({
|
||||
sink = function(selected)
|
||||
vim.cmd('tabedit ' .. selected)
|
||||
end
|
||||
}))
|
||||
end, {})
|
||||
|
||||
vim.keymap.set('n', 'zy', ':FZFInTab<CR>', { noremap = true, silent = true })
|
||||
|
43
home/.config/nvim/lua/lsp.lua
Normal file
43
home/.config/nvim/lua/lsp.lua
Normal file
|
@ -0,0 +1,43 @@
|
|||
local lspconfig = require("lspconfig")
|
||||
|
||||
-- Swift LSP
|
||||
lspconfig.sourcekit.setup {}
|
||||
|
||||
-- Go LSP
|
||||
lspconfig.gopls.setup {
|
||||
cmd = { "gopls" },
|
||||
filetypes = { "go", "gomod" },
|
||||
root_dir = lspconfig.util.root_pattern("go.mod", ".git"),
|
||||
settings = {
|
||||
gopls = {
|
||||
analyses = { unusedparams = true },
|
||||
staticcheck = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Completion
|
||||
local cmp = require("cmp")
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
vim.fn["vsnip#anonymous"](args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<Tab>"] = cmp.mapping.select_next_item(),
|
||||
["<S-Tab>"] = cmp.mapping.select_prev_item(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "vsnip" },
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
})
|
||||
})
|
||||
|
||||
-- Syntastic config
|
||||
vim.g.syntastic_swift_checkers = { 'swiftlint', 'swiftpm' }
|
||||
|
22
home/.config/nvim/lua/options.lua
Normal file
22
home/.config/nvim/lua/options.lua
Normal file
|
@ -0,0 +1,22 @@
|
|||
vim.opt.tabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.number = true
|
||||
vim.opt.encoding = "utf-8"
|
||||
|
||||
vim.opt.list = true
|
||||
vim.opt.listchars = {
|
||||
eol = '¬',
|
||||
tab = '>·',
|
||||
trail = '~',
|
||||
extends = '>',
|
||||
precedes = '<',
|
||||
space = '␣',
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd("InsertLeave", {
|
||||
pattern = "*",
|
||||
command = "silent! write"
|
||||
})
|
||||
|
57
home/.config/nvim/lua/plugins.lua
Normal file
57
home/.config/nvim/lua/plugins.lua
Normal file
|
@ -0,0 +1,57 @@
|
|||
-- bootstrap lazy.nvim
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("lazy").setup({
|
||||
-- Core
|
||||
{ "nvim-lua/plenary.nvim" },
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
tag = "0.1.5",
|
||||
lazy = false
|
||||
},
|
||||
|
||||
-- LSP and Autocomplete
|
||||
{ "neovim/nvim-lspconfig" },
|
||||
{ "hrsh7th/nvim-cmp" },
|
||||
{ "hrsh7th/cmp-nvim-lsp" },
|
||||
{ "hrsh7th/cmp-buffer" },
|
||||
{ "hrsh7th/cmp-path" },
|
||||
{ "hrsh7th/cmp-cmdline" },
|
||||
{ "hrsh7th/cmp-vsnip" },
|
||||
{ "hrsh7th/vim-vsnip" },
|
||||
|
||||
-- Treesitter
|
||||
{ "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" },
|
||||
|
||||
-- Appearance
|
||||
{ "tomasiser/vim-code-dark" },
|
||||
{ "vim-airline/vim-airline" },
|
||||
{ "vim-airline/vim-airline-themes" },
|
||||
|
||||
-- File Explorer / Git / Misc
|
||||
{ "preservim/nerdtree" },
|
||||
{ "tpope/vim-fugitive" },
|
||||
{ "rust-lang/rust.vim" },
|
||||
{ "ray-x/go.nvim" },
|
||||
{ "vim-syntastic/syntastic" },
|
||||
{ "tokorom/syntastic-swiftlint.vim" },
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "LazyDone",
|
||||
callback = function()
|
||||
vim.cmd("colorscheme codedark")
|
||||
end,
|
||||
})
|
8
home/.gnupg/gpg-agent.conf
Normal file
8
home/.gnupg/gpg-agent.conf
Normal file
|
@ -0,0 +1,8 @@
|
|||
# restarting an agent
|
||||
# gpgconf --kill gpg-agent
|
||||
# gpgconf --launch gpg-agent
|
||||
|
||||
|
||||
default-cache-ttl 1209600
|
||||
max-cache-ttl 1209600
|
||||
|
5
home/.local/bin/index
Executable file
5
home/.local/bin/index
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require 'storage'
|
||||
|
||||
puts Storage.get_mounting_point("FBB4EC0E-2D2E-4EEE-AB16-8C1265D5F3EF")
|
Loading…
Add table
Add a link
Reference in a new issue