Add tmux config
This commit is contained in:
67
.tmux.conf
Normal file
67
.tmux.conf
Normal file
@@ -0,0 +1,67 @@
|
||||
unbind -a
|
||||
|
||||
set -g default-terminal tmux
|
||||
set-option -sa terminal-features ',xterm:RGB'
|
||||
|
||||
set-window-option -g mode-keys vi
|
||||
|
||||
# bind to C-a
|
||||
set-option -g prefix C-a
|
||||
bind-key C-a send-prefix
|
||||
# switch panels
|
||||
# switch panes using Alt-arrow without prefix
|
||||
#bind-key -T prefix C-a switch-client -T prefix_ca
|
||||
bind-key -T prefix c new-window
|
||||
bind-key -T prefix h previous-window
|
||||
bind-key -T prefix l next-window
|
||||
bind-key -T prefix 0 select-window -t :0
|
||||
bind-key -T prefix 1 select-window -t :1
|
||||
bind-key -T prefix 2 select-window -t :2
|
||||
bind-key -T prefix 3 select-window -t :3
|
||||
bind-key -T prefix 4 select-window -t :4
|
||||
bind-key -T prefix 5 select-window -t :5
|
||||
bind-key -T prefix 6 select-window -t :6
|
||||
bind-key -T prefix 7 select-window -t :7
|
||||
bind-key -T prefix 8 select-window -t :8
|
||||
bind-key -T prefix 9 select-window -t :9
|
||||
# vi keybindings
|
||||
bind-key -T prefix '[' copy-mode
|
||||
bind-key -T copy-mode-vi 'v' send -X begin-selection
|
||||
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
|
||||
bind-key -T prefix p paste-buffer
|
||||
#bind-key -T prefix S-h swap-window -t -1
|
||||
#bind-key -T prefix S-l swap-window -t +1
|
||||
# other
|
||||
# loud or quiet?
|
||||
set -g visual-activity off
|
||||
set -g visual-bell off
|
||||
set -g visual-silence off
|
||||
setw -g monitor-activity off
|
||||
set -g bell-action none
|
||||
|
||||
# modes
|
||||
setw -g clock-mode-colour colour5
|
||||
setw -g mode-style 'fg=colour1 bg=colour18 bold'
|
||||
|
||||
# panes
|
||||
set -g pane-border-style 'fg=colour19 bg=colour0'
|
||||
set -g pane-active-border-style 'bg=colour0 fg=colour9'
|
||||
# statusbar
|
||||
set -g status-position bottom
|
||||
set -g status-justify left
|
||||
set -g status-style 'bg=colour18 fg=colour137 dim'
|
||||
set -g status-left ''
|
||||
set -g status-right '#[fg=colour233,bg=colour19] %d/%m #[fg=colour233,bg=colour8] %H:%M:%S '
|
||||
set -g status-right-length 50
|
||||
set -g status-left-length 20
|
||||
|
||||
setw -g window-status-current-style 'fg=colour1 bg=colour19 bold'
|
||||
setw -g window-status-current-format ' #I#[fg=colour249]:#[fg=colour255]#W#[fg=colour249]#F '
|
||||
|
||||
setw -g window-status-style 'fg=colour9 bg=colour18'
|
||||
setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '
|
||||
|
||||
setw -g window-status-bell-style 'fg=colour255 bg=colour1 bold'
|
||||
|
||||
# messages
|
||||
set -g message-style 'fg=colour232 bg=colour16 bold'
|
||||
519
init.lua
519
init.lua
@@ -1,234 +1,285 @@
|
||||
|
||||
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",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
vim.g.mapleader = "\\" -- Make sure to set `mapleader` before lazy so your mappings are correct
|
||||
|
||||
|
||||
require("lazy").setup({
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
init = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 300
|
||||
end,
|
||||
opts = {
|
||||
theme = "onedark",
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
},
|
||||
},
|
||||
{
|
||||
"folke/neoconf.nvim",
|
||||
cmd = "Neoconf"
|
||||
},
|
||||
"folke/neodev.nvim",
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
tag = '0.1.3',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
},
|
||||
"ludovicchabant/vim-gutentags",
|
||||
"flazz/vim-colorschemes",
|
||||
"neovim/nvim-lspconfig",
|
||||
{
|
||||
"nvim-telescope/telescope-file-browser.nvim",
|
||||
dependencies = { "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" }
|
||||
},
|
||||
"neovim/nvim-lspconfig",
|
||||
--"kien/ctrlp.vim",
|
||||
{
|
||||
"ray-x/go.nvim",
|
||||
dependencies = { -- optional packages
|
||||
"ray-x/guihua.lua",
|
||||
"neovim/nvim-lspconfig",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
},
|
||||
config = function()
|
||||
require("go").setup()
|
||||
end,
|
||||
event = {"CmdlineEnter"},
|
||||
ft = {"go", 'gomod'},
|
||||
build = ':lua require("go.install").update_all_sync()' -- if you need to install/update all binaries
|
||||
},
|
||||
"navarasu/onedark.nvim",
|
||||
"deoplete-plugins/deoplete-clang",
|
||||
"neovim/nvim-lsp",
|
||||
"robert-oleynik/clangd-nvim",
|
||||
"tpope/vim-surround",
|
||||
"scrooloose/nerdcommenter",
|
||||
})
|
||||
|
||||
require("telescope").setup {
|
||||
extensions = {
|
||||
file_browser = {
|
||||
theme = "onedark",
|
||||
-- disables netrw and use telescope-file-browser in its place
|
||||
hijack_netrw = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
-- require("telescope").setup({
|
||||
-- extensions = {
|
||||
-- lazy = {
|
||||
-- -- Optional theme (the extension doesn't set a default theme)
|
||||
-- theme = "ivy",
|
||||
-- -- Whether or not to show the icon in the first column
|
||||
-- show_icon = true,
|
||||
-- -- Mappings for the actions
|
||||
-- mappings = {
|
||||
-- open_in_browser = "<C-o>",
|
||||
-- open_in_file_browser = "<leader>nn",
|
||||
-- open_in_find_files = "<leader>f",
|
||||
-- open_in_live_grep = "<C-g>",
|
||||
-- open_plugins_picker = "<C-b>", -- Works only after having called first another action
|
||||
-- open_lazy_root_find_files = "<C-r>f",
|
||||
-- open_lazy_root_live_grep = "<C-r>g",
|
||||
-- },
|
||||
-- -- Other telescope configuration options
|
||||
-- },
|
||||
-- file_browser = {},
|
||||
-- },
|
||||
-- })
|
||||
|
||||
|
||||
local builtin = require('telescope.builtin')
|
||||
local file_browser = require('telescope').extensions.file_browser.file_browser
|
||||
vim.keymap.set('n', '<leader>f', builtin.find_files, {})
|
||||
vim.keymap.set('n', '<leader>g', builtin.live_grep, {})
|
||||
vim.keymap.set('n', '<leader>b', builtin.buffers, {})
|
||||
vim.keymap.set('n', '<leader>h', builtin.help_tags, {})
|
||||
vim.keymap.set('n', '<leader>n', ":Telescope file_browser path=%:p:h select_buffer=true<CR>", {})
|
||||
--vim.keymap.set('n', '<leader>n', file_browser, {})
|
||||
--vim.keymap.set('n', '<leader>c', ":CtrlPTag<CR>", {})
|
||||
--vim.keymap.set('n', 'gd', ":tag <C-r><C-w><CR>", {})
|
||||
--vim.keymap.set('n', 'gD', ":tselect <C-r><C-w>", {})
|
||||
|
||||
-- Setup language servers.
|
||||
require('lspconfig').pyright.setup({ theme = "onedark" })
|
||||
--require('lspconfig').jedi_language_server.setup{}
|
||||
--local lspconfig = require('lspconfig')
|
||||
|
||||
|
||||
-- Global mappings.
|
||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float)
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist)
|
||||
|
||||
-- Use LspAttach autocommand to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
|
||||
callback = function(ev)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
|
||||
vim.keymap.set('i', '<C-p>', vim.lsp.omnifunc, {})
|
||||
|
||||
-- Buffer local mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local opts = { buffer = ev.buf }
|
||||
--vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
||||
--vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
|
||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
|
||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, opts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
|
||||
vim.keymap.set('n', '<space>f', function()
|
||||
vim.lsp.buf.format { async = true }
|
||||
end, opts)
|
||||
end,
|
||||
})
|
||||
|
||||
require("lspconfig").gopls.setup({ theme = "onedark" })
|
||||
|
||||
local format_sync_grp = vim.api.nvim_create_augroup("GoFormat", {})
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
pattern = "*.go",
|
||||
callback = function()
|
||||
require('go.format').gofmt()
|
||||
end,
|
||||
group = format_sync_grp,
|
||||
})
|
||||
|
||||
--local clangd_nvim = require('clangd_nvim')
|
||||
|
||||
--require('nvim_lsp').clangd.setup{
|
||||
--capabilities = {
|
||||
--textDocument = {
|
||||
--semanticHighlightingCapabilities = {
|
||||
--semanticHighlighting = true
|
||||
--}
|
||||
--}
|
||||
--},
|
||||
--on_init = clangd_nvim.on_init
|
||||
--}
|
||||
|
||||
local set = vim.opt
|
||||
|
||||
-- start of my own options
|
||||
-- color schemes
|
||||
vim.colorscheme = "onedark"
|
||||
-- spellcheck
|
||||
vim.cmd "setlocal spell spelllang=en_us"
|
||||
vim.cmd "hi clear SpellBad"
|
||||
vim.cmd "hi SpellBad cterm=underline"
|
||||
-- show line on insert mode
|
||||
vim.cmd "autocmd InsertEnter * set cursorline"
|
||||
vim.cmd "autocmd InsertLeave * set nocursorline"
|
||||
set.ttimeout = true
|
||||
set.ttimeoutlen = 1
|
||||
set.ttyfast = true
|
||||
-- basics
|
||||
set.number = true
|
||||
set.tabstop = 4
|
||||
set.shiftwidth = 4
|
||||
set.expandtab = true
|
||||
-- instant search
|
||||
set.incsearch = true
|
||||
set.hlsearch = true
|
||||
-- case insensitive searching
|
||||
-- need both of the following for smartcase to work
|
||||
set.ignorecase = true
|
||||
set.smartcase = true
|
||||
-- autoindent works weirdly sometimes
|
||||
-- set.autoindent = true
|
||||
vim.keymap.set("n", "gtl", ":tabn<cr>")
|
||||
vim.keymap.set("n", "gth", ":tabp<cr>")
|
||||
vim.keymap.set("n", "gt0", ":tabfirst<cr>")
|
||||
vim.keymap.set("n", "gb", ":bprevious<cr>")
|
||||
-- move tabs with gt<S-motion>
|
||||
vim.keymap.set("n", "gtL", ":execute 'silent! tabmove ' . tabpagenr()<cr>")
|
||||
vim.keymap.set("n", "gtH", ":execute 'silent! tabmove ' . (tabpagenr()-2)<cr>")
|
||||
-- new tab
|
||||
vim.keymap.set("n", "gtn", ":tabedit<cr>")
|
||||
-- switch windows using g<movement> rather than <C-W><movement>
|
||||
vim.keymap.set("n", "gwh", "<C-W>h")
|
||||
vim.keymap.set("n", "gwl", "<C-W>l")
|
||||
vim.keymap.set("n", "gwj", "<C-W>j")
|
||||
vim.keymap.set("n", "gwk", "<C-W>k")
|
||||
-- tags
|
||||
vim.keymap.set("n", "<leader>c", ":tjump")
|
||||
-- scroll before hitting edge of screen
|
||||
set.scrolloff = 6
|
||||
|
||||
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",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
vim.g.mapleader = "\\" -- Make sure to set `mapleader` before lazy so your mappings are correct
|
||||
vim.cmd("let g:python3_host_prog = $HOME . '/venv/default/bin/python'")
|
||||
|
||||
require("lazy").setup({
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
init = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 300
|
||||
end,
|
||||
opts = {
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
},
|
||||
},
|
||||
{ "folke/neoconf.nvim", cmd = "Neoconf" },
|
||||
"folke/neodev.nvim",
|
||||
{
|
||||
'nvim-telescope/telescope.nvim', tag = '0.1.3',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' }
|
||||
},
|
||||
"ludovicchabant/vim-gutentags",
|
||||
"flazz/vim-colorschemes",
|
||||
"neovim/nvim-lspconfig",
|
||||
{
|
||||
"nvim-telescope/telescope-file-browser.nvim",
|
||||
dependencies = { "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" }
|
||||
},
|
||||
"neovim/nvim-lspconfig",
|
||||
--"kien/ctrlp.vim",
|
||||
{
|
||||
"ray-x/go.nvim",
|
||||
dependencies = { -- optional packages
|
||||
"ray-x/guihua.lua",
|
||||
"neovim/nvim-lspconfig",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
},
|
||||
config = function()
|
||||
require("go").setup()
|
||||
end,
|
||||
event = {"CmdlineEnter"},
|
||||
ft = {"go", 'gomod'},
|
||||
build = ':lua require("go.install").update_all_sync()' -- if you need to install/update all binaries
|
||||
},
|
||||
--"navarasu/onedark.nvim",
|
||||
"tpope/vim-surround",
|
||||
"scrooloose/nerdcommenter",
|
||||
{ "folke/tokyonight.nvim", priority = 1000 },
|
||||
{
|
||||
"ray-x/go.nvim",
|
||||
dependencies = { -- optional packages
|
||||
"ray-x/guihua.lua",
|
||||
"neovim/nvim-lspconfig",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
},
|
||||
config = function()
|
||||
require("go").setup()
|
||||
end,
|
||||
event = {"CmdlineEnter"},
|
||||
ft = {"go", 'gomod'},
|
||||
build = ':lua require("go.install").update_all_sync()' -- if you need to install/update all binaries
|
||||
},
|
||||
--"averms/black-nvim",
|
||||
})
|
||||
|
||||
-- color schemes
|
||||
require("tokyonight")
|
||||
--require("tokyonight").setup({})
|
||||
vim.o.background = "dark"
|
||||
vim.cmd("colorscheme tokyonight-night")
|
||||
|
||||
|
||||
require("telescope").setup {
|
||||
extensions = {
|
||||
file_browser = {
|
||||
--theme = "onedark",
|
||||
-- disables netrw and use telescope-file-browser in its place
|
||||
hijack_netrw = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
-- require("telescope").setup({
|
||||
-- extensions = {
|
||||
-- lazy = {
|
||||
-- -- Optional theme (the extension doesn't set a default theme)
|
||||
-- theme = "ivy",
|
||||
-- -- Whether or not to show the icon in the first column
|
||||
-- show_icon = true,
|
||||
-- -- Mappings for the actions
|
||||
-- mappings = {
|
||||
-- open_in_browser = "<C-o>",
|
||||
-- open_in_file_browser = "<leader>nn",
|
||||
-- open_in_find_files = "<leader>f",
|
||||
-- open_in_live_grep = "<C-g>",
|
||||
-- open_plugins_picker = "<C-b>", -- Works only after having called first another action
|
||||
-- open_lazy_root_find_files = "<C-r>f",
|
||||
-- open_lazy_root_live_grep = "<C-r>g",
|
||||
-- },
|
||||
-- -- Other telescope configuration options
|
||||
-- },
|
||||
-- file_browser = {},
|
||||
-- },
|
||||
-- })
|
||||
|
||||
|
||||
local builtin = require('telescope.builtin')
|
||||
local mytags = function()
|
||||
-- this should always exist because of gutentags
|
||||
local tagspath = vim.fn.getcwd() .. "/tags"
|
||||
return builtin.tags({ ctags_file = tagspath })
|
||||
end
|
||||
local file_browser = require('telescope').extensions.file_browser.file_browser
|
||||
local myfilebrowser = function()
|
||||
local opts = { path = "%:p:h", select_buffer = true }
|
||||
return file_browser(opts)
|
||||
end
|
||||
vim.keymap.set('n', '<leader>f', builtin.find_files, {})
|
||||
vim.keymap.set('n', '<leader>g', builtin.live_grep, {})
|
||||
vim.keymap.set('n', '<leader>b', builtin.buffers, {})
|
||||
vim.keymap.set('n', '<leader>h', builtin.help_tags, {})
|
||||
vim.keymap.set('n', '<leader>c', mytags, {})
|
||||
vim.keymap.set('n', '<leader>n', myfilebrowser, {})
|
||||
--vim.keymap.set('n', '<leader>n', file_browser, {})
|
||||
--vim.keymap.set('n', '<leader>c', ":CtrlPTag<CR>", {})
|
||||
--vim.keymap.set('n', 'gd', ":tag <C-r><C-w><CR>", {})
|
||||
--vim.keymap.set('n', 'gD', ":tselect <C-r><C-w>", {})
|
||||
|
||||
-- Setup language servers.
|
||||
require('lspconfig').pyright.setup{
|
||||
theme = "tokyonight-night"
|
||||
}
|
||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
pattern = "*.py",
|
||||
callback = function(ev)
|
||||
local cwd = vim.fn.getcwd()
|
||||
local filepath = cwd .. "/" .. ev.file
|
||||
local isort_cmd = 'python -m isort "' .. filepath .. '" --profile=black'
|
||||
local black_cmd = 'python -m black "' .. filepath .. '"'
|
||||
--print(isort_cmd)
|
||||
vim.fn.system(isort_cmd)
|
||||
--print(black_cmd)
|
||||
vim.fn.system(black_cmd)
|
||||
vim.cmd "e"
|
||||
end,
|
||||
--group = format_sync_grp,
|
||||
})
|
||||
|
||||
local format_sync_grp = vim.api.nvim_create_augroup("GoFormat", {})
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
pattern = "*.go",
|
||||
callback = function()
|
||||
require('go.format').goimport()
|
||||
end,
|
||||
group = format_sync_grp,
|
||||
})
|
||||
require("go").setup{}
|
||||
require("lspconfig").gopls.setup{}
|
||||
|
||||
|
||||
-- Global mappings.
|
||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float)
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist)
|
||||
|
||||
-- Use LspAttach autocommand to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
|
||||
callback = function(ev)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
|
||||
vim.keymap.set('i', '<C-p>', vim.lsp.omnifunc, {})
|
||||
|
||||
-- Buffer local mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local opts = { buffer = ev.buf }
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
|
||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
|
||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, opts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
|
||||
vim.keymap.set('n', '<space>f', function()
|
||||
vim.lsp.buf.format { async = true }
|
||||
end, opts)
|
||||
end,
|
||||
})
|
||||
|
||||
-- start of my own options
|
||||
-- spellcheck
|
||||
vim.cmd "setlocal spell spelllang=en_us"
|
||||
vim.cmd "hi clear SpellBad"
|
||||
vim.cmd "hi SpellBad cterm=underline"
|
||||
-- show line on insert mode
|
||||
vim.cmd "autocmd InsertEnter * set cursorline"
|
||||
vim.cmd "autocmd InsertLeave * set nocursorline"
|
||||
|
||||
local set = vim.opt
|
||||
set.ttimeout = true
|
||||
set.ttimeoutlen = 1
|
||||
set.ttyfast = true
|
||||
-- basics
|
||||
set.number = true
|
||||
set.tabstop = 4
|
||||
set.softtabstop = 4
|
||||
set.shiftwidth = 4
|
||||
set.expandtab = true
|
||||
-- instant search
|
||||
set.incsearch = true
|
||||
set.hlsearch = true
|
||||
-- case insensitive searching
|
||||
-- need both of the following for smartcase to work
|
||||
set.ignorecase = true
|
||||
set.smartcase = true
|
||||
-- avoid frustrations
|
||||
set.autoread = true
|
||||
-- autoindent works weirdly sometimes
|
||||
-- set.autoindent = true
|
||||
vim.keymap.set("n", "gtl", ":tabn<cr>")
|
||||
vim.keymap.set("n", "gth", ":tabp<cr>")
|
||||
vim.keymap.set("n", "gt0", ":tabfirst<cr>")
|
||||
-- move tabs with gt<S-motion>
|
||||
vim.keymap.set("n", "gtL", ":execute 'silent! tabmove ' . tabpagenr()<cr>")
|
||||
vim.keymap.set("n", "gtH", ":execute 'silent! tabmove ' . (tabpagenr()-2)<cr>")
|
||||
-- new tab
|
||||
vim.keymap.set("n", "gtn", ":tabedit<cr>")
|
||||
-- previous tab
|
||||
vim.keymap.set("n", "gb", ":bprevious<cr>")
|
||||
-- switch windows using g<movement> rather than <C-W><movement>
|
||||
vim.keymap.set("n", "gwh", "<C-W>h")
|
||||
vim.keymap.set("n", "gwl", "<C-W>l")
|
||||
vim.keymap.set("n", "gwj", "<C-W>j")
|
||||
vim.keymap.set("n", "gwk", "<C-W>k")
|
||||
-- tags
|
||||
--vim.keymap.set("n", "<leader>c", ":lt ")
|
||||
|
||||
--local deltagsoffile = function(file)
|
||||
--local cwd = vim.fn.getcwd()
|
||||
--local tagpath = cwd .. "/tags"
|
||||
--local frelative = vim.fn.substitute(file, cwd .. "/", "", "")
|
||||
--frelative = vim.fn.escape(frelative, "./")
|
||||
--local cmd = 'sed -i "/' .. frelative .. '/d" "' .. tagpath .. '"'
|
||||
--vim.fn.system(cmd)
|
||||
--end
|
||||
|
||||
--vim.api.nvim_create_autocmd(
|
||||
--{"BufWritePost"},
|
||||
--{
|
||||
--pattern = {"*.py", "*.go"},
|
||||
--callback = function(ev)
|
||||
----print(string.format('event fired: %s', vim.inspect(ev)))
|
||||
--local f = ev.file
|
||||
--deltagsoffile(f)
|
||||
--local tagpath = vim.fn.getcwd() .. "/tags"
|
||||
--local cmd = 'ctags -a -f "' .. tagpath .. '" "' .. f .. '"'
|
||||
--vim.fn.system(cmd)
|
||||
--end
|
||||
--}
|
||||
--)
|
||||
|
||||
Reference in New Issue
Block a user