Created
March 26, 2023 00:12
-
-
Save xvzftube/e2760e3485aa4724205c958fa526618e to your computer and use it in GitHub Desktop.
new data science nvim config draft
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------------------------- | |
-- xvzf neovim configuration | |
-- neovim website: https://neovim.io/ | |
-- version: | |
------------------------------------------------- | |
------------------------------------------------- | |
-- general settings | |
------------------------------------------------- | |
-- global setup | |
-- :help lua-vim-options | |
local g = vim.g | |
local o = vim.o | |
local opt = vim.opt | |
-- UI things | |
o.number = true -- show line numbers | |
o.numberwidth = 4 -- width for numbers | |
o.cursorline = true -- highlight cursor line | |
-- editing | |
o.expandtab = true -- tabs to spaces | |
o.smarttab = true -- :help smarttab | |
o.autoindent = true -- auto-indent next line | |
o.wrap = true -- softwrap :help | |
o.textwidth = 150 -- hardwrap | |
o.tabstop = 4 -- tabs = 4 spaces | |
o.shiftwidth = 4 -- tabs = 4 spaces | |
o.updatetime = 100 -- faster updates | |
-- Case insensitive searching UNLESS /C or capital in search | |
o.ignorecase = true | |
o.smartcase = true | |
-- Undo and backup options | |
o.backup = false | |
o.writebackup = false | |
o.undofile = true | |
o.swapfile = false | |
-- Better buffer splitting | |
o.splitright = true | |
o.splitbelow = true | |
-- enables mouse support | |
opt.mouse = "a" | |
-- Map <leader> to space | |
g.mapleader = " " | |
g.maplocalleader = " " | |
------------------------------------------------- | |
-- lazy.nvim setup | |
------------------------------------------------- | |
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", | |
lazypath, | |
}) | |
end | |
------------------------------------------------- | |
-- color setup | |
------------------------------------------------- | |
vim.opt.rtp:prepend(lazypath) | |
require("lazy").setup("plugins") | |
-- global setup | |
-- :help lua-vim-options | |
local g = vim.g | |
local o = vim.o | |
local opt = vim.opt | |
--color things | |
vim.o.termguicolors = true | |
vim.cmd[[colorscheme everforest]] | |
vim.o.background = "dark" | |
vim.g.everforest_background = "soft" | |
vim.g.everforest_better_performance = 1 | |
--require("xvzf.auto_lazy") -- lazy.nvim package manager: https://github.com/folke/lazy.nvim | |
--require("xvzf.color") -- color scheme and other highlights | |
-- require("xvzf.maps") -- Keymaps | |
------------------------------------------------- | |
-- plugin setup | |
------------------------------------------------- | |
------------------------------------------------- | |
-- hop setup | |
-- <space> f -> after cursor | |
-- <space> F -> before cursor | |
------------------------------------------------- | |
require'hop'.setup() | |
local hop = require('hop') | |
local directions = require('hop.hint').HintDirection | |
vim.keymap.set('n', '<space>w', function() | |
hop.hint_words({ direction = directions.AFTER_CURSOR, current_line_only = false}) | |
end, {remap=true}) | |
vim.keymap.set('n', '<space>W', function() | |
hop.hint_words({ direction = directions.BEFORE_CURSOR, current_line_only = false}) | |
end, {remap=true}) | |
------------------------------------------------- | |
-- lualine setup | |
------------------------------------------------- | |
require('lualine').setup { | |
options = { | |
icons_enabled = true, | |
theme = 'auto', | |
component_separators = { left = '', right = ''}, | |
section_separators = { left = '', right = ''}, | |
disabled_filetypes = { | |
statusline = {}, | |
winbar = {}, | |
}, | |
ignore_focus = {}, | |
always_divide_middle = true, | |
globalstatus = false, | |
refresh = { | |
statusline = 1000, | |
tabline = 1000, | |
winbar = 1000, | |
} | |
}, | |
sections = { | |
lualine_a = {'mode'}, | |
lualine_b = {'branch', 'diff', 'diagnostics'}, | |
lualine_c = {'filename'}, | |
lualine_x = {'encoding', 'filetype'}, | |
lualine_y = {'progress'}, | |
lualine_z = {'location'} | |
}, | |
inactive_sections = { | |
lualine_a = {}, | |
lualine_b = {}, | |
lualine_c = {'filename'}, | |
lualine_x = {'location'}, | |
lualine_y = {}, | |
lualine_z = {} | |
}, | |
tabline = {}, | |
winbar = {}, | |
inactive_winbar = {}, | |
extensions = {} | |
} | |
------------------------------------------------- | |
-- whichkey setup | |
------------------------------------------------- | |
require("which-key").setup() | |
------------------------------------------------- | |
-- nvim-tree setup | |
------------------------------------------------- | |
require("nvim-tree").setup() | |
------------------------------------------------- | |
-- neo-scroll setup | |
------------------------------------------------- | |
require('neoscroll').setup() | |
require('neoscroll').setup({ | |
-- All these keys will be mapped to their corresponding default scrolling animation | |
mappings = {'<C-u>', '<C-d>', '<C-b>', '<C-f>', | |
'<C-y>', '<C-e>', 'zt', 'zz', 'zb'}, | |
hide_cursor = true, -- Hide cursor while scrolling | |
stop_eof = true, -- Stop at <EOF> when scrolling downwards | |
respect_scrolloff = false, -- Stop scrolling when the cursor reaches the scrolloff margin of the file | |
cursor_scrolls_alone = true, -- The cursor will keep on scrolling even if the window cannot scroll further | |
easing_function = nil, -- Default easing function | |
pre_hook = nil, -- Function to run before the scrolling animation starts | |
post_hook = nil, -- Function to run after the scrolling animation ends | |
performance_mode = false, -- Disable "Performance Mode" on all buffers. | |
}) | |
------------------------------------------------- | |
-- lsp setup | |
------------------------------------------------- | |
require("lspconfig").pyright.setup{} | |
------------------------------------------------- | |
-- nvim-autopairs | |
------------------------------------------------- | |
require("nvim-autopairs").setup() | |
------------------------------------------------- | |
-- mason setup | |
-- (isntall node, npm, wget) :checkhelth mason | |
-- :Mason | |
-- :MasonInstall <lspname> | |
------------------------------------------------- | |
-- for many lsps you need to install witn npm. example: npm -p pyright | |
require("mason").setup() | |
------------------------------------------------- | |
-- iron setup | |
------------------------------------------------- | |
local iron = require("iron.core") | |
iron.setup { | |
config = { | |
-- Whether a repl should be discarded or not | |
scratch_repl = true, | |
-- Your repl definitions come here | |
repl_definition = { | |
sh = { | |
-- Can be a table or a function that | |
-- returns a table (see below) | |
command = {"zsh"} | |
} | |
}, | |
-- How the repl window will be displayed | |
-- See below for more information | |
repl_open_cmd = require('iron.view').right("60%"), | |
}, | |
-- Iron doesn't set keymaps by default anymore. | |
-- You can set them here or manually add keymaps to the functions in iron.core | |
keymaps = { | |
send_motion = "<space>sc", | |
visual_send = "<space>sc", | |
send_file = "<space>sf", | |
send_line = "<space>sl", | |
send_mark = "<space>sm", | |
mark_motion = "<space>mc", | |
mark_visual = "<space>mc", | |
remove_mark = "<space>md", | |
cr = "<space>s<cr>", | |
interrupt = "<space>s<space>", | |
exit = "<space>sq", | |
clear = "<space>cl", | |
}, | |
-- If the highlight is on, you can change how it looks | |
-- For the available options, check nvim_set_hl | |
highlight = { | |
italic = true | |
}, | |
ignore_blank_lines = true, -- ignore blank lines when sending visual select lines | |
} | |
-- iron also has a list of commands, see :h iron-commands for all available commands | |
vim.keymap.set('n', '<space>rs', '<cmd>IronRepl<cr>') | |
vim.keymap.set('n', '<space>rr', '<cmd>IronRestart<cr>') | |
vim.keymap.set('n', '<space>rf', '<cmd>IronFocus<cr>') | |
vim.keymap.set('n', '<space>rh', '<cmd>IronHide<cr>') | |
------------------------------------------------- | |
-- keymaps | |
------------------------------------------------- | |
local function map(mode, key, new_key) | |
-- document function | |
-- mode: n, v, i for normal, visual, insert | |
-- key: standard key bind | |
-- new_key: new key bind | |
vim.keymap.set(mode, key, new_key, { silent = true }) | |
end | |
-- telescope keymap | |
map("n", "<leader>fr", "<CMD>Telescope oldfiles<CR>") | |
map("n", "<leader>ff", "<CMD>Telescope find_files<CR>") | |
-- focus nvim-tree keymap | |
map('n', '<leader>nt', '<cmd>NvimTreeToggle<cr>') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment