Skip to content

Commit

Permalink
Merge pull request #5 from HandyGold75/main
Browse files Browse the repository at this point in the history
Add SpaceportRemapTitle and fix SpaceportRemapDescription/ SpaceportRemapKey
  • Loading branch information
CWood-sdf authored Nov 28, 2024
2 parents 6c00eca + ff56d7a commit a82894b
Show file tree
Hide file tree
Showing 18 changed files with 779 additions and 285 deletions.
168 changes: 168 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
[*.lua]
# [basic]

# optional space/tab
indent_style = space
# if indent_style is space, this is valid
indent_size = 4
# if indent_style is tab, this is valid
tab_width = 4
# none/single/double
quote_style = double

# continuation_indent = 4
## extend option
# continuation_indent.before_block = 4
# continuation_indent.in_expr = 4
# continuation_indent.in_table = 4

# this mean utf8 length , if this is 'unset' then the line width is no longer checked
# this option decides when to chopdown the code
max_line_length = 80

# optional crlf/lf/cr/auto, if it is 'auto', in windows it is crlf other platforms are lf
# in neovim the value 'auto' is not a valid option, please use 'unset'
end_of_line = lf

# none/ comma / semicolon / only_kv_colon
table_separator_style = none

#optional keep/never/always/smart
trailing_table_separator = keep

# keep/remove/remove_table_only/remove_string_only
call_arg_parentheses = keep

detect_end_of_line = false

# this will check text end with new line
insert_final_newline = true

# [space]
space_around_table_field_list = true

space_before_attribute = true

space_before_function_open_parenthesis = false

space_before_function_call_open_parenthesis = false

space_before_closure_open_parenthesis = true

# optional always/only_string/only_table/none
# or true/false
space_before_function_call_single_arg = always
## extend option
## always/keep/none
# space_before_function_call_single_arg.table = always
## always/keep/none
# space_before_function_call_single_arg.string = always

space_before_open_square_bracket = false

space_inside_function_call_parentheses = false

space_inside_function_param_list_parentheses = false

space_inside_square_brackets = false

# like t[#t+1] = 1
space_around_table_append_operator = true

ignore_spaces_inside_function_call = false

# detail number or 'keep'
space_before_inline_comment = 1

# convert '---' to '--- ' or '--' to '-- '
space_after_comment_dash = false

# [operator space]
space_around_math_operator = true
# space_around_math_operator.exponent = false

space_after_comma = true

space_after_comma_in_for_statement = true

# true/false or none/always/no_space_asym
space_around_concat_operator = true

space_around_logical_operator = true

# true/false or none/always/no_space_asym
space_around_assign_operator = true

# [align]

align_call_args = false

align_function_params = true

align_continuous_assign_statement = true

align_continuous_rect_table_field = true

align_continuous_line_space = 2

align_if_branch = false

# option none / always / contain_curly/
align_array_table = true

align_continuous_similar_call_args = false

align_continuous_inline_comment = true
# option none / always / only_call_stmt
align_chain_expr = always

# [indent]

never_indent_before_if_condition = false

never_indent_comment_on_if_branch = false

keep_indents_on_empty_lines = false

allow_non_indented_comments = false
# [line space]

# The following configuration supports four expressions
# keep
# fixed(n)
# min(n)
# max(n)
# for eg. min(2)

line_space_after_if_statement = keep

line_space_after_do_statement = keep

line_space_after_while_statement = keep

line_space_after_repeat_statement = keep

line_space_after_for_statement = keep

line_space_after_local_or_assign_statement = keep

line_space_after_function_statement = fixed(2)

line_space_after_expression_statement = keep

line_space_after_comment = keep

line_space_around_block = fixed(1)
# [line break]
break_all_list_when_line_exceed = false

auto_collapse_lines = false

break_before_braces = false

# [preference]
ignore_space_after_colon = false

remove_call_expression_list_finish_comma = false
# keep / always / same_line / replace_with_newline / never
end_statement_with_semicolon = never
75 changes: 73 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ The default options are:
"recents",
},

-- toggle or set file and directory icons.
-- For example, the following can be used to set different icons `{ file = " ", dir = " ", remaps = " ", pinned = " ", today = " ", yesterday = " ", week = " ", month = " ", long = " ", news = "󱀄 " }`
icons = true

-- For true speed, it has the type string[][],
-- each element of the shortcuts array contains two strings, the first is the key, the second is a match string to a directory
-- for example, I have ~/.config/nvim as shortcut f, so I can type `f` to go to my neovim dotfiles, this is set with { { "f", ".config/nvim" } }
Expand All @@ -97,6 +101,7 @@ The default options are:
- replaceHome: This option is just a more specific version of replaceDirs, it makes it so that the home directory is replaced with `~`
- lastViewTime: This option makes it so that there are not a lot of directories on the screen (which can look kind of ugly). There is also a functional purpose for this, if a directory is number 50, it would be faster to find it by using telescope than by scrolling through the list
- maxRecentFiles: This option is just a different version of lastViewTime
- icons: This option can be enabled to show file and directory icons for entries or can be set for custom icons.
- shortcuts: This option is to enable true speed (AKA get to your project before spaceport can even render speed).
For some directories, even typing `1p` is too slow, sometimes I just want to instantly be at a directory.
This option is a 2d array, but the important thing is that the second element is a _lua match string_ and not an absolute directory.
Expand Down Expand Up @@ -142,7 +147,6 @@ All the preconfigured sections are:
- `name`: This section displays an ascii art "Spaceport" logo
- `remaps`: This section displays all the remaps that are defined as visible in all the other screens
- `recents`: This section displays the most recently used projects, as well as the pinned projects
- `name_blue_green`: This section displays the ascii art logo, but with a blue-green gradient
- `hacker_news`: This section displays the top 5 stories on hacker news

### Modifying Sections
Expand Down Expand Up @@ -188,9 +192,76 @@ This selects a remap with the key of `ogkey` (for example, the key to select a p

The fields allowed to be overriden in a remap are detailed in the class `SpaceportRemapModifier` in `lua/spaceport/init.lua`

Additionally, some sections accept a `config` property.

### Modifying the name ascii art

There are three different types of name ascii art provided currently:

`hash`:

```
### ### # ### ### ### ### ### ###
# # # # # # # # # # # # # #
### ### ### # ## ### # # ### #
# # # # # # # # # # # #
### # # # ### ### # ### # # #
```

`pipe`:

```
╔═╗┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐┬─┐┌┬┐
╚═╗├─┘├─┤│ ├┤ ├─┘│ │├┬┘ │
╚═╝┴ ┴ ┴└─┘└─┘┴ └─┘┴└─ ┴
```

and `lite`:

```
_____ ______ _
/ ___| | ___ \ | |
\ `--. _ __ __ _ ___ ___ | |_/ /__ _ __| |_
`--. \ '_ \ / _` |/ __/ _ \ | __/ _ \| '__| __|
/\__/ / |_) | (_| | (_| __/ | | | (_) | | | |_
\____/| .__/ \__,_|\___\___| \_| \___/|_| \__|
| |
|_|
```

there are also two available gradient types available right now (`blue` and `blue_green`). the gradient and name style can be changed by modifying the `config` for the name screen:

```lua
sections = {
{
"name",
config = {
style = "lite",
gradient = "blue_green",
},
},
}
```

If you want to provide your own name and gradient, you can look at the definition for `local gradients` and `local styles` in `lua/spaceport/screen/name.lua`:

```lua
sections = {
{
"name",
config = {
style = "lite",
gradient = {
{ start = "#ff0000", stop = "#990000", dir = "left" },
},
},
},
}
```

### Default Screen Highlight Groups

If you want to change the highlighting of the recents or remaps sections, you can set any of the following highlight groups: `SpaceportRemapDescription`, `SpaceportRemapKey`, `SpaceportRecentsTitle`, `SpaceportRecentsProject`, or `SpaceportRecentsCount`
If you want to change the highlighting of the recents or remaps sections, you can set any of the following highlight groups: `SpaceportRemapTitle`, `SpaceportRemapDescription`, `SpaceportRemapKey`, `SpaceportRecentsTitle`, `SpaceportRecentsProject`, or `SpaceportRecentsCount`

The code to do that would look like this:

Expand Down
20 changes: 11 additions & 9 deletions lua/spaceport/data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,11 @@ function M.refreshData()
table.insert(pinnedData, insert)
end
end
table.sort(data, function(a, b)
table.sort(data, function (a, b)
return a.time > b.time
end)

table.sort(pinnedData, function(a, b)
table.sort(pinnedData, function (a, b)
return a.pinNumber < b.pinNumber
end)
end
Expand All @@ -224,7 +224,7 @@ function M.getAllData()
for _, v in pairs(pinnedData) do
table.insert(ret, v)
end
table.sort(ret, function(a, b)
table.sort(ret, function (a, b)
return a.time > b.time
end)
return ret
Expand Down Expand Up @@ -300,7 +300,7 @@ function M.useWindowName()
return
end
vim.fn.jobstart({ "tmux", "rename-window", currentDir.tmuxWindowName }, {
on_exit = function()
on_exit = function ()
end,
})
end
Expand All @@ -316,7 +316,7 @@ function M.useSessionName()
return
end
vim.fn.jobstart({ "tmux", "rename-session", currentDir.tmuxSessionName }, {
on_exit = function()
on_exit = function ()
end,
})
end
Expand All @@ -331,7 +331,7 @@ function M.tmuxSplitWindowDown()
return
end
vim.fn.jobstart({ "tmux", "split-window", "-c" .. currentDir.dir }, {
on_exit = function()
on_exit = function ()
end,
})
end
Expand All @@ -346,7 +346,7 @@ function M.tmuxSplitWindowLeft()
return
end
vim.fn.jobstart({ "tmux", "split-window", "-h", "-c" .. currentDir.dir }, {
on_exit = function()
on_exit = function ()
end,
})
end
Expand Down Expand Up @@ -405,7 +405,8 @@ function M.cd(dir)
local answer = vim.fn.input(
"It seems like "
.. dir.dir
.. " does not exist anymore, would you like it to be removed from spaceport? (y/n):"
..
" does not exist anymore, would you like it to be removed from spaceport? (y/n):"
)
if answer == "y" then
M.removeDir(dir.dir)
Expand All @@ -431,7 +432,8 @@ function M.cd(dir)
local answer = vim.fn.input(
"It seems like "
.. dir.dir
.. " does not exist anymore, would you like it to be removed from spaceport? (y/n):"
..
" does not exist anymore, would you like it to be removed from spaceport? (y/n):"
)
if answer == "y" then
M.removeDir(dir.dir)
Expand Down
Loading

0 comments on commit a82894b

Please sign in to comment.