weekend nerding
This commit is contained in:
parent
63bb8c0fc8
commit
1decc32c5d
4
init.lua
4
init.lua
|
|
@ -1,3 +1,7 @@
|
||||||
|
-- Load leaders before any plugins
|
||||||
|
vim.g.mapleader = ' '
|
||||||
|
vim.g.maplocalleader = ' '
|
||||||
|
|
||||||
require("config.options")
|
require("config.options")
|
||||||
require("config.keymaps")
|
require("config.keymaps")
|
||||||
require("config.autocmds")
|
require("config.autocmds")
|
||||||
|
|
|
||||||
|
|
@ -5,4 +5,4 @@ vim.api.nvim_create_autocmd('TextYankPost', {
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.hl.on_yank()
|
vim.hl.on_yank()
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,6 @@ map('i', 'jk', '<Esc>', { desc = 'Exit insert mode' })
|
||||||
-- Clear highlights on search when pressing <C-c> in normal mode
|
-- Clear highlights on search when pressing <C-c> in normal mode
|
||||||
-- See `:help hlsearch`
|
-- See `:help hlsearch`
|
||||||
map('n', '<C-c>', '<cmd>nohlsearch<CR>')
|
map('n', '<C-c>', '<cmd>nohlsearch<CR>')
|
||||||
map('n', '<leader>z', function()
|
|
||||||
print("hey")
|
|
||||||
end, { desc = "Print hey" })
|
|
||||||
|
|
||||||
-- Keybinds to make split navigation easier.
|
-- Keybinds to make split navigation easier.
|
||||||
-- Use CTRL+<hjkl> to switch between windows
|
-- Use CTRL+<hjkl> to switch between windows
|
||||||
|
|
@ -18,5 +15,13 @@ map('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|
||||||
|
|
||||||
-- open Oil
|
-- open Oil
|
||||||
map("n", "-", "<CMD>Oil<CR>", { desc = "Open parent directory" } )
|
map("n", "-", "<CMD>Oil<CR>", { desc = "Open parent directory" } )
|
||||||
|
|
||||||
-- Change current dir
|
-- Change current dir
|
||||||
map("n", "<leader>cc", "<cmd>cd %:p:h<CR>", { desc = "Change current dir to a current buffer" })
|
map("n", "<leader>cc", "<cmd>cd %:p:h<CR>", { desc = "Change current dir to a current buffer" })
|
||||||
|
|
||||||
|
map("n", "<leader>vt", function()
|
||||||
|
vim.cmd.new()
|
||||||
|
vim.cmd.term()
|
||||||
|
vim.cmd.wincmd("J")
|
||||||
|
vim.api.nvim_win_set_height(0, 15)
|
||||||
|
end)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
vim.g.mapleader = ' '
|
|
||||||
vim.g.maplocalleader = ' '
|
|
||||||
vim.g.have_nerd_font = true
|
vim.g.have_nerd_font = true
|
||||||
vim.opt.guifont='FiraCode Nerd Font'
|
|
||||||
-- Make line numbers default
|
-- Make line numbers default
|
||||||
vim.opt.number = true
|
vim.opt.number = true
|
||||||
|
|
||||||
|
|
@ -55,3 +54,4 @@ vim.opt.tabstop = 2
|
||||||
vim.opt.shiftwidth = 2
|
vim.opt.shiftwidth = 2
|
||||||
|
|
||||||
vim.opt.virtualedit = "block"
|
vim.opt.virtualedit = "block"
|
||||||
|
vim.opt.shell = "powershell.exe"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
return { -- Let lsp recognize vim functions
|
||||||
|
"folke/lazydev.nvim",
|
||||||
|
ft = "lua", -- only load on lua files
|
||||||
|
opts = {
|
||||||
|
library = {
|
||||||
|
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,83 @@
|
||||||
|
return {
|
||||||
|
-- Main LSP Configuration
|
||||||
|
'neovim/nvim-lspconfig',
|
||||||
|
dependencies = {
|
||||||
|
-- Automatically install LSPs and related tools to stdpath for Neovim
|
||||||
|
-- Mason must be loaded before its dependents so we need to set it up here.
|
||||||
|
-- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
|
||||||
|
{ 'mason-org/mason.nvim', opts = {} },
|
||||||
|
'mason-org/mason-lspconfig.nvim',
|
||||||
|
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
||||||
|
|
||||||
|
-- Useful status updates for LSP.
|
||||||
|
{ 'j-hui/fidget.nvim', opts = {} },
|
||||||
|
|
||||||
|
-- Allows extra capabilities provided by blink.cmp
|
||||||
|
'saghen/blink.cmp',
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
|
||||||
|
-- Autocommand to define keymaps when a buffer attaches to lsp server
|
||||||
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
|
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
|
||||||
|
callback = function(event)
|
||||||
|
local map = function(keys, func, desc, mode)
|
||||||
|
mode = mode or 'n'
|
||||||
|
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Rename the variable under your cursor.
|
||||||
|
map('grn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||||
|
|
||||||
|
-- Find references for the word under your cursor.
|
||||||
|
map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||||
|
|
||||||
|
-- Jump to the implementation of the word under your cursor.
|
||||||
|
map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
|
||||||
|
|
||||||
|
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
||||||
|
-- For example, in C this would take you to the header.
|
||||||
|
map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||||
|
|
||||||
|
-- Fuzzy find all the symbols in your current document.
|
||||||
|
-- Symbols are things like variables, functions, types, etc.
|
||||||
|
map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols')
|
||||||
|
|
||||||
|
-- Fuzzy find all the symbols in your current workspace.
|
||||||
|
-- Similar to document symbols, except searches over your entire project.
|
||||||
|
map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols')
|
||||||
|
|
||||||
|
-- Jump to the type of the word under your cursor.
|
||||||
|
-- Useful when you're not sure what type a variable is and you want to see
|
||||||
|
map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definiton')
|
||||||
|
|
||||||
|
-- predefine client supports method
|
||||||
|
-- leaving it here in case I want to use it
|
||||||
|
---@param client vim.lsp.Client
|
||||||
|
---@param method vim.lsp.protocol.Method
|
||||||
|
---@param bufnr? integer some lsp support methods only in specific files
|
||||||
|
---@return boolean
|
||||||
|
local function client_supports_method(client, method, bufnr)
|
||||||
|
return client:supports_method(method, bufnr)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Diagnostic Options
|
||||||
|
vim.diagnostic.config {
|
||||||
|
severity_sort = true,
|
||||||
|
float = { border = 'rounded', source = 'if_many' },
|
||||||
|
underline = { severity = vim.diagnostic.severity.ERROR },
|
||||||
|
}
|
||||||
|
|
||||||
|
require('mason-tool-installer').setup {
|
||||||
|
ensure_installed = {
|
||||||
|
'lua-language-server',
|
||||||
|
'python-lsp-server',
|
||||||
|
'stylua',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
require("mason-lspconfig").setup()
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
@ -10,58 +10,34 @@ return {
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
'nvim-treesitter/nvim-treesitter',
|
'nvim-treesitter/nvim-treesitter',
|
||||||
build = ':TSUpdate',
|
build = ':TSUpdate',
|
||||||
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
|
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
|
||||||
opts = {
|
opts = {
|
||||||
ensure_installed = { 'c', 'lua', 'vim', 'vimdoc', 'query', 'python' },
|
ensure_installed = { 'c', 'lua', 'vim', 'vimdoc', 'query', 'python' },
|
||||||
-- Autoinstall languages that are not installed
|
-- Autoinstall languages that are not installed
|
||||||
auto_install = true,
|
auto_install = true,
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true
|
enable = true
|
||||||
},
|
},
|
||||||
indent = { enable = true, disable = { 'ruby' } },
|
indent = { enable = true, disable = { 'ruby' } },
|
||||||
incremental_selection = {
|
incremental_selection = {
|
||||||
enable = true,
|
enable = true,
|
||||||
keymaps = {
|
keymaps = {
|
||||||
init_selection = 'gnn',
|
init_selection = 'gnn',
|
||||||
node_incremental = 'grn',
|
node_incremental = 'grn',
|
||||||
scope_incremental = 'grc',
|
scope_incremental = 'grc',
|
||||||
node_decremental = 'grm',
|
node_decremental = 'grm',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
-- { -- Leave it here in case we want to configure LSP directly
|
|
||||||
-- "neovim/nvim-lspconfig",
|
|
||||||
-- config = function()
|
|
||||||
-- -- Configure the Pyright language server for Python
|
|
||||||
-- vim.lsp.config('pyright', {
|
|
||||||
-- cmd = { "pyright-langserver", "--stdio" },
|
|
||||||
-- filetypes = { "python" },
|
|
||||||
-- })
|
|
||||||
-- -- Enable the LSP server for Python files
|
|
||||||
-- vim.lsp.enable('pyright')
|
|
||||||
-- end,
|
|
||||||
-- }
|
|
||||||
|
|
||||||
{
|
|
||||||
-- handle LSP server installation and management
|
|
||||||
-- let's be lazy for now.
|
|
||||||
"mason-org/mason.nvim",
|
|
||||||
dependencies = {
|
|
||||||
"mason-org/mason-lspconfig.nvim",
|
|
||||||
"neovim/nvim-lspconfig",
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
require("mason").setup()
|
|
||||||
require("mason-lspconfig").setup()
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
{ -- Auto completion engine
|
{ -- Auto completion engine
|
||||||
'saghen/blink.cmp',
|
'saghen/blink.cmp',
|
||||||
|
event = 'VimEnter', -- Loads the plugin when nvim finishes starting up.
|
||||||
dependencies = { 'rafamadriz/friendly-snippets' },
|
dependencies = { 'rafamadriz/friendly-snippets' },
|
||||||
version = '1.*',
|
version = '1.*',
|
||||||
opts = {
|
opts = {
|
||||||
|
|
@ -78,16 +54,6 @@ return {
|
||||||
opts_extend = { "sources.default" },
|
opts_extend = { "sources.default" },
|
||||||
},
|
},
|
||||||
|
|
||||||
{ -- Let lsp recognize vim functions
|
|
||||||
"folke/lazydev.nvim",
|
|
||||||
ft = "lua", -- only load on lua files
|
|
||||||
opts = {
|
|
||||||
library = {
|
|
||||||
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"echasnovski/mini.nvim",
|
"echasnovski/mini.nvim",
|
||||||
|
|
@ -106,6 +72,7 @@ return {
|
||||||
|
|
||||||
{
|
{
|
||||||
"stevearc/oil.nvim",
|
"stevearc/oil.nvim",
|
||||||
|
event = 'VimEnter', -- Loads the plugin when nvim finishes starting up.
|
||||||
lazy = false,
|
lazy = false,
|
||||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||||
config = function ()
|
config = function ()
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,12 @@
|
||||||
return {
|
return {
|
||||||
'nvim-telescope/telescope.nvim', tag = '0.1.8',
|
'nvim-telescope/telescope.nvim',
|
||||||
|
tag = '0.1.8',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
|
|
||||||
{ 'nvim-lua/plenary.nvim' },
|
{ 'nvim-lua/plenary.nvim' },
|
||||||
|
|
||||||
|
{ 'nvim-telescope/telescope-ui-select.nvim' },
|
||||||
|
|
||||||
{
|
{
|
||||||
'nvim-telescope/telescope-fzf-native.nvim',
|
'nvim-telescope/telescope-fzf-native.nvim',
|
||||||
-- `build` is used to run some command when the plugin is installed/updated.
|
-- `build` is used to run some command when the plugin is installed/updated.
|
||||||
|
|
@ -12,10 +17,21 @@ return {
|
||||||
return vim.fn.executable 'make' == 1
|
return vim.fn.executable 'make' == 1
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{ 'nvim-telescope/telescope-ui-select.nvim' },
|
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
require('telescope').setup({})
|
require('telescope').setup({
|
||||||
|
extensions = {
|
||||||
|
['ui-select'] = {
|
||||||
|
require('telescope.themes').get_dropdown(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- pcall is like try in python
|
||||||
|
pcall(require('telescope').load_extension, 'fzf')
|
||||||
|
pcall(require('telescope').load_extension, 'ui-select')
|
||||||
|
|
||||||
local keymap = vim.keymap.set
|
local keymap = vim.keymap.set
|
||||||
local builtin = require 'telescope.builtin'
|
local builtin = require 'telescope.builtin'
|
||||||
keymap('n', '<leader>fh', builtin.help_tags, { desc = '[F]ind [H]elp' })
|
keymap('n', '<leader>fh', builtin.help_tags, { desc = '[F]ind [H]elp' })
|
||||||
|
|
|
||||||
33
sample.py
33
sample.py
|
|
@ -1,24 +1,29 @@
|
||||||
json = {
|
json = {
|
||||||
'a' : 1,
|
'a': 1,
|
||||||
"b" : 2,
|
"b": 2,
|
||||||
"c" : 3,
|
"c": 3,
|
||||||
"d" : 4,
|
"d": 4,
|
||||||
}
|
}
|
||||||
print("file name sample.py")
|
print("file name sample.py")
|
||||||
def sample_func():
|
|
||||||
|
|
||||||
|
def sample_fun():
|
||||||
print(123)
|
print(123)
|
||||||
|
print()
|
||||||
|
|
||||||
|
|
||||||
####################################################
|
####################################################
|
||||||
|
|
||||||
print("hello, worldworld")
|
|
||||||
print("hello, world, ")
|
print("hello, world, ")
|
||||||
print()
|
print()
|
||||||
print("hello, world, ")
|
print("hello, world, ")
|
||||||
print("hello, world, ")
|
print("hello, world, ")
|
||||||
json = {
|
json = {
|
||||||
"a" : 1,
|
"a": 1,
|
||||||
"b" : 2,
|
"b": 2,
|
||||||
"c" : 3,
|
"c": 3,
|
||||||
"d" : 4,
|
"d": 4,
|
||||||
}
|
}
|
||||||
print("file name sample.py")
|
print("file name sample.py")
|
||||||
if True:
|
if True:
|
||||||
|
|
@ -29,10 +34,10 @@ if True:
|
||||||
|
|
||||||
####################################################
|
####################################################
|
||||||
json = {
|
json = {
|
||||||
"a" : 1,
|
"a": 1,
|
||||||
"b" : 2,
|
"b": 2,
|
||||||
"c" : 3,
|
"c": 3,
|
||||||
"d" : 4,
|
"d": 4,
|
||||||
}
|
}
|
||||||
print("file name sample.py")
|
print("file name sample.py")
|
||||||
if True:
|
if True:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue